0

I am using VScode on both my Macbook and my PC and my settings are synced. I use coderunner to run my python programs. My problem is that in my settings.json, the command I use to run my program on my mac is different to the one I need to use on my PC. The specific command I use is clear && python3 -u. Since Vscode runs my code through the terminal, I have it clear every time I run it. When I am on my PC instead of my Mac, the command does not work. I do not want to have to change the command in the settings every time I switch beween computers. This is what the settings look like.

enter image description here

I did try switching it at first to just py in my PC settings, since that is the command that the PC command prompt needs to activate python. But even that gave me an error and it changed the settings on my macbook. Is there something in the settings I can add or change to unsync it? Or do I just deal with it? I dont want to unsync everything else if possible.

rioV8
  • 24,506
  • 3
  • 32
  • 49
phamj0
  • 13
  • 1
  • You will need to ask yourself how you enabled the settings sync, via VS Code itself, or any other extensions. Without that nobody can help. – Lex Li Nov 08 '22 at 00:55
  • @LexLi the settings are actually synced automatically once we login to an account either Microsoft or Github. But I actually found my answer. There is a setting called `settingsSync.ignoredSettings` that I added to the bottom. I just ignored the executorMap setting. – phamj0 Nov 08 '22 at 01:21
  • No screenshots of text please – Pranav Hosangadi Nov 08 '22 at 02:53

2 Answers2

0

You put forward a solution in the comment.

I think I can add it appropriately. In the detailed description of Settings Sync, we can also use ignoreUploadFiles or ignoreUploadFolders to disable the specified file:

enter image description here

MingJie-MSFT
  • 5,569
  • 1
  • 2
  • 13
0

As you already found out, you can exclude specific settings from syncing by defining this in your JSON config:

"settingsSync.ignoredSettings": [
    "code-runner.executorMap",
]

This will prevent your defined executors for ALL languages from being synced, though. If you want to keep syncing all the other executors, you might want to change your executor command instead so that it is platform agnostic.

You can check if you're running on Mac or Linux using the uname command. A single line command chain to run a different command for each platform would look like this:

[[ $(uname -s) =~ ^Darwin ]] && (my_mac_commands) || (my_linux_commands)

So in your case you probably could define something like this to make the executor command work on both your platforms:

"python": "[[ $(uname -s) =~ ^Darwin ]] && cmd=\"clear && python3 -u\" || cmd=\"py\"; eval \"$cmd\"",
carlfriedrich
  • 2,919
  • 1
  • 15
  • 29