Cannot find module 'vscode' - Missing VSCode engine declaration in package.json - visual-studio-code

I'm developing a VSCode extension (package.json) and I get the "Error: Cannot find module 'vscode'" whenever I run it.
I've already tried running
npm install
and it did not help.
When I run
node ./node_modules/vscode/bin/install
I get "Error installing vscode.d.ts: Missing VSCode engine declaration in package.json.".

Remove the "vscode" dev dependency. No idea what that is for.

Your package.json is out of date, and is still using a deprecated definition. This has been changed, if I remember correctly, a couple of years ago.
You should update your dependency to something like
"devDependencies": {
"#types/vscode": "^1.73.0"
...
}
And don't forget to update the engines entry as well, to reflect the minimun VS Code version your extension will support.
"engines": {
"vscode": "^1.73.0"
},
Hope this helps

I'm not sure what it is yet, and I'll be back if I figure it out, but I'm assuming this is expecting to be run in VS Code, and I'm not doing that. I'm trying to create an LSP client outside of VS Code, and I think thats the rub.

Related

How can I make VSCode auto complete work for Terraform on Mac?

I can't make auto complete work for .tf (and related) files with VSCode on my MacBook Pro.
Steps I took were:
Installed the HashiCorp Terraform plugin
Installed Terraform Language Server brew install terraform-ls
Got the path:
: which terraform-ls
/usr/local/bin/terraform-ls
And finally configured VSCode:
"terraform.languageServer": {
"external": true,
"pathToBinary": "/usr/local/bin/terraform-ls",
"args": [
"serve"
],
"maxNumberOfProblems": 100,
"trace.server": "off"
}
I just get the auto completion for aws items which are already in this file:
What am I missing here?
I wish those things were plug and play :(
This is a bug which has been acknowledged by the developers and is being fixed here:
https://github.com/hashicorp/vscode-terraform/issues/900#issuecomment-1011088885
If you still have this issue, Please try the solution which worked for me-
I had got the same problem in VS code when I installed the Terraform (Anton Kulikov) extension and the version was v0.2.2. I tried many things to make my autocomplete work ,but later when I found out the solution that if you degrade your version to v0.2.1 it works.
Hope this solution also works for you- Cheers
I worked out a workaround for this bug myself after experiencing it too. You might notice that aws_ and name are highlighted. If you hit Escape on your keyboard, it'll cancel the selection and then autosuggestions will begin working again. Not sure of the cause, but figured out this "fix" by accident.

Can't Find certain extensions in CODE-OSS(Open source variant of Visual Studio Code)

I have been using Code-OSS in manjaro linux for some months now and this is the first time I am encountering this. (After I reinstalled manjaro) When I search for e.g, Java Extension Pack or Intellisense I don't get any result in the extension marketplace. I don't know if it's the problem of my setup or everyone is experiencing this. If you know of a solution please tell me.
Thanks in advance
This can be fixed by adding following to product.json:
"extensionsGallery": {
"serviceUrl": "https://marketplace.visualstudio.com/_apis/public/gallery",
"cacheUrl": "https://vscode.blob.core.windows.net/gallery/index",
"itemUrl": "https://marketplace.visualstudio.com/items"
}
This can also be fixed by copying product.json from an official build (in the .zip archvie, product.json is under /usr/share/code/resources/app/product.json which contains above lines). Depending on your distribution, exact location may vary.
More information: https://github.com/Microsoft/vscode/issues/1557
As an alternative to manually editing product.json or building whole visual-studio-code-bin from AUR you can use different AUR package - code-marketplace - that patches product.json from Code OSS package (code)
Thank you #Clay for responding. I saw that post prior to me posting this question. Those bits of json code were already in my product.json file but still I was not able to get the extensions. Then I built the VISUAL STUDIO CODE (visual-studio-code-bin) from AUR and now its working normally as expected. I don't know what's the reason behind this,but that's how I fixed it.
Also if someone is reading this and wanna know about the different variants of VSCode then here is the archWiki page for VSCode.
For anyone using the lscr.io/linuxserver/code-server docker container like me, the .json is located at /app/code-server/lib/vscode/product.json.
I've encountered this using OSS Code on Manjaro as well, trying to install the Azure Resource Manager Tools extension. Not sure if this was an option when this question was posted, but you can download the extension (.vsix) file if possible, then bring up 'quick open' in OSS Code using Ctrl+Shift+P, search for "VSIX" and choose "Extensions: install from VSIX" to locate and install the downloaded .vsix file.
After this, the extension was installed and usable in OSS Code, and is also configurable in the extension manager panel.

Extension warning in VS code

I get this warning when opening a fresh-new NativeScript (Angular) in VS code.
The below 1 extension(s) in workspace recommendations have issues: telerik.nativescript (not found in marketplace)
Should I ignore the warning or delete telerik.nativescript in the extension.json while I develop the app?
I have also been getting this notification wondering what it was after creating a new NativeScript Angular project. It seems like NativeScript is trying to recommend their NativeScript extension in VSCode https://nativescript.org/nativescript-for-visual-studio-code/.
I don't have this recommendation or extensions.json file on my older projects so I'm sure you can delete the file/recommendations and decide for yourself if you want to install their extension without affecting your project.
{
"recommendations": []
}
I think that this extension was probably renamed from "telerik.nativescript" to "NativeScript.nativescript" because in my case:
I was having the same problem described above "not found in marketplace"
I had an (old) nativescript extension already installed on my system (probably installed a year ago)
The VSCODE was kind of confused... checking the installed extensions was pointing me to the new one, but at the same time was telling me that it was not installed!?
Solution:
VSCODE: Extensions: NativeScript => [Unistall] followed by a [Install]
Source Code: "recommendations" changed "telerik.nativescript" to "NativeScript.nativescript"
Now everything seems to be in order.
Just to add some more detail, the file that needs to be changed in your NativeScript projects is ".vscode\extensions.json"
The code needs to be changed from:
{
"recommendations": [
"telerik.nativescript"
]
}
To:
{
"recommendations": [
"NativeScript.nativescript"
]
}
#antseq is correct that the extension was renamed from "telerik.nativescript" to "NativeScript.nativescript".

SchedulerLike is not an exported member

So I was going to work on an Ionic app that I was working on last year and I didn't change anything in framework or anything. So I launch the command "ionic serve" and my app crashes saying a lot of imports don't work like in the picture:
I've tried installing rxjs-compat (even though I haven't updated rxjs) and still doesn't work.
I just did "npm i" just in case something was missing and then launched my app.
Does anyone know what could be the reason that is making everything crash?
Looks like you got unexpected updates.
Please check root directory of your project, if npm i didn't work it means you don't have package-lock.json. If you have it - try to delete node_modules and execute npm install again.
Also check whether yarn.lock is there, then you need to use yarn to install proper packages.
Without yarn.lock and package-lock.json you can only guess suitable versions.
If you remember a date when it worked - try to check which versions were actual then on http://npmjs.com/ and specify them explicitly in the packages.json without ^ or ~ prefix.

