denoland / vscode_deno

Visual Studio Code plugin for Deno
https://marketplace.visualstudio.com/items?itemName=denoland.vscode-deno
MIT License
1.47k stars 143 forks source link

deno.unstable not working #942

Closed mgenereu closed 1 year ago

mgenereu commented 1 year ago

Describe the bug

deno.unstable appears to not be working. Testing out Deno KV but other unstable APIs appear to also be producing an error.

To Reproduce

  1. Enable deno.unstable in the VS Code Deno Extension
  2. Create a new TypeScript file and add Deno.openKv();
  3. Save the file.
  4. Observe the error Property 'openKv' does not exist on type 'typeof Deno'.
  5. Note the error is deno-ts(2551).

Expected behavior

deno.unstable enabled in the extension should not produce error messages for unstable APIs.

Versions

deno 1.37.0 (release, x86_64-unknown-linux-gnu) v8 11.8.172.3 typescript 5.2.2 vscode 1.82.2 denoland.vscode-deno v3.24.0

mgenereu commented 1 year ago

Update: with internalDebug enabled, I see the tsconfig get reloaded without needing restart. Ignore this comment.

I noticed that https://github.com/denoland/vscode_deno/blob/7851045bd5d400995e501ac61761b0329a026b7c/client/src/extension.ts#L180-L188 doesn't restart the LSP when deno.unstable is toggled so I manually restarted the server with unstable enabled. Issue still present.

mgenereu commented 1 year ago

Okay. I got a hold of a Windows machine with VS Code and installed the latest Deno and latest extension. The issue doesn't manifest. This may be a GitPod or Linux specific issue.

mgenereu commented 1 year ago

The LSP with deno.internalDebug set to true on GitPod is showing the follow entry in the Deno Language Server output. With deno.unstable in the compilerOptions.lib, it means that the LSP is responding to the workspace configuration unstable option set to true.

{
  "type": "mark",
  "name": "request",
  "count": 1,
  "args": {
    "id": 2,
    "method": "configure",
    "compilerOptions": {
      "allowJs": true,
      "esModuleInterop": true,
      "experimentalDecorators": true,
      "isolatedModules": true,
      "jsx": "react-jsx",
      "lib": ["deno.ns", "deno.window", "deno.unstable"],
      "module": "esnext",
      "moduleDetection": "force",
      "noEmit": true,
      "resolveJsonModule": true,
      "strict": true,
      "target": "esnext",
      "useDefineForClassFields": true,
      "useUnknownInCatchVariables": false,
      "jsxImportSource": "preact",
      "emitDecoratorMetadata": true
    }
  }
}

https://github.com/denoland/deno/blob/50a3209fff38d1decd1642d1175aec78b897d08b/cli/lsp/language_server.rs#L1199-L1204

mgenereu commented 1 year ago

Found Deno LSP issues that were opened but then dismissed without noticing the operating system discrepancy. Opened an issue for this denoland/deno#20698.

mgenereu commented 1 year ago

Clearly an LSP issue introduced in Deno 1.32.2. Closing.