Community
    • Login

    Rust Syntax Highlighting

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    8 Posts 3 Posters 496 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic was forked from New (incomplete) LSP client plugin PeterJones
    This topic has been deleted. Only users with topic management privileges can see it.
    • Murray Sobol 1M
      Murray Sobol 1
      last edited by PeterJones

      @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

      PeterJonesP EkopalypseE 2 Replies Last reply Reply Quote 1
      • PeterJonesP
        PeterJones @Murray Sobol 1
        last edited by

        @Murray-Sobol-1 ,

        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 the c:\Program Files\Notepad++\themes … so if you want to avoid having to get Admin privileges to customize your theme every time, you should:

        1. Copy c:\Program Files\Notepad++\themes\Deep Black.xml to %AppData%\Notepad++\themes\Deep Black.xml

        2. Edit %AppData%\Notepad++\themes\Deep Black.xml

        3. 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

        4. Exit Notepad++

        5. Relaunch Notepad++, and make sure Deep Black theme is selected

        6. Verify that Style Configurator shows Rust in the Deep Black theme

        Murray Sobol 1M 1 Reply Last reply Reply Quote 2
        • EkopalypseE
          Ekopalypse @Murray Sobol 1
          last edited by

          @Murray-Sobol-1

          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.

          1 Reply Last reply Reply Quote 3
          • Murray Sobol 1M
            Murray Sobol 1 @PeterJones
            last edited by

            @PeterJones
            Thanks for the tips!!
            I did the following:

            1. Copy c:\Program Files\Notepad++\themes\Deep Black.xml to %AppData%\Notepad++\themes\Deep Black.xml
            2. Edit %AppData%\Notepad++\themes\Deep Black.xml
            3. 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?
            4. Exit Notepad++
            5. 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.
            6. Verify that Style Configurator shows Rust in the Deep Black theme
              I was unable to do that.

            Did I miss a step??

            PeterJonesP 1 Reply Last reply Reply Quote 0
            • PeterJonesP
              PeterJones @Murray Sobol 1
              last edited by

              @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.

              Murray Sobol 1M 1 Reply Last reply Reply Quote 1
              • Murray Sobol 1M
                Murray Sobol 1 @PeterJones
                last edited by

                @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

                PeterJonesP 1 Reply Last reply Reply Quote 0
                • PeterJonesP
                  PeterJones @Murray Sobol 1
                  last edited by

                  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

                  The “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.

                  https://npp-user-manual.org/docs/themes/

                  1 Reply Last reply Reply Quote 1
                  • PeterJonesP
                    PeterJones
                    last edited by PeterJones

                    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.

                    1 Reply Last reply Reply Quote 3
                    • First post
                      Last post
                    The Community of users of the Notepad++ text editor.
                    Powered by NodeBB | Contributors