deno: LSP enablePaths option not working in non-VSCode editor

I’m trying to add support for the enablePaths option to my Deno extension for Nova.

But it doesn’t seem to matter how I pass the paths to the LSP upon initialisation — src, ./src, /Users/me/project/src, file://Users/me/project/src — the LSP keeps working on files outside of these paths.

Here’s a gist with the initialisation RPC call. As far as I can tell, this should work. Could some other option be messing with it?

Could this be something to do with Nova? I can see that its built-in LSP client is sending RPC calls like this for files outside of the enabled paths:

{
  "jsonrpc" : "2.0",
  "id" : 10,
  "method" : "textDocument\/hover",
  "params" : {
    "textDocument" : {
      "uri" : "file:\/\/\/Users\/gwil\/Projects\/nova-deno\/build.ts"
    },
    "position" : {
      "line" : 7,
      "character" : 12
    }
  }
}

And even though this file is outside the enabledPaths, the Deno LSP server will send back a result:

{
  "id" : 11,
  "jsonrpc" : "2.0",
  "result" : {
    "range" : {
      "start" : {
        "line" : 8,
        "character" : 16
      },
      "end" : {
        "line" : 8,
        "character" : 20
      }
    },
    "contents" : [
      {
        "value" : "const code: string",
        "language" : "typescript"
      },
      "The bundles code as a single JavaScript module."
    ]
  }
}

Should it do that? Should it send back nothing?

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 16 (12 by maintainers)

Commits related to this issue

Most upvoted comments

I can confirm this works in helix now.

Interestingly, after the introduction of 1.36 and https://github.com/denoland/deno/pull/19791 I can get this behaviour using the exclude option in deno.json.

But this is exclusive, rather than the inclusive enablePaths option. But on the other hand, this can be more easily checked into a repo. Still, I would like to be able to support enablePaths in my extension, maybe exclude working provides a clue?

It might not be an issue. I’m unsure and still looking into this.