Getting "Error: Failed to connect to OmniSharp"

I'm trying to get VSCode working with my Unity projects, and every time I select the Project icon (the little fire at the bottom) I get the following error:
Error: Failed to connect to OmniSharp
Is anyone else getting this?
You need to download the most recent version of "mono". Open up terminal and pass in brew install mono. Then "Pick a project" and select the ..-csharp.sln file and you should be up and running.
Ok, made some progress and gotten a few Unity projects working. It seems that you need some prerequisites installed, a clean up of your Unity project folder, and possibly some hand editing of your .sln and .csproj files.
I posted a (possibly) better answer over on Reddit. Hope that's not breaking stack etiquitte.
http://www.reddit.com/r/Unity3D/comments/34d6gc/visual_studio_for_mac_help_us_vote_for_unity/
i get this on windows when my project directory has a space in it
i removed the space and removed the error
i expect it will be fixed soom
I have a completely different answer: it's the runtime that VSCode is using. It doesn't match up with what it thinks it needs. I have to remember that we're still in beta and that things are changing rapidly. I had my dnvm running beta 7, but VSCode (and OmniSharp, by extension) is looking for beta 6, so it was failing. I updated my runtime using this this post as a clue. Now I have VSCode 0.7.0 using the beta 6 runtime. I have no idea how to tell what it's looking for...I just guessed based on when they were both released. HTH