MOtherMetroid
MOtherMetroid•5mo ago

Deno.enable not working

https://docs.deno.com/runtime/manual/references/vscode_deno/#deno-enabling-a-workspace In another project, I manually created (in VSC) the root folder .vscode and the file settings.json with the content { "deno.enable": true } and it worked. In a new project (in the same workspace), I tried this again but it does not work in the editor: Cannot find module 'jsr:@std/dotenv' or its corresponding type declarations.ts(2307) When trying to run, it works fine. I'm using Deno 1.42.4 and VSCodium 1.88.1.24104
51 Replies
Deno AI Helper
Deno AI Helper•5mo ago
It seems like you're encountering an issue where the Deno extension in Visual Studio Code (VSCode) isn't recognizing a module, even though running the code with Deno CLI works fine. Here are a few steps you can take to troubleshoot this issue, based on the documentation: 1. Ensure Deno is Enabled for the Workspace: The documentation states that you need to enable Deno for the workspace to have support for Deno APIs and module resolution. You've already created a .vscode/settings.json with { "deno.enable": true }, which is correct. However, make sure this setting is applied to the correct workspace folder if you're using a multi-root workspace. 2. Initialize Workspace Configuration: The documentation suggests using the "Deno: Initialize Workspace Configuration" command from the VSCode command palette. This sets up the necessary configuration and asks if you want to enable linting and unstable APIs. 3. Check for Workspace Folder Settings: If you're working with a multi-root workspace, you might need to enable Deno for specific workspace folders. The deno.enablePaths setting allows you to specify which sub-paths should be Deno-enabled. 4. Restart VSCode: Sometimes, changes to the settings might not take effect until you restart your editor. Try closing and reopening VSCode to ensure the settings are reloaded. 5. Check for Conflicting Extensions: Ensure that there are no other extensions that might conflict with the Deno extension, especially those related to TypeScript or JavaScript language services. 6. Check Deno Language Server Status: You can use the "Deno: Language Server Status" command from the command palette to check what the Deno language server thinks is your current active configuration. 7. **Disable TypeScript Project
Deno AI Helper
Deno AI Helper•5mo ago
Diagnostics**: Make sure that the VSCode configuration enableProjectDiagnostics is disabled, as it can cause TypeScript language server to show errors that Deno should handle. If you've gone through these steps and the issue persists, it might be a bug with the Deno extension. In that case, consider searching for similar issues or reporting a new bug at the vscode_deno GitHub repository. Remember to check the exact path you're using for the module import. If there's a typo or incorrect path, that could also cause the module resolution to fail in the editor. 🦕
MOtherMetroid
MOtherMetroid•5mo ago
So I have to guess no one knows anything about this? Can't continue using Deno in this state
marvinh.
marvinh.•5mo ago
cc @nayeemrmn
lukeed
lukeed•5mo ago
i started getting this too. just upgraded from 1.42.1 to 1.42.4 and everything stopped working lint & format settings ignored. cant find jsr (or any) packages
bartlomieju
bartlomieju•5mo ago
@lukeed do you have the same problem if you update to latest Canary? (deno upgrade --canary)
lukeed
lukeed•5mo ago
before i upgrade, to be clear, the cli works correctly its just the vscode aspect
bartlomieju
bartlomieju•5mo ago
Yeah, vs code calls into CLI
lukeed
lukeed•5mo ago
k 2s still happens my quick test is that saving file is formatting in a way that doesnt follow my deno.json fmt options as soon as i do deno.enablePaths = ["./deno.json"] the fmt config is respected but everything else breaks i hope https://github.com/denoland/vscode_deno/issues/1099#issuecomment-2028790434 is not here to stay, this is a breaking/awful change
bartlomieju
bartlomieju•5mo ago
Alright, we'll look into that today
nayeemrmn
nayeemrmn•5mo ago
This means ONLY deno.json is enabled. What enable-related settings did you have before?
lukeed
lukeed•5mo ago
none. i allow/expect the entire project to be supported because of root deno.json existence but its ignored unless explicitly inserted into that array (following your comment)
nayeemrmn
nayeemrmn•5mo ago
Okay, that was meant for people already using enablePaths. This is unexpected looking into it Does it work with enable: true?
lukeed
lukeed•5mo ago
no well the file is completely ignored so any import map entries & any lint/fmt settings are ignored deno itself is still working, in that some linting/formatting is happening, but not as it should im back on 1.42.1 & everyhting works as exepected
nayeemrmn
nayeemrmn•5mo ago
Do errors have like ts(2307) like OP, or is it deno-ts(2307) at the end?