New (incomplete) LSP client plugin
-
@PeterJones said in New (incomplete and x64 only) LSP client plugin:
I am hoping that @Michael-Vincent , who knows Perl, and has tried your plugin earlier in this conversation with other languages,
I should note: Notepad++ 8.6.5 64-bit with NppLspClient v.0.0.26-alpha
Trying with Perl setup as @PeterJones , I get the same results - it seems like it’s not working.
With this Python setup:
[lspservers.python] mode = "io" executable = 'c:\Users\VinsWorldcom\AppData\Roaming\Python\Scripts\pylsp.exe' args = '--check-parent-process --log-file c:\Users\VinsWorldcom\tmp\pylsp.log -vvv' auto_start_server = false
and this simple Python script:
#!python import os import sys def myadd(n1, n2): return n1 + n2 t = myadd(1, 2)
Putting my caret between the
y
anda
of themyadd()
call on the last line and selecting Plugins => NppLspClient => Goto definition, it moves my caret to just before them
in thedef myadd( ...
line - as expected. Log shows:2024-04-03 10:44:09.702659 [INFO][ThreadId(4)] - <<< {"id":75,"jsonrpc":"2.0","method":"textDocument/definition","params":{"position":{"character":6,"line":8},"textDocument":{"uri":"file:///C:/Users/VinsWorldcom/tmp/crapps/test.py"}}} 2024-04-03 10:44:09.705734 [INFO][ThreadId(3)] - >>> {"jsonrpc":"2.0","id":75,"result":[{"uri":"file:\/\/\/c:\/Users\/VinsWorldcom\/tmp\/crapps\/test.py","range":{"start":{"line":5,"character":4},"end":{"line":5,"character":9}}}]}
Cheers.
-
@PeterJones said in New (incomplete and x64 only) LSP client plugin:
{“jsonrpc”:“2.0”,“id”:2,“result”:null}
That’s a valid response from the server if it can’t specify the location … but … why can’t it!
What version of Perl are you using?
Maybe it’s related to the unhandled “workspace/workspaceFolders” request that the NppLspClient plugin seems to ignore … again … why? … dooh - typo …
I must have been hungry to wait for a “workspace/wokspaceFolders” request …… or maybe the Diagnostics window
No, this is reserved for exclusively handle diagnostics.
Perhaps a temporary (3-5 sec) pop-up window that overlays the status bar area and states that this is not supported by the server. -
@Ekopalypse said in New (incomplete and x64 only) LSP client plugin:
That’s a valid response from the server if it can’t specify the location … but … why can’t it!
What version of Perl are you using?Strawberry Perl v5.38.0 – and it’s in my path, so PerlNavigator should be able to find it without options being passed from the client to the server.
Maybe it’s related to the unhandled “workspace/workspaceFolders” request that the NppLspClient plugin seems to ignore … again … why? … dooh - typo …
I must have been hungry to wait for a “workspace/wokspaceFolders” request …:-)
No, this is reserved for exclusively handle diagnostics.
Ah, that’s fine.
Perhaps a temporary (3-5 sec) pop-up window that overlays the status bar area and states that this is not supported by the server.
I think Console is fine, and probably less work for you than a popup.
-
Looks like it is caused by the unhandled request.
and now the server responded, for the goto definition request, with
{ "id": 33, "jsonrpc": "2.0", "result": [ { "range": { "end": { "character": 500, "line": 9 }, "start": { "character": 0, "line": 9 } }, "uri": "file:///D:/scripts/perl/tests/main.pl" } ] }
But the end character 500 is not correct.
The formatting does not seem to work either.
Renaming is not supported by the server.I will prepare another alpha version tomorrow and make it available.
-
@Ekopalypse said in New (incomplete and x64 only) LSP client plugin:
I will prepare another alpha version tomorrow and make it available.
Great! Looking forward to it.
-
I’ve opened an issue that I wanted to wait for before releasing a new version.
-
Hi Ekopalypse:
I’m in the midst of learning Rust, amongst a few other new languages.
I installed your latest version of NppLspClient.
Following your instructions, I tried to install a Language Server for Rust, they mentioned that the OLD version of RLS is no longer supported (deprecated I think) and recommended using rust-analyzer.
Here is the link: https://github.com/rust-lang/rls
I have rust-analyzer installed in Visual Studio Code w022 but was unsure how to install it for Notepad++.Any comments or advice would be appreciated.
Thanks
Murray -
Either download a pre-built binary or clone their repo and build it yourself, which is what I do to stay up to date.
My config for rust looks like this
[lspservers.rust] mode = "io" executable = 'D:\Repositories\rust\rust-analyzer\target\release\rust-analyzer.exe' auto_start_server = true # initialization_options = '{"completion":{"limit": 1000}}'
Since rust-analyzer can be quite chatty, you might want to comment out the
initialization_options
if you are having performance issues. My old i5 2nd edition processor seems to get along fine most of the time even with the commented line.For questions, suggestions etc… a discussion via github is also possible.
-
@Ekopalypse I downloaded this file: https://github.com/rust-lang/rust-analyzer/releases/download/2024-11-25/rust-analyzer-i686-pc-windows-msvc.zip and unzipped it.
You mention a “config for Rust”, how/ where do I place this??
BTW: my environment is Windows 11 64-bitProfessional edition. -
Is there a reason why you are using the 32bit version of rust analyzer?
Does that fit your rust toolchain?
For a 64 bit Windows I would have used this one I guess.You mention a “config for Rust”, how/ where do I place this??
Plugin->NppLspClient->Open Configuration File
-
@Ekopalypse
Thanks, I replaced rust-analyzer with the 64-bit version.
When I try to edit/modify a Rust program, i.e. main.rs I do not get the coloring of keywords or suggested completions.
Is there something else that i am missing in my setup??
Here’s my Notepad++ debug info:
Notepad++ v8.7.4 (64-bit)
Build time : Dec 4 2024 - 23:50:05
Path : C:\Program Files\Notepad++\notepad++.exe
Command Line :
Admin mode : OFF
Local Conf mode : OFF
Cloud Config : OFF
Periodic Backup : ON
Placeholders : OFF
DirectWrite : OFF
Multi-instance Mode : monoInst
File Status Auto-Detection : cdEnabledNew (for current file/tab only)
Dark Mode : OFF
OS Name : Windows 11 Pro (64-bit)
OS Version : 24H2
OS Build : 26100.2454
Current ANSI codepage : 1252
Plugins :
mimeTools (3.1)
NppConverter (4.6)
NppExport (0.4)
NppLspClient (0.0.31)
rustnpp (1.0.2) -
This sounds like Rust is not part of your Notepad++ setup because keyword coloring is done by Npp/Scintilla and is not part of the language server protocol and if that is the case, then the NppLspClient plugin will not work with Rust files.
So what does the NppLspClient plugin do?
When loading the plugin, it checks if the configuration file is available and if not, it creates the minimal version where no servers are available. Currently, users have to manually configure the servers they want to use.
When activating a buffer, the plugin checks whether the language of the current buffer is configured in the configuration file. If it finds a corresponding section, it checks whether the FolderAsWorkspace (FAW) dialog has entries, and if it finds something, it remembers its root node. If the server is to be started automatically, it checks whether the current file belongs to one of the root nodes of the FAW dialog. If this is the case, this root node path is used to initialize the configured server; if this is not the case, the current directory is used instead. An attempt is then made to start the process. That’s it, and the success or failure can be displayed in the console dialog.
If this does not solve your problem, you are welcome to open a request in the NppLspClient github repo and attach the log entries together with your configuration for further investigation.
-
May I ask that one of the moderators change the title of this post to
New (incomplete) LSP client plugin
Since version v.0.0.30 a 32bit plugin is also available.
Thank you very much.
-
Thank you for renaming the title.