New (incomplete) LSP client plugin
-
@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.
-
@Ekopalypse
Hi, Happy New Year!!
I have been using your plugin with the Rust language.
In my environment I have not been able to get the coloring to work, it’s probably something I have done wrong,
I was curious to see if you have an updated version of this plugin available, the post title does say “incomplete”!!Thanks
Murray -
Hi Ekopalypse:
further to my last post I was following the instructions in this link: https://stackoverflow.com/questions/34435031/adding-rust-programming-language-syntax-to-notepad
I could find this:
So you first have to open stylers.model.xml in C:\Program Files\Notepad++, find the LexerType for rust and copy it the style file you are using in the theme folder, e.g. themes/Deep Black.xml.
but was unable to save it in the Themes folder.
Is this a valid approach to solve my “coloring” problem??
Thanks
Murray -
Coloring is handled by the lexer, not by LSP Client, so your question has nothing to do with the LSP client.
but was unable to save it in the Themes folder.
Which themes folder?
c:\Program Files\Notepad++\themes
, or%AppData%\Notepad++\themes\
Because to write to the first, you might need Admin privileges (though the same would be true even if you were just changing the colors in Style Configurator, so I am surprised you’ve never noticed that before).
However, for a normal installation using AppData, Notepad++ will first check for themes in
%AppData%\Notepad++\themes\
, and then only if it doesn’t find it there will it look in thec:\Program Files\Notepad++\themes
… so if you want to avoid having to get Admin privileges to customize your theme every time, you should:-
Copy
c:\Program Files\Notepad++\themes\Deep Black.xml
to%AppData%\Notepad++\themes\Deep Black.xml
-
Edit
%AppData%\Notepad++\themes\Deep Black.xml
-
Copy the
<LexerType name="rust"...> ... </LexerType>
section fromc:\Program Files\Notepad++\themes\DarkModeDefault.xml
and paste it into your openDeep Black.xml
, and save -
Exit Notepad++
-
Relaunch Notepad++, and make sure Deep Black theme is selected
-
Verify that Style Configurator shows Rust in the Deep Black theme
-
-
Happy new year to you too.
I can only agree with what @PeterJones has already posted.
post title does say “incomplete”
It is incomplete because it does not implement everything that the lsp protocol defines. I assume that what is implemented is what most people need. Autocompletion, signature help, diagnostics, references and the ability to jump to definitions, implementation and declaration and some others like renaming, formatting … but I don’t think these are really needed. In addition, the protocol offers some other features that, as I said, are not yet implemented and, to be honest, probably won’t be implemented until I need them, unless someone really needs something special and helps identify what needs to be done and then test it.
-
@PeterJones
Thanks for the tips!!
I did the following:- Copy c:\Program Files\Notepad++\themes\Deep Black.xml to %AppData%\Notepad++\themes\Deep Black.xml
- Edit %AppData%\Notepad++\themes\Deep Black.xml
- Copy the <LexerType name=“rust”…> … </LexerType> section from c:\Program Files\Notepad++\themes\DarkModeDefault.xml and paste it into your open Deep Black.xml, and save
I overwrote the contents of this file, not appending to it , was that correct? - Exit Notepad++
- Relaunch Notepad++, and make sure Deep Black theme is selected
I wasn’t sure what to do here, I went to Settings -> Style Configurator and selected language Rust.
When I changed Style to Deep Black I didn’t get a chance to save anything, Notepad++ just closed on me. - Verify that Style Configurator shows Rust in the Deep Black theme
I was unable to do that.
Did I miss a step??
-
@Murray-Sobol-1 said in New (incomplete) LSP client plugin:
I overwrote the contents of this file, not appending to it , was that correct?
No. You should have put the rust
<Language...>...</Language>
section next to one of the other<Language...>...</Language>
sections, without deleting anything else.chance to save anything, Notepad++ just closed on me.
Probably because the theme you selected was missing all the critical information that you deleted.