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

deno.enablePaths conflict with build in typescript language server. #668

Closed
nurmohammed840 opened this issue May 20, 2022 · 14 comments · Fixed by #745
Closed

deno.enablePaths conflict with build in typescript language server. #668

nurmohammed840 opened this issue May 20, 2022 · 14 comments · Fixed by #745
Assignees
Labels
bug Something isn't working windows Occurring only on the Windows operating system.

Comments

@nurmohammed840
Copy link

nurmohammed840 commented May 20, 2022

In other word, deno.enablePaths doesn't disable default typescript language server from running specified path.

So both deno and typescript language server running on the same project...

Versions

deno 1.22.0 (release, x86_64-pc-windows-msvc)
v8 10.0.139.17
typescript 4.6.2

Vscode version:

Version: 1.67.2 (user setup)
Electron: 17.4.1
Chromium: 98.0.4758.141
Node.js: 16.13.0
V8: 9.8.177.13-electron.0
OS: Windows_NT x64 10.0.22000
@nurmohammed840 nurmohammed840 changed the title deno.enablePaths doesn't work deno.enablePaths conflict with build in typescript language server. May 20, 2022
@ragrag
Copy link

ragrag commented Jun 6, 2022

@nurmohammed840 any updates or workarounds u have for this problem?

@kitsonk
Copy link
Contributor

kitsonk commented Jun 6, 2022

Can you provide the output of Deno: Language Server Status from the command pallet in vscode for the workspace you have that you are concerned about.

When you say:

So both deno and typescript language server running on the same project...

What do you mean specifically. The whole purpose of deno.enablePaths is to have the two co-exist together in the same workspace.

@ragrag
Copy link

ragrag commented Jun 6, 2022

Hello @kitsonk thank you for the follow up.
Currently I have this configuration that is working as expected on macOs 12.1 but not on Windows 10

Current directory structure:

  .vscode/settings.json
  scripts
  services

I want Deno Language Server to only work for the scripts directory and ignore the services directory (which has node ts projects).
the current configuration I have in settings.json is

{
    "deno.lint": true,
    "deno.unstable": true,
    "deno.enablePaths": ["./scripts"]
}

This current configuration works perfectly on macOs.

As for windows 10:

  • Files in scripts directory are still not detected by the Deno Language Server while files in services are picked up by the built-in Typescript Language Server. im assuming after many trials that deno.enablePaths effectively doesn't do anything in this case
  • After adding "deno.enable" : true (which according to the docs should be ignored if deno.enablePaths is provided) the files in scripts are picked up by the Deno Language Server and the files in services are ignored. however they are not picked by the Typescript Language Server either (no errors but also no Intellisense). when I remove deno.enablePaths at this point they start to show errors since the Deno Language Server is not ignoring them anymore.

I hope that was not confusing, I will also be willing to do some screen recordings if that is necessary
Also worth mentioning is that I have the latest versions of VS Code as well as the Deno extension

@WudsyWudsyWudsy
Copy link

WudsyWudsyWudsy commented Jun 14, 2022

I have a similar issue to @nurmohammed840 and @ragrag on Windows 11 (and 10).

The issue is that both deno and typescript language servers are running on the same file, not project, and specifically how "deno.enabled" is being handled when "deno.enablePaths" is supplied.

Set up

OS: Windows 11 (22000.675)
VS Code: 1.68.0 (user setup)
Deno: 1.22.1
Deno VS Code Extension: v3.12.0

Current settings.json:

{
    "deno.enable": true,
    "deno.lint": true,
    "deno.unstable": false,
    "deno.enablePaths": [
        "./deno"
    ]
}

Folder structure:

test_project/
├─ .vscode/
│  ├─ settings.json
├─ deno/
│  ├─ deno_main.ts
├─ typescript/
   ├─ typescript_main.ts

Expected behavior

My understanding is that this set up should yield the following result:

deno_main.ts:

  • deno language server enabled
  • typescript language server disabled

typescript_main.ts:

  • deno language server disabled
  • typescript language server enabled

Observed outcome

What I am actually getting is:

