Skip to content

Syntax Highlighting breaks since Jetbrains version 2024.2.1 on error #780

Closed

Description

@su-nikunj

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!" }

Activity

  1. angelozerr commented on Jan 29, 2025

    @angelozerr
    Contributor

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

  2. fbricon commented on Jan 29, 2025

    @fbricon
    Contributor

    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

  3. su-nikunj commented on Jan 29, 2025

    @su-nikunj
    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

  4. angelozerr commented on Jan 29, 2025

    @angelozerr
    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.

  5. su-nikunj commented on Jan 29, 2025

    @su-nikunj
    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

  6. added
    bug
    on Jan 29, 2025
  7. angelozerr commented on Feb 4, 2025

    @angelozerr
    Contributor

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

  8. su-nikunj commented on Feb 4, 2025

    @su-nikunj
    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)

  9. angelozerr commented on Feb 5, 2025

    @angelozerr
    Contributor

    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.

  10. su-nikunj commented on Feb 7, 2025

    @su-nikunj
    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.

  11. angelozerr commented on Feb 7, 2025

    @angelozerr
    Contributor

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

  12. angelozerr commented on Mar 31, 2025

    @angelozerr
    Contributor

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

    @su-nikunj we have improved semantic highlight in 0.12.0, could yiu please install nighty and tell me if it is better? Thanks

  13. su-nikunj commented on Apr 2, 2025

    @su-nikunj
    Author

    Hey @angelozerr , thanks for letting me know. I just tested out with the release of 0.12, but unfortunately, the issue seems to be still there. Will inform here if I can get it working anytime in the future.

  14. angelozerr commented on Apr 2, 2025

    @angelozerr
    Contributor

    Ok thanks for your feedback.

    To be honnest with you, I don't understand why it is worked before?

  15. su-nikunj commented on Apr 2, 2025

    @su-nikunj
    Author

    This is just a hypothesis, but I think in the newer version of IJ, it just clears out the LSP data and sends out request again to the language server every time we edit the file, and that language server is currently not good at recovering from errors in file

  16. angelozerr commented on Apr 2, 2025

    @angelozerr
    Contributor

    If it that, I fear that LSP4IJ cannot do something -(

  17. angelozerr commented on Oct 19, 2026

    @angelozerr
    Contributor

    @su-nikunj have you still this issue?

  18. su-nikunj commented on Oct 20, 2026

    @su-nikunj
    Author

    Hey @angelozerr , sorry for not replying earlier. But we managed to add recovery functionality to our language server and I think this issue can be closed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsemantic tokens

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions