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

lsp-embedded-request-forwarding: Help wanted to generate syntax errors from embedded language #430

Open
tjroamer opened this issue May 26, 2021 · 3 comments
Assignees

Comments

@tjroamer
Copy link

I embedded JavaScript in another language by using the "Request Forwarding" approach. It worked well for code completion. Now I want also to get the syntax errors from the embedded JavaScript, but I don't have clue how to get in there.

I did see a relevant sentence in the documentation of VSCode:

https://code.visualstudio.com/api/language-extensions/embedded-languages#conclusion

I assume the + sign should have been a - sign, since it says the "Request forwarding" DOES NOT work with diagnostics errors. I could also interpret that the + sign is correct, but the NOT shouldn't have been there. Did I understand correctly?

I tried the build-in HTML language server in VSCode, and I was able to see the syntax errors from the embedded JavaScript. However, it may be using a different approach.

My question: if diagnostics errors from embedded language server would be possible, how to do that and what VSCode extension APIs should be used to retrieve the errors and bring these errors to the containing language?

Any help is much appreciated! Thanks.

@dbaeumer
Copy link
Member

Assigning to @aeschli

One tip: LSP in 3.17 will provide a diagnostic pull model that will make this easier.

@dbaeumer dbaeumer assigned aeschli and unassigned dbaeumer Jul 14, 2021
@aeschli
Copy link
Contributor

aeschli commented Jul 14, 2021

I fixed the doc.
The HTML language server does not forward, but embeds the TypeScript language service.

Once LSP 3.17 is shipped, we need an equivalent vscode diagnostics provider APIs and we need to update our language extensions (in particular css and TypeScript) to adopt it.

@GerardSmit
Copy link

LSP 3.17 is the current version and I see the following new requests:

And I see that CSS, JSON and HTML already have support for these new requests: microsoft/vscode#149972

When searching in the vscode repository, I found the following issue about diagnostic pull APIs: microsoft/vscode#112501 but it got closed and the APIs aren't in vscode (I didn't find any of them in https://code.visualstudio.com/api/references/vscode-api).

In the request forwarding example, vscode commands are being used to forward the request. However there are no vscode commands to get the diagnostics of a document (I didn't find anything on https://code.visualstudio.com/api/references/commands):

This brings me to a dead end. I tried to use vscode.languages.getDiagnostics but this only works if the document is open.

It's frustrating how much digging I need to do to find an answer when the docs say it'll be supported in LSP 3.17. Rather than saying it will be supported in LSP 3.17, it would be handy to know when it'll be supported in vscode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants