Community
    • Login

    Seeking for help

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    40 Posts 7 Posters 4.8k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • EkopalypseE
      Ekopalypse @Nick Brown
      last edited by

      @Nick-Brown

      Thanks for testing and the kind words.
      As for GCC, the V community seems to prefer builds from https://winlibs.com/#download-release.
      Just unzip and make sure gcc is in the path or can be found.

      Unfortunately pyls is very slow compared to other language servers I’ve tested and I’m pretty sure jedi is the culprit.
      I read that the author of jedi wants to rewrite it with rust, that should give a good performance boost.

      Doh, of course, colors need to be customizable.
      Will be included in the next version (I assume tomorrow).

      Currently I am toying with how such diagnostic messages should be displayed. On the one hand I want them in the Scintilla editor, on the other hand I hate it when they are constantly shown and hidden. Maybe it is an option to use an indicator, a squiggled line (?) while typing and annotations, as is the case now, when saving the file !?

      V is a very young language that has potential, but whether it can use it, only the future will probably tell, I think. :-)

      As long as the plugin is in alpha status, I’ll try to implement the functions needed first.
      In beta status, I then plan refinements such as hotspot links etc…
      Please don’t misunderstand, I’m absolutely happy about the thoughts you made, they make total sense. Thanks again.

      1 Reply Last reply Reply Quote 4
      • Nick BrownN
        Nick Brown
        last edited by Nick Brown

        @Ekopalypse

        Thanks for the hint re GCC, all downloaded and working now, time to do some more learning of V.

        I assume you use Notepad++ for V, if so do you know of a lexer, I have found a UDL which does a half way decent job but is easily confused with things like ‘\\’?

        EkopalypseE 1 Reply Last reply Reply Quote 0
        • EkopalypseE
          Ekopalypse @Nick Brown
          last edited by

          @Nick-Brown

          Yes, I wrote a lexer for V, but unfortunately it doesn’t help you because
          it doesn’t work with a 32bit npp because, as far as I’ve investigated/understood,
          x86 code handles the thiscall needed for the cpp-lexer methods differently.
          X64 code handles this the same way as stdcall and this is supported by V.
          I haven’t had the muse to follow this up yet, if you want to do that, I can provide my lexer code.

          Nick BrownN 1 Reply Last reply Reply Quote 3
          • Nick BrownN
            Nick Brown @Ekopalypse
            last edited by

            @ekopalypse

            I have a portable x64 version I could use for V, so the lexer would be much appreciated.

            It’s just I haven’t switched over to x64 version of my main customised/built from source version yet because of issue with a missing x64 version of one of the plugins I use quite a lot, I could replicate the functionality in x64 with my own plugin but I haven’t had the time of yet.

            Michael VincentM 1 Reply Last reply Reply Quote 0
            • Michael VincentM
              Michael Vincent @Nick Brown
              last edited by

              @nick-brown said in Seeking for help:

              a missing x64 version of one of the plugins

              Which one?

              Not to hijack the thread, but this was my reason for not switching from 32-bit to 64-bit, but I was able to find alternative workflows / tools / scripting that solved the issue and I moved to 64-bit a few years back.

              Cheers.

              Nick BrownN 1 Reply Last reply Reply Quote 0
              • Nick BrownN
                Nick Brown @Michael Vincent
                last edited by

                @michael-vincent

                Automation Scripts or NppScripts.dll as the plugin dll is called, I believe the author has released a x64 version but I could not get my scripts to work in that version, possibly due to incompatibly .net versions, I don’t know I haven’t really looked into it, the scripts I use are c#.net so should be easily transferrable to a plugin when I get around to it,.

                1 Reply Last reply Reply Quote 1
                • EkopalypseE
                  Ekopalypse
                  last edited by

                  @nick-brown - done, uploaded here.
                  I have been using it for 2-3 months and never had any stability problems.
                  There is one thing that I am not sure if it has been fixed or is still a problem. Occasionally it happened, twice in my case, that the folding gets corrupted. This is also why the plugin has the menu item Toggle Fold Debug Margin.
                  If you see this and are able to reproduce it, I would ask you to let me know.

                  1 Reply Last reply Reply Quote 0
                  • Derek BrownD
                    Derek Brown
                    last edited by

                    I just found this thread now, but I’ve also been working on an LSP plugin off and on for the last several months. I don’t know how much you have implemented, I only have a couple methods but I have pretty much all the infrastructure.

                    It’s in C++ and depends on libraries that I have written for my other plugins (as well as some third party libraries).

                    https://sourceforge.net/p/kered13-notepad-plugins/code/ci/default/tree/NPP LSP/src/

                    EkopalypseE Michael VincentM 2 Replies Last reply Reply Quote 2
                    • EkopalypseE
                      Ekopalypse @Derek Brown
                      last edited by

                      @derek-brown

                      Hello, thank you for this tip.
                      I would love to collaborate with you, but my cpp knowledge is weak at best and in reality non-existent.
                      Is there already a plugin that Npp users can use?
                      I hope others who read this and know about cpp will take this as inspiration and start contributing to your project.

                      As of today, I have defined all requests, notifications and responses for version 3.16.
                      33% are technically implemented, meaning you should be able to use them,
                      but they may not be as well integrated into Npp as they could be.
                      For example, diagnostic messages are displayed as a squiggly line and the textual
                      representation is available in the console window, but you can’t hover over them
                      to see what they mean.
                      In my opinion, this 33% are the most important.
                      Code errors, completion hints, signature info, goto definition/implementation/declaration,
                      find references, code formatting and hovering over code symbols (as I said, hovering over error/warning indicators is not possible at the moment).

                      My current plan is to finish the open 67% and then start integrating it into Npp in a more meaningful way.
                      I’m really bad at estimating how long it will take to implement the remaining 67%, but if I can keep up my current
                      pace I hope to finish it within the next 2 weeks.
                      Let’s see what real life has to say about it :-)

                      Btw. what language server do you use for testing?
                      I find gopls, which I found recently, is a good one to get hints on errors in client / server communication, while pyls seems to be the most forgiving, which is not really good if you want to develop a generic lsp client :-D

                      Derek BrownD 1 Reply Last reply Reply Quote 2
                      • Derek BrownD
                        Derek Brown @Ekopalypse
                        last edited by

                        @ekopalypse I’ve mostly been using the Eclipse Java language server and the Microsoft Python language server. The Eclipse server has been very picky in particular, so it’s been good for ensuring that my plugin is conformant. It was a bit of a pain getting them setup, so I’ll share the configs that worked for me (this JSON format is how I’m storing plugin settings, but I think you can figure out to get the relevant information out of it):

                        {
                            "servers": {
                                "java": {
                                    "commandLine": "java -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Dlog.level=ALL -noverify -Xmx1G -jar ./plugins/org.eclipse.equinox.launcher_1.6.300.v20210813-1054.jar -configuration ./config_win -data C:\\Users\\Derek\\Downloads\\jdt-language-server-1.4.0-202109161824 --add-modules=ALL-SYSTEM --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED",
                                    "initializationOptions": {
                                        "extendedClientCapabilities": {
                                            "shouldLanguageServerExitOnShutdown": true
                                        }
                                    },
                                    "workingDirectory": "C:\\Users\\Derek\\Downloads\\jdt-language-server-1.4.0-202109161824"
                                },
                                "python": {
                                    "commandLine": "dotnet exec C:\\Users\\Derek\\Documents\\python-language-server\\output\\bin\\Debug\\Microsoft.Python.LanguageServer.dll",
                                    "initializationOptions": {
                                        "excludeFiles": [],
                                        "includeFiles": []
                                    }
                                }
                            }
                        }
                        

                        I have hover support working for Publish Diagnostics, feel free to look at my code if you want to see how I did it. I know you said you’re weak on C++, but I think you’ll be able to follow it. Mine is actually a bit more complicated than necessary, for a minimal implementation you only need to handle the SCN_DWELLSTART and SCN_DWELLEND events, which is very straightforward and the first thing that I implemented. However for my plugin I wanted the calltip to remain until the mouse left the indicator, so I hooked into raw input mouse events by creating a message only window to get the mouse coordinates. I also handled overlapping diagnostics by using an interval tree implementation that I pulled from Github (with some slight modifications).

                        EkopalypseE 1 Reply Last reply Reply Quote 1
                        • EkopalypseE
                          Ekopalypse @Derek Brown
                          last edited by

                          @derek-brown

                          Thanks a lot - I will definitely have a look at the Java Language Server and your implementation to get some ideas ;-)

                          Derek BrownD 1 Reply Last reply Reply Quote 0
                          • Derek BrownD
                            Derek Brown @Ekopalypse
                            last edited by Derek Brown

                            @ekopalypse By the way I was skimming your code to see how you handle certain tricky cases that took me awhile to figure out, and it looks like you don’t handle Replace in Opened Documents, have you tested this? In particular test using Replace in Opened Documents to make changed to a background file. This will probably cause issues with incremental sync if you don’t handle it correctly.

                            What I learned in my development was that when you use this feature Notepad++ uses a hidden scintilla (internally called “scratchtilla”) to apply the changes. You’ll get the SCN_MODIFIED notifications like normal, but you need to get the Scintilla from Sci_NotifyHeader.hwndFrom instead of using the current Scintilla.

                            But there’s a second catch: If the a change is applied to the primary or secondary scintilla then you will get two SCN_MODIFIED notifications: One from the primary/secondary scintilla and one from the scratchtilla. To make sure I wasn’t sending duplicate change notifications I had to implement somewhat complicated logic where I get the docpointer (SCI_GETDOCPOINTER) from the scratchtilla and compare it to the docpointers from the primary and secondary scintillas. If the notification is from the scratchtilla and is the same document as either the primary or secondary scintillas then I ignore the message. You can see how I implented this in NppLsp.cpp:shouldSendModified.

                            …And after writing this I realized that I have a similar duplicate modifed bug when the same document is opened and edited in the primary and secondary Scintilla at the same time, so now I’ll have to go fix that! This also means that a triple modified bug is possible if you use Replace in Opened Documents with the same document in both views.

                            1 Reply Last reply Reply Quote 3
                            • EkopalypseE
                              Ekopalypse
                              last edited by

                              @derek-brown

                              Thank you very much for the hints. No, currently I am only testing with a single document and only in one view, BUT I already had an issue where I sent two did_change notifications and was confused as to why this was happening. Perhaps I had two views open at the time - good to know there are certain pitfalls. Many thanks at this point.
                              Phew … sounds like I’m going to have a lot of fun in the future.
                              Maybe I should start implementing some test cases already.

                              1 Reply Last reply Reply Quote 1
                              • Michael VincentM
                                Michael Vincent @Derek Brown
                                last edited by

                                @derek-brown said in Seeking for help:

                                It’s in C++ and depends on libraries that I have written for my other plugins (as well as some third party libraries).

                                You haven’t released a compiled version yet?

                                Derek BrownD 2 Replies Last reply Reply Quote 0
                                • Derek BrownD
                                  Derek Brown @Michael Vincent
                                  last edited by

                                  @michael-vincent No I haven’t, I think I will soon. I had been thinking about making an announcement this week or next after finishing up a few things, but I saw this thread and decided to go ahead and post now. But I’d still like to finish some things before releasing a dll. If you want to try it, for now you’ll have to build it yourself with Visual Studio.

                                  1 Reply Last reply Reply Quote 1
                                  • Derek BrownD Derek Brown referenced this topic on
                                  • Derek BrownD
                                    Derek Brown @Michael Vincent
                                    last edited by

                                    @michael-vincent I have finally release a preview version, I made a separate thread for the development of my plugin here.

                                    Implementing completions was much harder than I expected, so it took awhile. I also was busy with other stuff for a couple weeks in there. I think future methods will be easier though, completions were difficult because it’s a stateful interaction with the server where you also don’t want to block the Scintilla thread, creating some really tricky concurrency issues.

                                    1 Reply Last reply Reply Quote 2
                                    • EkopalypseE Ekopalypse referenced this topic on
                                    • PeterJonesP PeterJones referenced this topic on
                                    • Derek BrownD
                                      Derek Brown
                                      last edited by

                                      @Ekopalypse I don’t know how much development you’re still doing, but I made a small program to help with testing my LSP plugin, and I thought I would share it with you. It acts as an LSP server, but you enter all the server messages yourself. So if you want to test some method and you’re having trouble getting an LSP server that provides the behavior you want, you can use this instead.

                                      Make sure you create the server process with a console, then it will display all the messages it receives from the client, and you can type into the console the messages you want to send back. Sending messages is triggered on an empty line, so you can type multi-line JSON to send. When you’re starting the server you can also provide it with initializationOptions and it will send that JSON back as it’s server capabilities, so you can configure whatever capabilities you want it to have. It will automatically handle startup, shutdown, and exit messages, everything else is manual.

                                      Download is here.

                                      EkopalypseE 1 Reply Last reply Reply Quote 2
                                      • EkopalypseE
                                        Ekopalypse @Derek Brown
                                        last edited by Ekopalypse

                                        @Derek-Brown said in Seeking for help:

                                        Wow, thank you so much. This will definitely be very helpful.
                                        I still need to work on my client a bit, I’m nowhere near where I want to be, but reality keeps throwing a wrench in the works.
                                        Also found Odin and the language intrigues me as well. My NppDebugger will be based on this language :-)
                                        Nochamls, thank you very much.
                                        If you don’t mind me asking, what about their LSP version?
                                        Are they satisfied with the result?

                                        EkopalypseE 1 Reply Last reply Reply Quote 0
                                        • EkopalypseE
                                          Ekopalypse @Ekopalypse
                                          last edited by Ekopalypse

                                          @Ekopalypse said in Seeking for help:

                                          Nochamls, thank you very much.
                                          If you don’t mind me asking, what about their LSP version?
                                          Are they satisfied with the result?

                                          what the hell deepl … even I understand that does not make sense :-)

                                          Again, thank you very much.
                                          If you don’t mind me asking, what about your LSP version?
                                          Are you satisfied with the result?

                                          Derek BrownD 1 Reply Last reply Reply Quote 1
                                          • Derek BrownD
                                            Derek Brown @Ekopalypse
                                            last edited by

                                            @Ekopalypse I’m making gradual progress, working on it off and on between other distractions. I’m very happy with what I have so far. If I can find enough time to finish it I think it will be very good.

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