sublimelsp / LSP-typescript

TypeScript, JavaScript support for Sublime LSP plugin
MIT License
136 stars 11 forks source link

Goto definition: error: Unable to open URI #78

Closed unlight closed 3 years ago

unlight commented 3 years ago

Subject. It is started few days ago. Looks like it is related to "typescript-language-server": "0.6.0" or latest lsp typescript 1.3.0

I tried to rollback to previous 0.5.1, but it updates automatically without asking.

Also I noticed weird suggestion (when doing lsp goto definition), it should be: {file}:{Line} image

Env: ST 4112 LSP typescript: 1.3.0 Windows 10 Node 14.17.5

rwols commented 3 years ago

Is the URI not a file: URI?

unlight commented 3 years ago

@rwols No, it starts from letter C:/... image

rwols commented 3 years ago

Can you show what the payload of the response to textDocument/definition is?

To see server payloads, put "log_server": ["panel"] in Packages/User/LSP.sublime-settings, then open the log panel by running LSP: Toggle Log Panel. Then re-do your steps to trigger the request.

rwols commented 3 years ago

If the server returns literal filepaths, then I think what happens is that we accidentally use C: as the URI scheme.

unlight commented 3 years ago
:: --> LSP-typescript textDocument/definition(35): {'textDocument': {'uri': 'file:///C:/Dev/project/xxx/workers/cancel_shipment.js'}, 'workDoneToken': 'wd35', 'position': {'line': 27, 'character': 20}}
:: <<< LSP-typescript 35: [{'uri': 'C:/Dev/project/xxx/lib/accounting/index.js', 'range': {'end': {'line': 4, 'character': 15}, 'start': {'line': 4, 'character': 8}}}, {'uri': 'C:/Dev/project/xxx/lib/accounting/combine.js', 'range': {'end': {'line': 146, 'character': 16}, 'start': {'line': 146, 'character': 9}}}]
rwols commented 3 years ago

Thanks. That doesn’t look like an URI to me in the server response. So it’s a server issue.

rwols commented 3 years ago

Open an issue here https://github.com/typescript-language-server/typescript-language-server/issues

rchl commented 3 years ago

Fixing in https://github.com/typescript-language-server/typescript-language-server/pull/249

rchl commented 3 years ago

Version v1.3.1 with the fix is now on package control.