deno_main.ts:

  • deno language server enabled
  • typescript language server disabled

typescript_main.ts:

  • deno language server disabled
  • typescript language server disabled <--- Unexpected

In this case (where "deno.enable" is true) typescript language server is disabled on typescript_main.ts, despite me wanted it to be active.

If I change "deno.enable" to false I get the follow:

deno_main.ts:

  • deno language server enabled
  • typescript language server enabled <--- Unexpected

typescript_main.ts:

  • deno language server disabled
  • typescript language server enabled

In this case (where "deno.enable" is false) both deno and typescript language servers are active on deno_main.ts, which causes conflicts.

Issue

It appears to me that the following is happening (on Windows 10 and 11):

  1. "deno.enablePaths" is correctly controlling what files and folders the deno language server is active on, however;
  2. "deno.enable" is not being ignored
    • if it is true, the typescript language server is disabled on all files in the project, regardless of if they are in the enabledPaths or not
    • if it is false, the typescript language server is enabled on all files in the project, regardless of if they are in the enabledPaths or not

Desired outcome

Desired outcome would be as follows:

  • "deno.enable" is ignored when "deno.enablePaths" is supplied
  • files and folder which deno language server in enabled on is unchanged from current implementation (i.e., enabled on those in "deno.enablePaths")
  • files and folder which are included in "deno.enablePaths" should have typescript language server disabled
  • files and folder which are not included in "deno.enablePaths" should have typescript language server enabled

@alexndremelyanov
Copy link

alexndremelyanov commented Jun 18, 2022

I had a similar issue. My problem was solved by disabling typescript.tsserver.experimental.enableProjectDiagnostics

@WudsyWudsyWudsy
Copy link

I had a similar issue. My problem was solved by disabling typescript.tsserver.experimental.enableProjectDiagnostics

@alexndremelyanov can you please explain your issue? What was similar and what was not?

This setting was disabled by default for me, enabling it (or re-disabling it) didn't change any of my results from above.

@lts20050703
Copy link

lts20050703 commented Jun 26, 2022

Can confirm.
deno.enablePaths: ["./worker"]
EXPECTED
Inside "./worker": Typescript LSP ❌, Deno LSP ✅
Outside "./worker": Typescript LSP ✅, Deno LSP ❌
ACTUAL
deno.enable: false
Inside "./worker": Typescript LSP ✅, Deno LSP ✅
Outside "./worker": Typescript LSP ✅, Deno LSP ❌
deno.enable: true
Inside "./worker": Typescript LSP ❌, Deno LSP ✅
Outside "./worker": Typescript LSP ❌, Deno LSP ❌

Versions

visual studio code version 1.69.0-insiders
denoland.vscode-deno version 3.12.0
Windows 11
deno 1.23.1 (release, x86_64-pc-windows-msvc)

@jigz
Copy link

jigz commented Jul 1, 2022

having the same issue on my monorepo

@kitsonk kitsonk self-assigned this Jul 4, 2022
@WudsyWudsyWudsy
Copy link

WudsyWudsyWudsy commented Jul 5, 2022

I was having a play around to see if I could identify the issue.

I haven't been able to find any issue in it (because I don't know how to debug the ts part of the extension), but I did notice inconsistencies in typescript-deno-plugin.ts settings variable for enabledPaths, which is sometimes called enablePaths, for example, in the default settings (line 34), but is sometimes called enabledPaths (line 82). I tried to hack in a fix and it didn't change anything. But someone who actually knows what they are doing might want to look at this.

I also found the following in my Extension Host Log:

[2022-07-05 20:05:42.551] [exthost] [warning] [denoland.vscode-deno] Accessing a resource scoped configuration without providing a resource is not expected. To get the effective value for 'deno.enable', provide the URI of a resource or 'null' for any resource.
[2022-07-05 20:05:42.551] [exthost] [warning] [denoland.vscode-deno] Accessing a resource scoped configuration without providing a resource is not expected. To get the effective value for 'deno.enablePaths', provide the URI of a resource or 'null' for any resource.

Not sure if these could be related.

@jeiea
Copy link
Contributor

jeiea commented Oct 12, 2022

