Ekopalypse / NppLspClient

LSP client for Notepad++
MIT License
39 stars 3 forks source link

Error: "Cannot open file" #3

Closed pryrt closed 2 years ago

pryrt commented 2 years ago

Since I mentioned your plugin today, and had a few spare minutes, I finally got it working with my python2.7 installation (I couldn't install python-lsp-server as you had suggested in October, but I found that I could install python-language-server with pip2 and got pyls that way... and once I saw that the config file language had changed from JSON to TOML, I was able to get either the IO or the TCP pointed at the pyls.exe and working. 🎉

As I was trying some features, I was surprised to see when looking in my startup.py where I import some of my scripts to automatically run, on the ones that were correctly defined with a docstring at the beginning, hovering correctly worked... so it was correctly finding the right module in the search path, which highly impressed me!

But then I tried to NppLspClient > Goto Definition on the same one, and it popped up the error:

image

I tried on a standard library (like import os) and it correctly went to the definition (which told me the feature itself is functional). But apparently the ++ being translated to %2B%2B messed up whatever underlying open function is being used.

Looking at the log, the only mentions of %2B were here:

2022-04-29 10:22:51,976 UTC - DEBUG - pyls.config.config -   finish pyls_definitions --> [[{'range': {'start': {'line': 0, 'character': 0}, 'end': {'line': 0, 'character': 20}}, 'uri': 'file:///c:/Users/peter.jones/AppData/Roaming/Notepad%2B%2B/plugins/Config/PythonScript/scripts/nppOnSaveSyntaxCheck.py'}]] [hook]

2022-04-29 10:22:51,976 UTC - DEBUG - pyls_jsonrpc.endpoint - Got result from synchronous request handler: [{'range': {'start': {'line': 0, 'character': 0}, 'end': {'line': 0, 'character': 20}}, 'uri': 'file:///c:/Users/peter.jones/AppData/Roaming/Notepad%2B%2B/plugins/Config/PythonScript/scripts/nppOnSaveSyntaxCheck.py'}]
Ekopalypse commented 2 years ago

Thank you, yes, I can confirm and reproduce this problem. A path must be encoded as URI, which must be en- and decoded accordingly. The problem will be fixed with the next version.

Ekopalypse commented 2 years ago

Fixed with latest release