Rust Syntax Highlighting
-
@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
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.
-
@PeterJones
Thanks, I fixed that copy/paste error on my part.
The issue I now have is that for Rust files (file extension rs) coloring is as expected.
However, that same theme is applied to ALL other languages, I thought that the theme should be specific to a particular language, not a “global” language.
Any thoughts?
Murray -
However, that same theme is applied to ALL other languages, I thought that the theme should be specific to a particular language, not a “global” language.
Any thoughts?
MurrayThe “theme” is for Notepad++ as a whole. Inside any theme, there are settings for each language and each of the styles within that language, and if you don’t like the colors for a given language, you can customize them – but it’s still saved as part of your active theme.
The purpose of a pre-built theme is to give you a starting point that’s reasonably-consistent among all the languages within a given theme, so that you just have to choose the theme once, and then all languages will use similar colors.
-
Moderator Note: this was taking over the LSP discussion, which would make it harder for people in the future to use the LSP Topic for LSP-focused discussion. I moved this portion of the discussion to a separate Topic, so that it can stay focused on syntax highlighting.
The first two posts needed to be merged into one, because somehow the original fork swapped the order of the two posts, which made this topic confusing.