Skip to content
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

lsp doesn't respect deno.unstable #21159

Closed
sigmaSd opened this issue Nov 10, 2023 · 10 comments
Closed

lsp doesn't respect deno.unstable #21159

sigmaSd opened this issue Nov 10, 2023 · 10 comments
Assignees
Labels
bug Something isn't working lsp related to the language server needs investigation requires further investigation before determining if it is an issue or not

Comments

@sigmaSd
Copy link
Contributor

sigmaSd commented Nov 10, 2023

This seems to be a recent regression, I don't get unstable types anymore

Deno.dlopen // type error here

settings.json

{
    "deno.enable": true,
    "deno.lint": true,
    "deno.unstable": true,
}

deno 1.38.0

@irbull
Copy link
Contributor

irbull commented Nov 11, 2023

I pulled down the latest VSCode Extension and self hosted from source (commit denoland/vscode_deno@5c13d5f) and it's not happening here. It's happening 3.26.0 too, so maybe it was fixed recently. I can't see a commit that explicitly calls this out though.

Screenshot 2023-11-10 at 6 33 23 PM

@irbull
Copy link
Contributor

irbull commented Nov 11, 2023

Sorry, I take that back. I can reproduce this with the latest from main as well. Seems that it happens as soon as you initialize the Deno Workspace. However, if you change the unstable setting to false and then change it back to true it works. Could be something in how the notification for the settings is propagated.

@bartlomieju
Copy link
Member

CC @nayeemrmn please take a look

@irbull
Copy link
Contributor

irbull commented Nov 11, 2023

Small update, this appears to only happen if the VSCode plugin is not yet activated, and the act of initializing the workspace activates the plugin. By the time last call to: extensionContext.client?.sendNotification("workspace/didChangeConfiguration",...); is made, the settings have the correct values, so it appears the VS Code Extension is setting and propagating things correctly. There may be an timing issue between the plugin and the LSP Server on startup or maybe an cached setting in the LSP that's not being cleared.

I'd be happy to look into this further as I'm curious about the LSP Protocol; although I don't want to step on anyones toes. I'd have to try and self host an LSP Server too.

@nayeemrmn
Copy link
Collaborator

@sigmaSd

  1. Are you on vscode?
  2. Do you have any files in your project which have /// <reference no-default-lib="true" />?

@nayeemrmn nayeemrmn added bug Something isn't working needs investigation requires further investigation before determining if it is an issue or not lsp related to the language server labels Nov 11, 2023
@nayeemrmn nayeemrmn self-assigned this Nov 11, 2023
@sigmaSd
Copy link
Contributor Author

sigmaSd commented Nov 11, 2023

I had this issue in helix but I tried with vscode just to confirm, the issue is this

Do you have any files in your project which have /// <reference no-default-lib="true" />?

Yes turns out that's the issue, its a bit surprising, since the file that have that is in a nested folder inside the project and I didn't even open it, but I guess its because of the lsp preload

@nayeemrmn
Copy link
Collaborator

@sigmaSd In that case you need to add /// <reference lib="deno.unstable" /> below that directive. We're working on better ways of partitioning type spaces in a project.

@irbull Is this also what's happening in your case? If not, please open a new issue thanks.

@dsherret
Copy link
Member

Note that #20420 might prevent no-default-lib from removing the types for the Deno global in the future

@sgwilym
Copy link
Contributor

sgwilym commented Dec 7, 2023

I'm having this problem even without the presence of no-default-lib in the Nova IDE. The unstable option is correctly set to true when the LSP is initialised.

@sgwilym
Copy link
Contributor

sgwilym commented Dec 7, 2023

It does start working once a workspace/didChangeConfiguration message with deno.unstable set is received though.

Maybe setting it only through initialisation options doesn't work? Maybe the absence of this option in future config messages turns it off?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lsp related to the language server needs investigation requires further investigation before determining if it is an issue or not
Projects
None yet
Development

No branches or pull requests

6 participants