-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot find name 'Deno' #466
Comments
I can confirm. Deno runs, is accessible globally (PATH containing |
@jerrygreen and @martin-braun what is the output of the "Deno Language Server" in vscode. ( |
@kitsonk here: P.S. I installed Deno using |
I installed deno using |
Ok, something is strange going on with these situations, which isn't typical, which seems that they are specific to the environment and not something we have accounted for. @jerrygreen you are getting duplicate diagnostics as well, from both the built in language server. In the example before, it was just a single folder workspace? Have you adjusted any of the I am think of a few things I would like to know, but they aren't easily exposed to try to narrow down what is going on. One thing that would help is when you are in a situation similar to the above, where when you hover over the
@martin-braun could you be more specific about what you are encountering? Like are you getting incorrect diagnostics, no diagnostics, etc.? Also what are you |
@kitsonk My Today I disabled his and enabled the official extension again to fulfill your request regarding the output of the "Deno Language Server" and now everything works. Could this be related? Or maybe this is related instead: Some time after installing the extension I learned that I have to If so, I think it might be worth to find a way to automate this in the background, because it wasn't clear enough and was causing confusion to me. @jerrygreen maybe you can try to |
|
Here:
Single workspace folder, - yes. Just
That is harder to answer. Not sure if any of this helps but a story to the context: I installed Deno probably a year ago on my current PC, ofc it was outdated since then, so I decided to install it again with: curl -fsSL https://deno.land/x/install/install.sh | sh Using this GNU bash, version 4.4.23(1)-release (x86_64-pc-msys) Which, I believe, is automatically installed altogether with So rm -rf $HOME/.deno And then installed it with scoop, a recommended way for Windows (recommended by deno.land): scoop install deno But soon after I figured that nothing has changed: I faced the same problem again: Honestly I doubt it's all useful info, since @martin-braun is using macos, but is facing the same issue. But that's pretty much all the context, I think. Btw... Does this extension only works for Linux? Also, a side note: when I am using this |
Nope. It appears @martin-braun was something totally different. He wasn't getting any diagnostics at all, and adjusting a few things appears to have resolved it. @dsherret anything specifically you can think of that might be causing problems from a Windows perspective with the above?
Yes, that is because the built in language server for TypeScript isn't being "muted" for some reason. I think that in part is part of the problem. Versions prior to v3 of the extension (and the deprecated ones) modified the built in language server. As of v3, the Deno CLI is the language server and so we "mute" the diagnostics coming from the built in TypeScript language server when Ok, one more bit of troubleshooting if you don't mind. Ctrl+Shit+P and then Thanks for bearing with this. |
sorry I meant deno info yourFile.js. Was a bit late when I posted that comment. |
There's a big file, more than 1mb of data, even though it's just a few seconds of Just on a glance, I'm suspecting something isn't right with this line:
I'm not sure what's GraphWorker, but:
That's just a quick assumption, ofc... Maybe that's intended. You know better, maybe you'll find more useful intel there :) P.S. actual project path is
|
The extension has worked fine for me on Windows, but the one thing I've noticed is that only when I debug the extension (not when I launch it normally), is occasionally I will have the same issue as above, but it is fixed by closing the Hopefully the logs show something going on. |
@dsherret no, I wasn't in debug mode. I've tried creating other files and switching between them, closing one, then re-opening, but none of that helped. Maybe kitsonk will be able to find something in the logs
No, I tried this |
@jerrygreen You got a bunch of green checks and no errors? Hmm, yes the issue is solved for me, I think we do not share the same issue. |
|
Understood. kitson at deno dot com if you want.
It doesn't have anything to do with Deno or what Deno does. I think it is part of the TypeScript language service itself. I agree it is odd, but if you are curious, we are looking for the lines that contain |
Thanks @jerrygreen for the information. Looking at the logs. I am starting to wonder if it is a path normalization that is going on that we aren't expecting or varies on windows, and so when we "lookup" a path, in the plugin, we don't find it, so by default we enable it, but this path normalization difference doesn't always seem to occur on windows. I am trying to boot up my ole Windows VM to investigate further. @jerrygreen could you provide specifics about your Windows version and whether you are using WSL or WSL2? |
@kitsonk I use Windows 10, and what I already mentioned earlier:
I.e. I'm currently using no WSL, no WSL 2, no hyper-v, no vagrant, no other virtual systems. For console/terminal I use no even PowerShell or cmd, just pure Some other programming languages are working fine with this environment, too. For example, Haxe and its related Haxe VSCode extension, which also has its own language server, and works perfectly fine, too (linter, autocomplete, etc, - all with no WSL, like the Language servers are a hard craft though, it seems not all the language servers work perfectly fine on Windows... For example, I once tried to use AssemblyScript with their related VSCode extension, and they seem to have some purely linux dependencies for it, i.e. require WSL: Shopify/vscode-as#20 I didn't see anywhere that Deno extension requires WSL because of some linux dependencies or that only WSL is supported mentioned anywhere, but I hope there won't be such a need: deno executable works perfectly fine without virtualization systems, so I kinda expect that Deno VSCode extension also has no dependencies on linux or WSL. P.S. Sorry for this long-read, I'm just little sensible when it comes to WSL and virtualization: I wouldn't like the idea of having an entire system within a system within a system (imagine we add docker to this). For servers, it might help to make inescapable, safe sandbox environments, - but that's another story. As for desktop PCs... One system should be enough. |
It doesn't, I am just trying to figure out what is different about your environment. Actually, I have been using powershell instead of |
I just found a solution for me. I had the Volar extension installed which somehow must have conflicted with the Deno language server. How didn't I think of disabling other extensions. Previously, I had to disable the built-in Typescript language server and manually restart the deno language server as a workaround. |
@janispritzkau good idea, but as you can see on this screenshot: only the Deno extension is enabled, - and I didn't forget to restart VSCode, also tried restarting Deno Language Server, but all again it emits the same errors: So in this particular issue, it's not a conflict between some extensions |
@jerrygreen I am narrowing your situation down, I believe it is denoland/deno#11498. I can see by the screenshot of the status page somehow some of the lib files were "in memory" which indicates they were open or somehow referenced in code somewhere. |
@kitsonk yes! After what you've said, I remembered VSCode has such an experimental feature: "typescript.tsserver.experimental.enableProjectDiagnostics": true It is one cool feature making your "Problems" tab to show errors/warnings all around the whole project, instead of just open files. But unfortunatelly It's currently hugely bugged, because sometimes it unexpectedly goes into sources of libraries, rather than just project code. I tried disabling this setting, and yes, - now Deno extension works: I guess since it's narrowed down, we can close this issue, in a hope that these two issues will get resolved sometime: |
I encountered this issue after adding a error: TS2584 [ERROR]: Cannot find name 'document'. Do you need to change your target library? Try changing the 'lib' compiler option to include 'dom'. My solution was to delete ts config file and restart VS code. example repo here: |
If you are using a custom "compilerOptions": {
"lib": [
"esnext",
"dom",
"deno.ns"
] |
Hi @kitsonk I am still experiencing this exact same issue on windows. It seems that I haven't enabled the Deno Language Server StatusWorkspace Settings{
"enable": true,
"disablePaths": [],
"enablePaths": [
"supabase/functions"
],
"cache": null,
"cacheOnSave": true,
"certificateStores": null,
"config": null,
"importMap": "./supabase/functions/import_map.json",
"codeLens": {
"implementations": false,
"references": false,
"referencesAllFunctions": false,
"test": false
},
"internalDebug": false,
"internalInspect": false,
"logFile": false,
"lint": true,
"documentPreloadLimit": 1000,
"suggest": {
"imports": {
"autoDiscover": true,
"hosts": {
"https://deno.land": true
}
}
},
"testing": {
"args": [
"--allow-all",
"--no-check"
]
},
"tlsCertificate": null,
"unsafelyIgnoreCertificateErrors": null,
"unstable": false,
"javascript": {
"inlayHints": {
"parameterNames": {
"enabled": "none",
"suppressWhenArgumentMatchesName": true
},
"parameterTypes": {
"enabled": false
},
"variableTypes": {
"enabled": false,
"suppressWhenTypeMatchesName": true
},
"propertyDeclarationTypes": {
"enabled": false
},
"functionLikeReturnTypes": {
"enabled": false
},
"enumMemberValues": {
"enabled": false
}
},
"preferences": {
"importModuleSpecifier": "shortest",
"jsxAttributeCompletionStyle": "auto",
"autoImportFileExcludePatterns": [],
"useAliasesForRenames": true,
"quoteStyle": "auto"
},
"suggest": {
"completeFunctionCalls": false,
"includeAutomaticOptionalChainCompletions": true,
"includeCompletionsForImportStatements": true,
"names": true,
"paths": true,
"autoImports": true,
"enabled": true,
"classMemberSnippets": {
"enabled": true
},
"objectLiteralMethodSnippets": {
"enabled": true
}
},
"updateImportsOnFileMove": {
"enabled": "prompt"
}
},
"typescript": {
"inlayHints": {
"parameterNames": {
"enabled": "none",
"suppressWhenArgumentMatchesName": true
},
"parameterTypes": {
"enabled": false
},
"variableTypes": {
"enabled": false,
"suppressWhenTypeMatchesName": true
},
"propertyDeclarationTypes": {
"enabled": false
},
"functionLikeReturnTypes": {
"enabled": false
},
"enumMemberValues": {
"enabled": false
}
},
"preferences": {
"importModuleSpecifier": "shortest",
"jsxAttributeCompletionStyle": "auto",
"autoImportFileExcludePatterns": [],
"useAliasesForRenames": true,
"quoteStyle": "auto"
},
"suggest": {
"completeFunctionCalls": false,
"includeAutomaticOptionalChainCompletions": true,
"includeCompletionsForImportStatements": true,
"names": true,
"paths": true,
"autoImports": true,
"enabled": true,
"classMemberSnippets": {
"enabled": true
},
"objectLiteralMethodSnippets": {
"enabled": true
}
},
"updateImportsOnFileMove": {
"enabled": "prompt"
}
}
} Workspace Details
Performance (last 3 000 entries)
Performance (total)
|
I did Ctrl+Shift+P -> Initialize Workspace Configuration, which created me
.vscode/settings.json
:And tried restarting Language Server, and restarted VSCode, but still... Nothing helps, the problem occurs:
vscode-deno: v3.7.0
deno 1.11.5 (release, x86_64-pc-windows-msvc)
v8 9.1.269.35
typescript 4.3.2
GNU bash, version 4.4.23(1)-release (x86_64-pc-msys)
P.S. I now temporarily use the deprecated
justjavac.vscode-deno
instead, - it seems to be working. Might get back todenoland.vscode-deno
as soon as this issue is resolved!The text was updated successfully, but these errors were encountered: