custom vscode extension not working over ssh - visual-studio-code

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

Related

vscode extension development: svelte content not loading in webview after building the vscode extension

I am building a vscode extension by using svelte for webview. I am following https://youtu.be/a5DX5pQ9p5M. But the deployment of extension is not mentioned in the tutorial .
So i am following https://code.visualstudio.com/api/working-with-extensions/publishing-extension.
So after packaging the extension with vsce package and installing the extension the extension doesn't load svelte content but when running in developer mode everything works fine.
I tried creating the package extension multiple Times but still didn't work.
Check if all necessarily files are included via:
vsce ls
(You can also open packaged extensions, they are just ZIP-archives with a different extension.)
If they are not (e.g. src is excluded by default), you probably can create a .vscodeignore file and manually specify what to exclude.
Running extension problems can be inspected via Help > Toggle Developer Tools, usually you will find some errors in the console.
I do not know if debugging forces the extension to load, but if so, make sure you have set the correct activationEvents.

How do I prevent the .dccache file from being created?

vscode keeps adding a file named .dccache. How can I prevent this?
It messes up the github diffs and I keep on having to add .dccache to the .gitignore for several different projects.
I can't find anything about why .dccache is being created in the first place
It can also be created by the Snyk extension.
I have the same file, I believe this is being created from DeepCode: https://www.deepcode.ai/
This is a code analysis tool to try to find issues. Check if you installed the DeepCode extension in VSCode if you want to get rid of this file, otherwise ignoring it should be fine.
The DeepCode plugins or the CLI is using this file to create a cache for the source code bundles send to the analysis engine. Without this cache, the collection and upload would be very time-consuming.
As it only serves as a caching mechanism, you can exclude it from git uploads and ignore it otherwise.
Snyk extention has a Help&Feedback tab, on the FAQ there is a 'Add custom .dcignore file to your workspace'.
Sometimes git ignore doesn't work for me
I used this file: https://github.com/DeepCodeAI/dcignore/blob/master/full.dcignore.js
just create .dcignore and copy all contents to that. I manually add .dccache and .dcignore just in case.
I had the same issue and when I disabled Snyk extension on VS code editor is disappeared, if you don't have Snyk installed and still have .dccache appearing every now and them, just keep an eye on the other extensions, disable each one at a time and see which one is creating the .dccache file

How can I choose the right edition of extension for vscode?

I am trying to install the ssh vscode extension offline by Install from VSIX. However, there is an error saying Unable to install extension 'ms-vscode-remote.remote-ssh' as it is not compatible with VS Code '1.39.2'. Is there a table in which I can get the correct match between my vscode and extensions?
There does not appear to be a table listing all of the versions for the Remote - SSH extension. The package does not include a changelog file, and the github page is just a placeholder for filing issues (so there's no useful history information there either).
However, the marketplace page has a "Version History" tab. That tab only lists the past five versions (0.55.0 to 0.62.0 at time of writing), but hovering the mouse on a link shows the URL pattern, so if you know or can guess the names of past versions then you can download them. For example, I guessed that 0.45.0 probably existed, and indeed it does: link to version 0.45.0.
Having downloaded the vsix file, you can unpack it by renaming the extension to zip and using any tool that understands the zip format (since that is what vsix is). Then check the package.json inside it to see which version it requires. In the case of 0.45.0, I see:
...
"engines": {
"vscode": "^1.36.0"
},
...
meaning that version works with VSCode 1.36.0 and (in theory) greater.
You could keep doing that, using binary search, to find the best match for your version of VSCode.
If you need to do this for another extension(s), and that extension does have a changelog file, it should be linked on the Version History tab as well as contained in the latest vsix package, and reading that may be easier than binary searching among downloads, depending on how it is written.

Manage multiple YAML extensions

I have the Home Assistant extension installed in VSCode but also want to use the ESPHome extension, both of these are for YAML files.
I need a way of telling VSCode which extension to use.
I wonder if it is possible to configure VSCode to use a specific extension in a specified folder tree or else to put something in the YAML file itself so the extension can recognise that it should be effective for that YAML file.
If I understand your question correct, you want to select installed extensions for in your case; YAML files.
VSCode :
Home Assistant extension
ESPHome extension
Via 'exentension' > 'dis/enabled [workspace]', you can arrange it.
Workspace recommended extensions#
A good set of extensions can make working with a particular workspace or programming language more productive and you'd often like to share this list with your team or colleagues. You can create a recommended list of extensions for a workspace with the Extensions: Configure Recommended Extensions (Workspace) command.
Extra information SEE https://github.com/Microsoft/vscode/issues/19792
This option was moved into Command pallette (F1)

How to override Visual Studio Code source

I want to be able to extend/override some of the VS Code source in my extension, but I'm not sure how to do so. Is this possible?
Extensions (as the name says) can extend the functionality of the host application (here vscode), but they are separate code parts which have no access to the host application code and structures (except those particularly exported for use by extensions).
If you want to modify vscode source code then clone the repo, change the code and build your own vscode application.