Seeking for help
-
Hi, I’m looking for some brave souls who want help to make a decent lsp client for npp.
By that I mean spending time to test an alpha release of that lsp client and report issues discovered.
I have not released any source yet which means I would send a compiled 64bit binary to the ones interested.There is no 32bit version available yet.
So, if interested, then send me a mail to my user account used here at google_com. :-)
-
Can you say a few words about what advantage this would have for N++ users? It might encourage more people to want to test this, if they new what it is (and especially how it could help them).
-
I think this is a continuation of the Microsoft LSP discussion started a couple years back and resurrected last fall. LSP seems to combine the features of autocomplete and code navigation (finding definitions and instances of functions and variables, even across mulitple files) – which would help bring the Notepad++ code-editing experience closer to the feature set of a true IDE like Visual Studio.
If this LSP solution worked better than the cobbled-together group of plugins, which don’t interact seemlessly, that would be great… and I’d love to see it and try it out. I’m just not sure I can commit to @Ekopalypse that I could be a full-fledged alpha-tester, because I’ve already spread my “project time” pretty thin with all the various NPP and other projects that I’ve got going simultaneously, let alone the ones I’ve thought about but haven’t actually started implementing yet.
-
Yes, in case it wasn’t obvious, it’s about the MS language server protocol.
Even though it is defined as “standard”, there are some implementation pitfalls and different servers behave differently.
For example, the Python language server may accept code with control characters like \r\n, while clangd reports an error.
I have installed some of them, but I am not an expert in all languages,
nor do I know if I am using them as one would like, hence the reason for asking for help.
But perhaps it does make more sense to publish the code and then respond to the problems that are reported. -
Will there be a 32-bit version? I still prefer 32-bit Notepad++.
-
@Vitalii-Dovgan said in Seeking for help:
Will there be a 32-bit version? I still prefer 32-bit Notepad++.
Likewise
-
Yes, looks like I found the culprit. :-)
-
For the brave and fearless ones, the first alpha versions are available at https://github.com/Ekopalypse/NppLspClient/releases.
-
@Ekopalypse said in Seeking for help:
available at https://github.com/Ekopalypse/NppLspClient/releases
There aren’t any releases here You can create a release to package software, along with release notes and links to binary files, for other people to use. Learn more about releases in our docs.
Did you not create a release yet? I was ready to download and compile, but then saw the V language requirement and not quite ready to jump into that this late in the day ;-)
Eager to try it out though.
Cheers.
-
Thank you for pointing this out, I hope I have fixed the problem now.
-
It doesn’t seem to be running my attempt at the Perl one (which might be because the Perl::LanguageServer server that I’m running was a pain to get to install correctly, so I just might not have it set up right, and I don’t have any LSP client for checking if that side of things is working), so I defined a dummy python entry
{ "lspservers": { "perl": { "pipe": "io", "executable": "C:\\USR\\LOCAL\\APPS\\BERRYBREW\\PERLS\\SYSTEM\\PERL\\BIN\\perl.exe", "args": ["-MPerl::LanguageServer", "-e", "Perl::LanguageServer::run"], "auto_start_server": false, }, "python": { "pipe": "io", "executable": "C:\\Windows\\System32\\cmd.exe", "args": ["/C", "start"], "auto_start_server": false } } }
but whether I try to just start a new cmd.exe window, or do
"args": ["/C", "echo", "hi"],
or"args": ["/K", "prompt"],
I can see no evidence that it’s running anything.The steps I take:
- Installed your plugin
- Plugins > nppLspClient > Open configuration file
- saved the above file
- tried either Plugins > nppLspClient > Apply Current Configuration or restarting Notepad++
- turn on the LSP output console
- open a dummy python file
- Start Server for Current Language
- Nothing shows up in the console, and no new windows are popped open
Thus, I cannot tell whether the plugin is just not trying to run my command, or what. (I was hoping for that I could just prove to myself that it was launching something.
For the perl command, if I run
perl -MPerl::LanguageServer -e Perl::LanguageServer::run
from a command line, it pauses waiting for input, and Task Manager shows that perl is running:
But if I try to Start Server for Current Language with a perl file active in Notepad++, it doesn’t seem to be trying to launch the server process. (But maybe it launches it, then it dies too quickly for me to see it in Task Manager)
The only time I see anything in the LSP output console with either perl or python is if I try to restart the current language’s server, when I see the console tells me:
initialized = false
Is there some dummy configuration that would show me the plugin is actually trying to launch the server, even if it doesn’t do anything else? Or, barring that, where can I get the pyls.exe for trying the plugin for real with python?
-
@PeterJones said in Seeking for help:
It doesn’t seem to be running my attempt at the Perl one
I did get the Perl one “running”
Text copy of output:
perl server is running on_init: 13232 Content-Length: 2347 {"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {"processId": 13232, "clientInfo":{"name": "NppLspClient", "version": "0.0.1"}, "rootUri": "file:///C%3A/Users/mvincent/tmp", "initializationOptions": {}, "capabilities": {"workspace": {"applyEdit": false, "workspaceEdit": {"documentChanges": false}, "didChangeConfiguration": {"dynamicRegistration": false}, "didChangeWatchedFiles": {"dynamicRegistration": false}, "symbol": {"dynamicRegistration": false, "symbolKind": {"valueSet": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]}}, "executeCommand": {"dynamicRegistration": false}, "configuration": false, "workspaceFolders": false}, "textDocument": {"publishDiagnostics": {"relatedInformation": false}, "synchronization": {"dynamicRegistration": false, "willSave": false, "willSaveWaitUntil": false, "didSave": true}, "completion": {"dynamicRegistration": false, "contextSupport": false, "completionItem": {"snippetSupport": false, "commitCharactersSupport": false, "documentationFormat": ["plaintext"], "deprecatedSupport": false}, "completionItemKind": {"valueSet": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]}}, "hover": {"dynamicRegistration": false, "contentFormat": ["plaintext"]}, "signatureHelp": {"dynamicRegistration": false, "signatureInformation": {"documentationFormat": ["plaintext"]}}, "definition": {"dynamicRegistration": false}, "references": {"dynamicRegistration": false}, "documentHighlight": {"dynamicRegistration": false}, "documentSymbol": {"dynamicRegistration": false, "symbolKind": {"valueSet": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]}}, "codeAction": {"dynamicRegistration": false}, "codeLens": {"dynamicRegistration": false}, "formatting": {"dynamicRegistration": false}, "rangeFormatting": {"dynamicRegistration": false}, "onTypeFormatting": {"dynamicRegistration": false}, "rename": {"dynamicRegistration": false}, "documentLink": {"dynamicRegistration": false}, "typeDefinition": {"dynamicRegistration": false}, "implementation": {"dynamicRegistration": false}, "colorProvider": {"dynamicRegistration": false}, "foldingRange": {"dynamicRegistration": false, "rangeLimit": 100, "lineFoldingOnly": true}}}, "trace": "off", "workspaceFolders": null}} on_message_received: tcp server start listen on port 7070
and my config:
"perl": { "pipe": "tcp", "port": 7070, "tcpretries" : 3, "executable": "C:\\Strawberry\\perl\\bin\\perl.exe", "args": ["-MPerl::LanguageServer", "-e", "Perl::LanguageServer::run", "--", "--port 7070"] }
It doesn’t seem to work though when I hover or try command completion. Upon further examination of the text negotiation string, you can see all the capabilities return “false” - so perhaps that’s the reason?
I did get the Python (one from the example using
pyls
) working, but wonky:and return to complete yields:
Which actually puts the text “value” as the example in the actual document and then you have to arrow key back to delete it and put the actual value (e.g., 1). Could certainly be what
pyls
is delivering - I’m used to using your PythonScript “IDE” script and that usingjedi
offers the methods without example parameter data.Off to a great start though! You are aware of @dail 's NppLSP (stalled) project , correct? Chance to collaborate?
Cheers.
-
@PeterJones
First thank you for testing.
You are right, there is not much info when something goes wrong. I will build a V.0.0.2 today as I’ve did a couple of fixes and make sure to have debug statements enabled to make it
easier to find out what is causing the issue. -
Many thanks to you as well.
I had, hopefully solved - crossing fingers, problems with the synchronisation of documents, which I have fixed with my changes that will be included in a V.0.0.2.
I know its NppLsp project, but unfortunately I have no C++ knowledge. :-(
As for the Perl, it looks like the language server uses tcp and that is not implemented yet, only stdin/stdout messaging. -
-
@PeterJones
For the python one I would recommend using a local python installation and then using pip to install it.
Likepip install 'python-lsp-server[all]'
Sources are available here. -
I’m afraid the only lsp server for Python that doesn’t use Jedi under the hood is, as far as I know, the new Pylance addon for VSCode.
But MS hasn’t made it public. Jedi is a bit slow. -
@Ekopalypse said in Seeking for help:
Many thanks to you as well.
I think a Npp language server client would be awesome - I just don’t have the chops to create it. Happy there are others that see the value and I appreciate you taking on the enormous task. Happy to help test / troubleshoot / contribute how I can.
Cheers.
-
Even when I set my config up like @Michael-Vincent’s for perl, I don’t see messages in the LSP output console. It may be that my IT department is blocking some aspects (I just got a notification that Notepad++ was being virus scanned when reloading it, which I normally never see). I think at this point, I will have to give up on LSP at work (which is unfortunate, because I do a lot more coding at work than at home); maybe I’ll run some experiments at home, where I know IT cannot be getting in my way. ;-)
-
I have now had a chance to use your plugin and as an alpha release I am mightily impressed.
I have tested using pylsp.exe and with all options installed.
Got a bit of a fright on my 3000 line plus python file I decided to test it on (perhaps I should have been so ambitious) but it even worked on this file if a little slowly at times, which may be the pylsp implementation as much as anything as I have all options enabled in pylsp so it is doing a lot, but I was able to work through the issue and the annotations and console helped.
A couple of things, which at present would be very much nice to have and are not essential would be:
-
Ability to configure the colours of the various styles of messages in the console, I still use a white background and the default colours are a bit washed out. Also would be good for the annotations as well.
-
Add hotspot links to the diagnostic info message in the console, i.e. line:3284 - Cyclomatic complexity too high: 15 (threshold 15), so that they could be clicked to take you to the line in the file being edited. I know these appear as annotations in the edited file but with a large file and the console shown it would be good to just click on the messages and be taken to that line in the file.
-
If the completion list is empty do not show it, not sure what the issue is but I was getting an empty completion dropdown on entering ‘.’ in some cases.
-
Not sure how well this is interacting with the Undo CTRL-Z functionality as that seemed to pop up completion lists (empty again) and trigger seemingly multiple call to the lsp, not sure how well scintilla notifies this so you might not be able to do much about it.
So far so good, and keep up the good work, I have also downloaded the source code and the V language has peeked my interest, not one I have had much exposure to yet amongst the seemingly hundreds I have used during a 35 year development career, but one I am going to have to become more familiar with even if only to possibly contribute to this project. Just need to get GCC installed and working first though.
-