-
Notifications
You must be signed in to change notification settings - Fork 144
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
Code generated by deno init
gives an error in VS Code
#1190
Comments
Looks like somehow the Deno extension isn't enabled in this project properly, despite the config being set. Errors from the Deno extension end with |
Please make sure Deno extension is not disabled in user settings (ie. not workspace settings). |
To me it looks as if the extension is active. I also have this: But adding "DOM" to compilerSettings/lib made the deno-ts error disappear. And removing the tsconfig.json file I had copied from another project to get the other problem solved also fixed the ts error for the |
This output is really strange - you indeed have Deno extension enabled, but in that case you should not have Does the situation change is you reload the VSCode window? |
No, I reloaded VS Code already multiple times. Is it correct that VS Code shows TypeScript 5.6.3 in the status bar for main.ts? Looks like the real issue is that the built-in TS language server is not disabled for some reasons. I also get errors for imported (npm) packages. |
@mike-lischke could you please go to the |
What might be happening - the "user settings" have Deno disabled globally, you can check that by opening Command Pallete in VSCode and going to |
This is the Deno LSP output:
and the LSP status might be useful: Deno Language Server StatusWorkspace Settings{
"enable": true,
"disablePaths": [],
"enablePaths": null,
"cache": null,
"cacheOnSave": true,
"certificateStores": null,
"config": null,
"importMap": null,
"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": [],
"javascript": {
"inlayHints": {
"parameterNames": {
"enabled": "none",
"suppressWhenArgumentMatchesName": true
},
"parameterTypes": {
"enabled": true
},
"variableTypes": {
"enabled": false,
"suppressWhenTypeMatchesName": true
},
"propertyDeclarationTypes": {
"enabled": false
},
"functionLikeReturnTypes": {
"enabled": true
},
"enumMemberValues": {
"enabled": true
}
},
"preferences": {
"importModuleSpecifier": "shortest",
"jsxAttributeCompletionStyle": "auto",
"autoImportFileExcludePatterns": [],
"useAliasesForRenames": true,
"quoteStyle": "double"
},
"suggest": {
"completeFunctionCalls": false,
"includeAutomaticOptionalChainCompletions": true,
"includeCompletionsForImportStatements": true,
"names": true,
"paths": true,
"autoImports": true,
"enabled": true,
"classMemberSnippets": {
"enabled": true
},
"objectLiteralMethodSnippets": {
"enabled": true
}
},
"updateImportsOnFileMove": {
"enabled": "always"
}
},
"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": "double"
},
"suggest": {
"completeFunctionCalls": false,
"includeAutomaticOptionalChainCompletions": true,
"includeCompletionsForImportStatements": true,
"names": true,
"paths": true,
"autoImports": true,
"enabled": true,
"classMemberSnippets": {
"enabled": true
},
"objectLiteralMethodSnippets": {
"enabled": true
}
},
"updateImportsOnFileMove": {
"enabled": "always"
}
}
} |
Oha, there was indeed a
|
Check your user settings for Please verify if that was the problem. |
That was it @nayeemrmn! Removing this key from the settings.json file made the TS diagnostics go away. |
Thanks for analyzing this problem with me. It's obviously a user-generated problem. Would be good if this setting could be checked by the extension and a warning be shown to inform the user about possible conflicts. Thanks! |
@mike-lischke No problem! I've already opened a PR for this: #1191. |
deno 2.0.2 (stable, release, aarch64-apple-darwin)
v8 12.9.202.13-rusty
typescript 5.6.2
The generated code is as expected:
however, this gives me the error:
All I did was to create a new folder, opened that in VS Code and ran
deno init
. Then I opened main.ts and got this. Not a good first impression, even thoughdeno main.ts
(ordeno run main.ts
for that matter) run fine.Further info: I have tsc 5.2.2 installed globally on my box and .vscode/settings.json just contains:
The text was updated successfully, but these errors were encountered: