VSC platform-specific settings - visual-studio-code

My settings.json on Linux machine contains setting lines for cortex-debug extension:
"cortex-debug.armToolchainPath": "/opt/gcc-arm-none-eabi/bin/",
"cortex-debug.JLinkGDBServerPath": "/opt/SEGGER/JLink_V754b/JLinkGDBServerCLExe",
The same file on Windows machine should refer to a different file name JLinkGDBServerCL.exe (yes, I understand such dumb naming is guilty of Segger, but...)
When settings sync turned on, I continuously get the wrong config on one (Windows or Linux) machine.
Is it possible to set a platform-specific section in settings.json to define a different key for an extension?

One way is to use VSCode's features to define machine specific settings or prevent certain settings from being synced,
https://code.visualstudio.com/docs/editor/settings-sync#_configuring-synced-data

Ok, found another solution for my problem.
At first, install platform-settings from marketplace:
https://marketplace.visualstudio.com/items?itemName=runarsf.platform-settings
Next, move required settings to a new place:
"platformSettings.platforms": {
"win32": {
"cortex-debug.armToolchainPath": "C:/Program Files (x86)/GNUARM/bin/",
"cortex-debug.JLinkGDBServerPath": "JLinkGDBServerCL.Exe",
},
"linux": {
"cortex-debug.armToolchainPath": "/opt/gcc-arm-none-eabi/bin/",
"cortex-debug.JLinkGDBServerPath": "/opt/SEGGER/JLink_V754b/JLinkGDBServerCLExe"
}
}
But variant with sync prevention looks pretty good.

Related

custom vscode extension not working over ssh

I created a vscode extension for the first time..I used LSP(language server protocol) and having both client and server bundled as one extension.
The extension has highlighting and autocomplete features for a custom file type. I packaged it using vsce I got a VSIX file. I installed the extension in my vscode using the .vsix file.
The extension works when i am working on local files.
However, i connected to a remote VM using the ms-vscode-remote.remote-ssh extension such that I can view the remote files in vscode, but here my created extension is not working. I can't even see the file type i created.
Any help is appreciated. Is there some specific setting I need to put in my package.json
For your extension to properly work remotely, either installed on host or on the remote, you have to follow a few guidelines, and yes, there are some settings that you may take care of on package.json.
The first and more complete source of information is Supporting Remote Development and GitHub Codespaces API documentation. It describes the architecture, settings, how to debug, common problems and so on. There is also the Extension Host page, where it describes the Preferred extension location topic, which tells you how to configure your extension to work on the correct location.
Based on your description (a LSP related extension) I understand your extension should be a Workspace Extension. This means that you should have this on your package.json:
"extensionKind": [
"workspace"
]
The Commons Problem section describes how you can evaluate and fix Incorrect execution location. To debug using SSH follow these instructions.
Also, remember that while working with remotes, you rely on local paths anymore. Instead you must always deal with Uri, whenever possible.
I guess after reviewing your settings, based on the docs related above, you should be able to detect what is happening on your extension and fix it. Give debug a try, it will be much easier to detect issues than installing the vsix and look for erros in Console.
Hope this helps

Disable VSCode Extensions in user settings

I'm building a VSCode appliance in docker with multiple pre-installed extensions.
By default the extensions get enabled when a session is created including a settings file in $HOME/.local/share/code-server/User/state/.json.
When I disable an extension in the UI the extension gets an entry in this config file meaning that it is disabled.
Is there a way to disable an extension before a session is created?
I was looking at the $HOME/.local/share/code-server/User/settings.json file but in the documentation I can't see an attribute for that.
thanks in advance
There was an option to turn off extension for the specific project.
Unfortunately, this option is not longer available:
Feature Link(used to work): Ability to enable extensions only on specific workspaces #15611

WebdriverIO autocomplete in VSCODE

I am wonder, if it is way how to enable autocompletion for WDIO global variables ( $, $$, browser ) in VSCode. I know, that wdio has support for Webstorm, but it doesn't work for VSCode.
Any idea, how to use autocompletion in VSCode? Without it is pretty hard to create some tests.
I struggled with this as well. Firstly, ensure you've followed the "Autocompletion" Setup described on the website; for example, they require something like the following exist in a file called jsconfig.json at the root of your project:
{
"include": [
"**/*.js",
"**/*.json",
"node_modules/#wdio/sync",
"node_modules/#wdio/mocha-framework"
]
}
You may already have a jsconfig.json; if so, ensure that the node_modules directories are not in a section called "exclude": { ... }. When setting up other things like Babel (for mocha) this may get installed as a default configuration entry. When node_modules is in both include and exclude, exclude takes precedence.
I had zero success importing npm #types pacakges, adding typeAcquisition: {} to jsconfig.json, or adding interface browser; into the file global.d.ts as other people have suggested in various forums.
Auto completion is pre-installed on vs code. If it is not working you might want to check through extension and install. And to use, once the open tag is created, it often auto suggest, just do appropriately then input your attribute.

How can you sync/share files from one computer to another in VS Code?

I am using 2 computers to code in VS Code, but I want to sync a specific file when I edit it in both computers. Do you have any extensions, or servers that allows it to sync?
I tried looking in Google, some said try FTP, and some said use "Settings Sync". (I installed Settings Sync, but I don't really know if it can sync my files.)
Option 1
Use vscode remote development.
Select main machine which would host all the files and use SSH to access the files from the other machine.
Option 2
Rsync is a standard linux tool which can be used.
Use can use vscode rsync extension for syncing the files from one machine into the other.
I think that the closest experience to what you have in mind that you can get currently on VSCode is Visual Studio Live Share. This is an official extensions suite that lets you share your screen with multiple hosts, it also shares most of your current VSCode editor features (like intellisense) and can be enabled with voice and text chats. I would also suggest to set up a git repository for the files you are going to work with, so that hard copies of all your files will be avaialble to all your users.

How to configure SublimeREPL for mit-scheme?

I have installed SublimeREPL, and now I am trying to customize the interpreters a bit. How can I add MIT Scheme to the Tools->SublimeREPL menu? I am new to Sublime Text 2.
You can read documentation about configuring additional REPLs here:http://sublimerepl.readthedocs.org/en/latest/#basics-of-language-integration-configuration-and-launch-commands
And take a look at existing Scheme configuration here:
https://github.com/wuub/SublimeREPL/tree/master/config/Scheme
Most Scheme/Lisp dialects are quite easy to configure, you should have no problems whatsoever.
Please allow me to share my experience. Just made it work on my machine.
First, recommend you to install a SCM implementation of Scheme, which is much easier to config than mit-scheme.
If you use windows, the env variable should be added to the system
automatically after you finished installation.
Then, open Preferences -> Browse Packages -> SublimeREPL -> config -> Scheme -> Main.sublime-menu.
At last, config this file like this:
Now it should work. Enjoy it!
After trying for a good 2 hours, I finally figured out how to get it working in SublimeText 3.
First install the package "Scheme" through package control.
Then install the package "SublimeREPL" (for Sublime Text 2/3).
Then install SCM implementation of scheme as #mons mentioned.
Once Done, modify the file shown below.
SublimeText3 >> InstalledPackages >> Scheme.sublime-package (open with Zip software) >> Scheme.sublime-build (modify to the following below)
{
"cmd": ["scm", "-f", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.scheme"
}
I realised that my "Scheme" installed through Package Installer was overriding my Sublime Build Settings in the SublimeREPL folder. That's why it didnt work eventhough I modified my settings as #mons mentioned.
Thats it.
Hope it works. :)