Skip to content
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

Language client requests diagnostics illogically #1584

Open
robotman2412 opened this issue Nov 9, 2024 · 5 comments
Open

Language client requests diagnostics illogically #1584

robotman2412 opened this issue Nov 9, 2024 · 5 comments
Labels
info-needed Issue requires more information from poster

Comments

@robotman2412
Copy link

I've created a language server and an extension counterpart that uses this library (v9.0.1) as the language client. The language server works fine but (at least with the example code) the language client requests diagnostics for the wrong file when opening files in the editor.

When I open one file, then open another (so two tabs now), the diagnostics for the first file are requested twice (as opposed to once for each file). I also can't figure out how to request diagnostics again when saving a file.

Now this would be an issue I could work around if I knew how to explicitly tell the language client to "go get diagnostics for that file" but I don't. I also can't find any obvious documentation other than the relatively surface-level tutorials from Microsoft.

Language server is asm.py from https://github.com/robotman2412/faerie-cpu
Language client extension is https://github.com/robotman2412/vscode-faerieasm

Note: The language client looks for the language server as faerie-as by default, which I've symlinked (~/.local/bin/faerie-as -> asm.py) locally. You can either do the same, or open the extension settings and enter the full path to asm.py.

@dbaeumer
Copy link
Member

@robotman2412 I tried to reproduce this in my testbed but I am unable to do so. Can you try to set a breakpoint in diagnostics.js in the vscode-languageclient npm module in pullAsync and see how often you hit this breakpoint. This is were the client ask the server for diagnostics.

I assume you are using pull diagnostics. Do you have inter file dependencies set to true?

@dbaeumer dbaeumer added the info-needed Issue requires more information from poster label Nov 11, 2024
@robotman2412
Copy link
Author

I have inter file deps set to true.
I'm not sure how to call pull diagnostics, so no, I probably don't do that at the moment. I only initialize the language client, which does occasionally do requests on its own.

@dbaeumer
Copy link
Member

That is pull diagnostics. The server specifies this via its capabilities. Is that what your server is doing?

@robotman2412
Copy link
Author

The server is capable of pull diagnostics. If it weren't (or not correctly) then I would never get any diagnostics.
Instead, I get diagnostics requested for files I didn't expect (AKA not the file I just started editing), which the server immediately handles.

@dbaeumer
Copy link
Member

If you have inter file dependencies set to true it will request diagnostics for files open in other tabs as well. This is done to ensure porper diagnostics in cases where changes in file A might fix or add new diagnostics in file B

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

2 participants