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

Syntax Highlighting breaks since Jetbrains version 2024.2.1 on error #780

Open
nikunjarora12345 opened this issue Jan 29, 2025 · 10 comments
Labels
bug Something isn't working semantic tokens

Comments

@nikunjarora12345
Copy link

Hello.
I'm developing a plugin for the QML Language Server for Android Studio. I get syntax highlighting out of the box using LSP4IJ as shown below.

Image

However, starting from Android Studio Ladybug (Jetbrains 2024.2.1), the syntax highlighting breaks whenever there is an error in the code. It returns back to normal if the error is fixed.

Error in code before Android Studio Ladybug:
Image

Error in code after Android Studio Ladybug:
Image

Tested this bug on regular IntelliJ IDEA and was able to reproduce starting with 2024.2.1 and above. It is configured like this:
Image
Image

Errors in Trace Logs:
[Trace - 12:58:37] Received response 'textDocument/semanticTokens/full - (20)' in 1ms. No response returned. Error: { "code": -32800, "message": "Cannot proceed: current QML document is invalid!" }

@angelozerr
Copy link
Contributor

This error comes from the language server. Which fixes do you expect?

@fbricon
Copy link
Contributor

fbricon commented Jan 29, 2025

Enable verbose tracing and compare the requests for both versions. There's likely a difference somewhere that might explain the problem, eg, newer version of Android sending a different payload to your LS

@nikunjarora12345
Copy link
Author

@angelozerr Thanks for replying.
Expected result would be that when there is an error in the code, the syntax highlighting keeps working as it was doing before version 2024.2.1 using the same Language Server binary

@angelozerr
Copy link
Contributor

@angelozerr Thanks for replying.
Expected result would be that when there is an error in the code, the syntax highlighting keeps working as it was doing before version 2024.2.1 using the same Language Server binary

You mean that with the same language servers and the same LSP4IJ version if the ql document have some errors it continue to have syntax coloration with IJ < 2024.1 and no syntzx coloration with IJ >= 2024.1 ?

If it that could you like @fbricon suggested to share your lsp traces with IJ < 2024.1 and IJ >= 2024.1 in order to compare them.

@nikunjarora12345
Copy link
Author

@fbricon Thanks for the suggestion.
@angelozerr Yes that's exactly it with a small correction. The syntax coloration works with IJ < 2024.2 and no coloration with IJ >= 2024.2

IJ 2024.1.2
koala.txt

IJ 2024.2.2
ladybug.txt

@angelozerr angelozerr added bug Something isn't working semantic tokens labels Jan 29, 2025
@angelozerr
Copy link
Contributor

@nikunjarora12345 could you please explain me how to download / install your language server. I have no time to read your doc, sorry.

@nikunjarora12345
Copy link
Author

@angelozerr no worries. The language server comes bundled with Qt installation which you can download from here: https://www.qt.io/download-qt-installer-oss (You'll need a Qt account)
In the installer, you can choose the latest Qt version (6.8.2) and it should install the language server in C:\Qt\6.8.2\gcc_64\bin\qmlls (Windows) or ~/Qt/6.8.2/gcc_64/bin/qmlls (Linux and something similar on Mac)

@angelozerr
Copy link
Contributor

angelozerr commented Feb 5, 2025

I fear that I cannot do something since with the same version of LSP4IJ and the same lsp request (your 2 attached trace files are the same) the behaviour is different with the 2 versions of IJ.

To understand the problem we should debug IJ himself but I will not have time to do that.

The issue should be fixed on your language server side to support invalid document like other language servers do.

@nikunjarora12345
Copy link
Author

@angelozerr no worries. Thanks for the replies. I'll also try from my end to see if I can find the discrepancy between the IJ versions.

@angelozerr
Copy link
Contributor

If you have time to debug IJ and find a fix, any contribution are welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working semantic tokens
Projects
None yet
Development

No branches or pull requests

3 participants