vscode extension development: svelte content not loading in webview after building the vscode extension - visual-studio-code

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.

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

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)

Can an extension pack set the configuration options of one of the included extensions?

I have created an extension pack for VSCode. I would like my extension pack to set some configuration options of the included extensions. Can it be done writing some magic in the package.json file of my extension pack?
https://code.visualstudio.com/docs/extensionAPI/extension-points#_contributesconfiguration explains how an extension can create its own configuration using package.json
https://github.com/Microsoft/vscode/issues/1396 seems to be a related vscode issue but I could not say if it allows the changing of the options using package.json.
I have read the package.json files of some vscode extension packs and I have not found any example of what I want to do.
i figured out an answer to this:
redefine the configuration setting but with the changed setting.
take a look at this code for example.

How to install typings for Visual Studio Code in an offline development environment?

I'm using VisualStudio Code, and trying to enable IntelliSense. It seems to be dependent on typings. How can I install these offline? In PowerShell, running
typings search leaflet
returned an error (unsurprising, because I'm offline).
Unable to connect to "https://api.typings.org/search?query=leaflet"
Running that web query on an online computer resulted in a difficult to read JSON file. A further google search resulted in this likely candidate:
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/leaflet/index.d.ts
My question has three parts, and I'd appreciate pointers on any of these.
1) How can I figure out what typings I need?
2) Which files do I need to take to the offline computer? Do I just need the d.ts file?
2) Where should this file be installed so that VS Code can read it?
1) Simply put: if your Visual Studio Code is complaining about not being able to resolve something. Lets say I'm working with jQuery, I'm using $ a lot in my project and it's going to give me an error because it's not Typescript/JavaScript.
To resolve this, I create a JSON file to the root of my project called typings.json. It will look like this:
{
"resolution": "typings/",
"globalDependencies": {
"jquery": "github:DefinitelyTyped/DefinitelyTyped/jquery/index.d.ts"
}
}
Then in the Terminal tab (CTRL + SHIFT + <) execute the following command:
typings install
Now it will download the required typings and put the contents to root/typings/. You'll need to reference it in each file you're using (in this case) jQuery in by adding the following to the top of your TS file:
/// <reference path="./typings/globals/jquery/index.d.ts" />
You can also create a definition (.d.ts) file in the root/typings folder and add all the references there so you only have to reference that file.
2) After installing the typings in the previous step, you can copy the typings folder and put it on your offline computer. It's as easy as that. You don't need other files (not even the typings.json file, if you wish).
2) You need to reference definition (d.ts) files at the top of your .ts files.

Extension not found error with control flow extension

I am trying to use https://github.com/qiemem/ControlFlowExtension as an alternative to if-else.
I have it to added to the extensions folder(C:\Program Files (x86)\NetLogo 5.1.0\extensions). The extracted zipped folder from github.
In the NetLogo code I use the following,
extensions[ControlFlowExtension-master]
But it still shows me the following error:
There is no release for the extension yet. The zip file that you downloaded is just the source code and doesn't contain the compiled JAR files that you need to use the extension with NetLogo.
If you want to try it out, you will have to build it yourself. For that, you will need to install sbt. Then, open a command terminal and cd to the folder where you unzipped the file you downloaded from GitHub. This folder should be under the NetLogo extensions folder and be called cf (rename it if it is not the case). Once you are in the cf folder, run:
sbt package
This should build cf.jar and allow you to use the extension by putting
extensions [ cf ]
at the top of the code tab in your NetLogo model.
Be aware, though, that the extension is still very much experimental. There may be bugs. The syntax could still change. This is why Bryan did not put out an official release yet.