-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pascal language server #1
Comments
- how "fragile" they are to missing units (resolution: both LSP servers, and Lazarus IDE, are equally fragile) - how good are they at finding LCL units (resolution: both LSP servers behave the same; Lazarus IDE is better) See #1
Thank you very much for this message -- the knowledge that you're active, and welcoming merge requests, is most valuable info to me. Sorry for writing a long reply below :) I wanted to make sure I address your points. And some of my test conclusions on https://github.com/michaliskambi/elisp/tree/master/lsp have been chaotic/wrong, sorry about that too. I have improved them now after retesting things carefully, with both LSP servers (and Lazarus IDE) to have a clearer idea of the differences/similarities.
Background why I'm testing LSP servers:
So now I know we can have
Testcase:
So, both LSP servers are equal here. But Lazarus IDE is able to be better -- maybe because it parses LPI / LPK. I don't know the internals of CodeTools, can they be augmented with this knowledge easily. To be frank, this is not critical to my usage. In Castle Game Engine we don't rely in LPI / LPK to compile applications, and we can use bare FPC (with CGE project definition in
Confirmed and agreed. My previous statement (that it's a specific issue of your fork) was an error. Testing, confirms that both LSP servers (your's and Ryan Joseph) are equally "fragile" to missing units on uses clauses, and actually Lazarus IDE is equally "fragile". So it is a problem in CodeTools, outside of LSP servers.
What I did for testing:
Happy to hear you're open to this. I'll be experimenting to see whether I prefer in long-term to pass to LSP server "FPC options" or a single "Castle Game Engine path". The latter (single CGE path) is easier to use -- it means you just set 1 path -- though it is a CGE-specific customization then.
Thank you, and I agree after understanding this feature. It's an extra feature in your fork, not a disadvantage. I have updated https://github.com/michaliskambi/elisp/tree/master/lsp to reflect my new knowledge. I propose to limit this issue's scope now to resolve: why Lazarus IDE is better at finding LCL units (like |
Got it. And it was an Emacs-specific issue, i.e. it exhibited only when Emacs was the LSP client. It worked in VS Code, as you showed. I have submitted PR with explanation what Emacs is doing, and a proposal how to be robust in this case, in Isopod/pascal-language-server#1 . Sorry for not catching this fact (that it was Emacs-specific) earlier in my testing. I was sure I tested both LSP servers (your's and Ryan Joseph) with both Emacs and VS Code. I recall deliberately doing it (I even wrote "I tested above both with VS Code and Emacs integration of LSP." in my notes). Well, apparently I only tested Ryan Joseph's LSP server to confirm the problem in VS Code. Maybe I was sleepy and didn't realize that "the important difference between these 2 LSP servers is that Philip Zander's reads LPK/LPI". It's no longer really important, but I attach the log before the fix.
|
I updated https://github.com/michaliskambi/elisp/tree/master/lsp notes and I'm extremely happy with the state of Pascal code completion in my Emacs now. After so many years of coding somewhat blindly, without intelligent code completion in my favorite editor, this is an amazing feeling :) I'm closing this issue now. I'll get back to you if I will find anything more to improve. I will be using this LSP server (my fork of your LSP server, which I'll try to keep close to your version sans CGE-specific modifications) in my regular daily work from now on.
|
Regarding the error message: Maybe Emacs is getting confused because "insertText" is empty. In NeoVim, this message is just shown as a regular popup like normal completion candidates. None of these solutions are ideal. Regarding package resolution: You may want to specify a default (or even preferred) path in your LPI/LPK. You can do this in the IDE in the project inspector (or edit the XML manually): This results in markup like this being inserted in the XML: https://github.com/Isopod/pascal-language-server/blob/2c09fe7b74decc98af9d4d781ce701c4761d789d/server/pasls.lpi#L50 That would help the language server find the right packages. |
As for error reporting: I have submitted PR Isopod/pascal-language-server#2 :) Below some additional Emacs-specific background info: Testing Emacs,
|
The post about LSP servers + Castle Game Engine is live on https://castle-engine.io/wp/2022/11/19/visual-studio-code-integration-intelligent-code-completion-with-our-lsp-server-also-for-emacs-neovim-and-other-text-editors/ . The most important part of it is a new manual page -- https://castle-engine.io/vscode . This page is an attempt to document, for users, what Visual Studio Code setup we recommend for working with Castle Game Engine. And the central part of it is using our LSP server derived from yours. We distribute the binary of LSP server precompiled in CGE download on https://castle-engine.io/download . |
Cool, thanks for the notification. If I ever set up VSCode for Pascal development, I'll probably use your manual. |
Hi, I saw that you forked my LSP fork. I just wanted to address a few points you made here:
That should not happen, I don't have that issue on any of my machines.
I know about that, but I think that is just how CodeTools works. The same thing happens in the Lazarus IDE: Whenever there's a missing unit and you try to invoke code completion, instead of showing you candidates, the editor jumps to the erroneous line.
That should work already. I suspect that there is a problem with your config if it can't find LCL units.
That feature would be trivial to add, it was just not needed until now. Feel free to open a MR.
That is true. My fork hasn't been very active lately for two reasons: 1. It already does 95% of what I need. 2. I'm not doing any Pascal development at the moment. However, that does not mean that development has to stop. Others are welcome to contribute. It is open source for a reason. I'd be happy to review any merge requests.
That may be a misunderstanding. My fork does not need the Lazarus config, either. It can use it, which is purely for convenience. But you can also specify all of the paths manually, either by sending initializationOptions or by setting environment variables.
It would surprise me since both forks use CodeTools under the hood. However, I'll admit I don't know much about CodeTools and the documentation is sparse to non-existent. If there is anything I could do differently, I would love to know.
Again, I'm open to contributions. Even if it is just a bug report. Please don't be shy to open an issue if you find a problem or have a suggestion.
The text was updated successfully, but these errors were encountered: