Custom node version to run VSCode extensions - visual-studio-code

I'm making a vscode extension for my personal use. I'd really like to use a more recent node version. However, I'm not sure how does VSCode chooses which node version to use.
The only node.js that I have installed is 8.1.3. But when I debug the extension, I see that VSCode uses 7.*.* (via process.version).
I've been searching documentation for an hour, so far, without luck. Any help is appreciated.

This is not possible. Quoting the reply of one of the team members (Andre Weinand) in #18253:
VS Code runs extensions on the node version that is built into electron (on which VS Code is based). This cannot be changed.

Related

VSCode language extension not recognized

I have created a new extension (tmlanguage) for VSCode using the Yeoman generator.
The extension where copied to users//.vscode/extensions.
This extenxion is working fine on two of my computers and one collegua's machine.
The extension is implemented, and i can see it in the extensions browser in VSCode.
When I added this for two other colleguas, the same way I did for the 3 first computers, it doesn't work. VSCode acts as if there is noe extensions to read, or does not read them at all. As if it does not check the extension folder.
I have tried to disable all extension, then enable them again, but still the same.
In the Extension browser there is no mentioning of the new extension.
Have tried restarting VSCode.
One of the machines is Win 11, but the other is Win 10. The machines that work are all Win 10, not that I think this has something to do with it.
All running latest version of VSCode.
Is there a way to force VSCode to recognize the extensions?
Have anybody experienced similar things?
Thanks to Lex Li for pointing me in the correct direction. I thought I had followed the correct way to do this, to just copy the extension to the .vscode\extensions folder, as specified in several tutorials.
But using the vsce to generate a .vsix file did work.

VSCode Intellisense Not Working In Jupyter Notebook Extension(MacOS)

I have an issue with VS Code which I recently installed in my MacOS BigSur.
I tried out the Jupyter Notebook extension and in their documentation it says that they have full intellisense support for this extension as well.
Intellisense in Jupyter Notebook in VSCode works well for completing variables, functions,methods,etc....
The only issue I have is that I am not able to get the arguments/parameter information, though it is working fine with the python extension of VSCode
I tried out things like Shift+TAB...which works in JupyterNotebooks(not the VS Code version).
Is this a bug that I am facing...or is it just like that. Can you also please suggest as to how to make this work.
Edit May 12, 2021: With the Pylance language server (now the default), I now get parameters and type hints.
According to this issue on GitHub, the arg/param info is not supported on stable VS Code. It looks like you need to use the "Native Notebook" in VS Code Insiders (the beta) and use the "Pylance" language server Extension.
I haven't tried this solution myself (not sure I want to install Insiders), but just changing the language server to "Pylance" at least gives you signatures.

Multiple configurations for VSCode

At the moment I'm working on a few projects at the same time using VSCode, one in react, another in angular and some good old javascript.
The problem is that I have a few extensions installed that conflict, for example, some code snippets that are the same for React and Angular.
Is it possible to have 3 visual studio code installed on a Mac with different extensions installed?
There are two options for such setup:
Portable installation - unzip VSCode in a folder and create a subfolder there called data. This will trigger the portable mode and all settings will be stored in that data folder. The downside is that you'll have to manually update every portable folder whenever new version comes out. More info here.
Custom config paths - create a shortcut for your VSCode installation, and add those parameters:
--user-data-dir <some-path> --extensions-dir <some-path>
You can put them wherever and have as much shortcuts as you want, they even run in parallel. Best part is once you update the installation, all the configs are upgraded too. More info here.
Both modes are incompatible, so you have to choose one.

VS Code - how to rollback extension/install specific extension version

Just got an update for the Golang extension and it appears to be broken, reporting an error on a package main that's literally just a list of my imports with no useful information (see screenshot below). It's refusing to lint or do anything useful which is annoying.
So I want to quickly jump back to the previous version, how can I do this in VS Code? I can't seem to find it in the docs at all.
NB: I'm using VS Code version 1.10.1 with only the golang package. The code is valid golang.
From v1.30 release notes: install previous versions of extensions.
You can now go back to a previous version of an extension if there are
issues with the current version. VS Code provides an Install Another
Version action on an installed extension which shows a dropdown of
available versions.
The option to install another version is in the context menu. Or the gear icon for each extension. Or the Extension Page in vscode: Uninstall dropdown: Install another version....
For me when I do this - without "Disable Auto Updating Extensions" (I assume that the Debugger for Chrome is such an extension) it does not auto-update on reload or close/open but shows a button for that extension to install the latest version instead.
So it appears you don't have to disable all auto-updating extensions just to revert one extension to an older version and keep it at that older version. [leave a comment if you find that isn't true, thanks]
Update for vscode v1.75:
See pinning extensions (to a specific version):
Make sure you have extension autoupdates enabled and try pinning
extensions to a specific version using following UI. Make sure
extensions are not getting auto updated after pinning.
From CLI : Install a specific version using following format -
code-insiders --install-extension eamodio.gitlens#13.1.1
From Extensions UI - Use *Install Another Version... action in the
context menu of the installed extension.
Make sure the pinned version is synced across VS Code instances - Use
Settings Sync feature to test this. To have different instances of VS
Code on same machine, open VS Code from CLI using different
user-data-dir and extensions-dir. Eg: code-insiders --user-data-dir <path> --extensions-dir <path>
Export and Import the profile with the pinned extension and make sure
in the imported profile, extension is still pinned. Export and Import
profile actions are available in the global activity context menu
(gear).
Si it appears that regardless of the Disable Auto Updating Extensions setting, pinning/reverting to a previous version of an extension should result in that extension not updating.
[EDIT] now it is supported -> see accepted answer
Currently downgrading is not (yet) supported.
However, you can uninstall the extension and then manually download and install a specific version by hand: https://code.visualstudio.com/docs/extensions/install-extension
And also this excellent answer: How to install VSCode extensions offline?

VSCode - TypeScript language service died unexpectedly 5 times in the last 5 minutes

This error message keeps sliding down from the top every few seconds. I click on the close button and it comes back again. I am not and don't plan on using TypeScript in any of my projects.
Is there a way to "silent" this warning message?
Is there a way to change the frequency that the warnings slide down on the screen?
This is happening in VSCode 1.8.1 and 1.9 on Windows 10 and Windows 8.
I work on TypeScript for VSCode.
The TypeScript language service powers language features for both TypeScript and JavaScript code. Without it, you do not get any suggestions or intellisense or any other nice language support.
Please open an issue against VSCode if you are seeing this error. You can also try upgrading the version of TypeScript that VS Code uses to pick up the latest fixes and features: https://code.visualstudio.com/Docs/languages/typescript#_using-newer-typescript-versions
(I'm also looking into a better way to handle this message since it can be very spammy when the TypeScript service crashes continually)
I resolve my problem by use this way:
first, open your typescript.tsserver.log to "verbose"
restart vscode, and open ts log
and you will find when make your tsserver so slow, as for me, jest_cache is the problem. so I add a exclude in my tsconfig.json
restart, and the problem solve.
I the same problem with VSCode using a workspace Yarn and Typescript. After a couple months without a solution, I tried updating the Yarn VSCode SDK using yarn dlx #yarnpkg/sdks vscode as part of these instructions and that fixed my problem.
you can try to install this vscode extension to make vscode use latest typescript version
To people getting here using WSL2 & Ubuntu(?)
rm -rf ./vscode-server worked for me
Disabling the "JavaScript and TypeScript Nightly" extension worked for me.
The error always said that the workspace was using an old verison of typescript and that I should upgrade although I was up to date. It looks the workspace was using the latest dev build of typescript because of the extension or something like that maybe caused the error.
For a temprary solution you need to rollback to an older version. In my case it worked with: https://code.visualstudio.com/updates/v1_39.
upgrading to TypeScript v3.7.3 and using VSCode Insider's Edition seems to fix the issue for me.
There are multiple ways to upgrade. One way is:
yarn add -D typescript#3.7.3
https://github.com/microsoft/vscode/issues/84618#issuecomment-562290275
Here is my solution which I spent 1 week.
Fallback version to Version: 1.61.2 (Universal)
Rmove your local VsCode totaly.
quit it
remove it from your Application folder
remove the file ~/.vscode
rm -rf ~/.vscode
Install the vsCode v1.61.2 and open it;
Close the aoto update. it's important
find the menu Code > preferences > settings
search keyword of update
set Application/Update/update > mode > none
Open your ts project
Hope help you
took me a few confusing days, as it kept trying to default to 16.8 which I had not installed via nvm
I installed and un-installed 16.8, set the default and system aliases (always alias to a version number without any letters ['v']
Finally I found a posting that said, no matter what you have installed for nvm MacOS will always use the system Node if there is one.
So: brew uninstall node got rid of a version that I didn't was on my mac... I've been using nvm for many years, so I don't know how it got there. Perhaps it came in as a dependency...
Since I use nvm, and always want the typescript support I pinned it to a particular version of node that I know has typescript installed globally
tsdk: /Users/ajoslin/.nvm/versions/node/v16.14.0/lib/node_modules/typescript/lib/
In my case, I didn't have the typescript compiler (tsc) installed on my system. So npm install -g typescript resolve my problem.