Seeking for help
-
Thanks a lot - I will definitely have a look at the Java Language Server and your implementation to get some ideas ;-)
-
@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.
-
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. -
@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?
-
@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.
-
-
@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.
-
-
-
@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.
-
@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? -
@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? -
@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.