Microsoft Language Server Protocol (LSP): A possible revolution for Notepad++?
-
@Ekopalypse said in Microsoft Language Server Protocol (LSP): A possible revolution for Notepad++?:
preload them jedi.preload_module([‘os’,‘sys’, …])
Thanks for the tip! Python is obviously not my strength; hence, the want for some “IDE-lite” help from Notepad++.
Cheers.
-
:-D - the same would happen to me if I try to write perl :-D
-
@pidgeon777 said in Microsoft Language Server Protocol (LSP): A possible revolution for Notepad++?:
Microsoft Language Server Protocol (LSP) defines the protocol used between an editor or IDE and a language server that provides language features like autocomplete, go to definition, find all references etc.:
У меня есть немного для php, js, vbs, 1C, MySql.
https://github.com/trdm/jn-npp-scripts -
@Ekopalypse said in Microsoft Language Server Protocol (LSP): A possible revolution for Notepad++?:
ok, this is my “lsp” script (called python_ide.py)
I wonder if this pylspclient can be used? It’s supposedly an LSP client written in Python so theoretically PythonScript could run it.
I’ve been playing with it from the command line with my system Python3 and not having much luck with the
examples/python-language-server.py
script included and having the python-language-server installed.Cheers.
-
let me have a look and play with it a bit.
-
It looks like the main problem might be that this lspclient is written for Python2.
Let me see if I can make a working version. Probably in 6-7 hours. -
@Ekopalypse said in Microsoft Language Server Protocol (LSP): A possible revolution for Notepad++?:
lspclient is written for Python2
Weird - it seems to “run” OK - not throwing any errors, but just not initializing with the language server:
PS VinsWorldcom ~\source\personal\pylspclient\examples > python3 .\python-language-server.py 2020-12-02 10:19:26,251 UTC - WARNING - pyls.config.config - Failed to load pyls entry point 'autopep8': No module named 'pycodestyle' 2020-12-02 10:19:26,297 UTC - WARNING - pyls.config.config - Failed to load pyls entry point 'pycodestyle': No module named 'pycodestyle' 2020-12-02 10:19:26,301 UTC - WARNING - pyls.config.config - Failed to load pyls entry point 'pydocstyle': No module named 'pydocstyle' 2020-12-02 10:19:26,492 UTC - WARNING - pyls.config.config - Failed to load pyls entry point 'rope_completion': No module named 'rope' 2020-12-02 10:19:26,496 UTC - WARNING - pyls.config.config - Failed to load pyls entry point 'rope_rename': No module named 'rope' {'capabilities': {'codeActionProvider': True, 'codeLensProvider': {'resolveProvider': False}, 'completionProvider': {'resolveProvider': False, 'triggerCharacters': ['.']}, 'documentFormattingProvider': True, 'documentHighlightProvider': True, 'documentRangeFormattingProvider': True, 'documentSymbolProvider': True, 'definitionProvider': True, 'executeCommandProvider': {'commands': []}, 'hoverProvider': True, 'referencesProvider': True, 'renameProvider': True, 'foldingRangeProvider': True, 'signatureHelpProvider': {'triggerCharacters': ['(', ',', '=']}, 'textDocumentSync': {'change': 2, 'save': {'includeText': True}, 'openClose': True}, 'workspace': {'workspaceFolders': {'supported': True, 'changeNotifications': True}}, 'experimental': {}}} init = None
NOTE: I made 2 small changes to the the
examples/python-language-server.py
script:diff --git a/examples/python-language-server.py b/examples/python-language-server.py index 72026e5..0e67858 100644 --- a/examples/python-language-server.py +++ b/examples/python-language-server.py @@ -19,7 +19,7 @@ class ReadPipe(threading.Thread): line = self.pipe.readline().decode('utf-8') if __name__ == "__main__": - pyls_cmd = ["python", "-m", "pyls"] + pyls_cmd = ["python3", "-m", "pyls"] p = subprocess.Popen(pyls_cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) read_pipe = ReadPipe(p.stderr) read_pipe.start() @@ -143,7 +143,7 @@ if __name__ == "__main__": root_uri = 'file:///path/to/python/project' workspace_folders = [{'name': 'python-lsp', 'uri': root_uri}] print(lsp_client.initialize(p.pid, None, root_uri, None, capabilities, "off", workspace_folders)) - print(lsp_client.initialized()) + print("init = ", lsp_client.initialized()) lsp_client.shutdown() lsp_client.exit()
Cheers.
-
@Michael-Vincent - I tried to make it work but after three
Npp crashes I decided to make my implementation work with python3.
I’ll keep working on it an updates will be made available via the github repo. -
@Ekopalypse said in Microsoft Language Server Protocol (LSP): A possible revolution for Notepad++?:
I’ll keep working on it an updates will be made available via the github repo.
I’ll keep checking back then - thanks!
-
A plugin implementing an LSP client in Notepad++ has finally been released.
https://github.com/Ekopalypse/NppLspClient
Credits to @Ekopalypse for that.
I encourage everyone to give it a try and report back for any found issue.
-
-