I felt LSP has poor support for windows..

@alexishecf
Copy link

alexishecf commented Oct 30, 2022

Any update on this? I have the problem in my monorepo as well: TypeScript language server runs for files provided in enablePaths but the Deno language server doesn't. It works as expected if I use enable and get rid of enablePaths.

deno 1.27.0 (release, x86_64-pc-windows-msvc)
v8 10.8.168.4
typescript 4.8.3

.vscode/settings.json

{
  "deno.unstable": true,
  "deno.enablePaths": ["./backend-deno"],
  "deno.importMap": "./backend-deno/import_map.json"
}

@drocha87
Copy link

I'm also having problem with deno.enablePaths

Here is the output of the deno extension

Starting Deno language server...
  version: 1.27.0 (release, x86_64-pc-windows-msvc)
  executable: C:\Users\diego\.local\bin\deno.exe
Connected to "Visual Studio Code" 1.72.2
Enabling import suggestions for: https://deno.land
Enabling import suggestions for: https://x.nest.land
Download https://x.nest.land/.well-known/deno-import-intellisense.json
Download https://intellisense.nest.land/deno-import-intellisense.json
Enabling import suggestions for: https://crux.land
Server ready.
successfully cancelled request with ID: 1
Unable to send result to client.
client asked to cancel request 2, but no such pending request exists, ignoring

My .vscode/settings.json

{
  "deno.lint": true,
  "deno.unstable": true,
  "deno.enablePaths": ["./supabase"]
}

And my Deno: language server status

{
  "enable": false,
  "enablePaths": [
    "./supabase"
  ],
  "cache": null,
  "certificateStores": null,
  "config": null,
  "importMap": null,
  "codeLens": {
    "implementations": false,
    "references": false,
    "referencesAllFunctions": false,
    "test": false
  },
  "inlayHints": {
    "parameterNames": {
      "enabled": "none",
      "suppressWhenArgumentMatchesName": true
    },
    "parameterTypes": {
      "enabled": false
    },
    "variableTypes": {
      "enabled": false,
      "suppressWhenArgumentMatchesName": true
    },
    "propertyDeclarationTypes": {
      "enabled": false
    },
    "functionLikeReturnTypes": {
      "enabled": false
    },
    "enumMemberValues": {
      "enabled": false
    }
  },
  "internalDebug": false,
  "lint": true,
  "suggest": {
    "completeFunctionCalls": false,
    "names": true,
    "paths": true,
    "autoImports": true,
    "imports": {
      "autoDiscover": true,
      "hosts": {
        "https://deno.land": true,
        "https://x.nest.land": true,
        "https://crux.land": true
      }
    }
  },
  "testing": {
    "args": [
      "--allow-all",
      "--no-check"
    ],
    "enable": true
  },
  "tlsCertificate": null,
  "unsafelyIgnoreCertificateErrors": null,
  "unstable": true
}

I'm working now with my project with wsl and it works perfectly, I would like just to add that in windows it's not working properly, so the workaround is to use wsl if it's even possible in your case.

@dsherret dsherret added bug Something isn't working windows Occurring only on the Windows operating system. and removed needs investigation labels Nov 11, 2022
dsherret pushed a commit that referenced this issue Nov 11, 2022
Path separators on Windows caused an incorrect behavior in `#fileNameDenoEnabled` that resulted in a non-functioning `deno.enablePaths` setting on Windows. This fixes #668.
nanikit added a commit to nanikit/kbsl_level_selector that referenced this issue Nov 19, 2022
@joshdoesthis
Copy link

The following workspace settings.json has worked for me. Adding an import map was what was needed to tie it all together.

{
  "deno.enable": true,
  "deno.enablePaths": ["./src"],
  "deno.importMap": "./deno.json",
  "deno.lint": true
}

@cobbvanth
Copy link

I had a similar issue. My problem was solved by disabling typescript.tsserver.experimental.enableProjectDiagnostics

This is the one that fixes Deno imports with 'module not found'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working windows Occurring only on the Windows operating system.
Projects
None yet
Development

Successfully merging a pull request may close this issue.