Skip to content

LSP formatting error: Message could not be parsed. #579

Closed

Description

@He1pa

I got an error about Message could not be parsed.
image

How can I get more detailed error information?
Btw, this server works fine in vscode. I don't know what went wrong.

Activity

  1. He1pa commented on Oct 17, 2024

    @He1pa
    Author

    In addition, it cannot be used in MacOS and Windows systems. However, except for format, other lsp features are work fine

  2. angelozerr commented on Oct 17, 2024

    @angelozerr
    Contributor

    Could you give me the link to the vscode extension which uses the language servers and if you are using user defined languzge server , could yiu export it by sélecting the server in the lsp console with contextual menu and attach the zip. Thanks.

  3. angelozerr commented on Oct 17, 2024

    @angelozerr
    Contributor

    You should see this error in the LSP console too, perhaps you will have more info?

    And perhaps your LSP logs something, perhaps you have some info in Logs tab?

  4. He1pa commented on Oct 17, 2024

    @He1pa
    Author

    Could you give me the link to the vscode extension which uses the language servers and if you are using user defined languzge server , could yiu export it by sélecting the server in the lsp console with contextual menu and attach the zip. Thanks.

    https://marketplace.visualstudio.com/items?itemName=kcl.kcl-vscode-extension

  5. He1pa commented on Oct 17, 2024

    @He1pa
    Author

    open file - format file
    log:
    image
    traces:
    image

    I get the message of lsp server has finished format request, but no response

  6. He1pa commented on Oct 17, 2024

    @He1pa
    Author
  7. He1pa commented on Oct 17, 2024

    @He1pa
    Author

    Is there any limitation when parsing TextEdit range? I used (0,0)-(u32:max, u32:max) when building Response, I guess the problem is here. After my test, it can be parsed normally when executing formmat range request (returning normal range), but it will fail when formatting the entire file (returning (0,0)-(u32:max, u32:max))

  8. He1pa commented on Oct 17, 2024

    @He1pa
    Author

    Is there any limitation when parsing TextEdit range? I used (0,0)-(u32:max, u32:max) when building Response, I guess the problem is here. After my test, it can be parsed normally when executing formmat range request (returning normal range), but it will fail when formatting the entire file (returning (0,0)-(u32:max, u32:max))

    Well, I solved the problem. I set the new range to (0,0)-(u32:max, u32:max) and Gson didn't seem to parse the value correctly. I recalculated the range and everything worked fine.

  9. angelozerr commented on Oct 17, 2024

    @angelozerr
    Contributor

    Well, I solved the problem.

    where?

  10. He1pa commented on Oct 17, 2024

    @He1pa
    Author

    Well, I solved the problem.

    where?

    The format range in Response should be 0 to 2^31 - 1
    https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#baseTypes

    In my LSP server implementation, I returned u32::max in the response, which exceeds this range. This may be the reason for the parse failure

    fix pr: kcl-lang/kcl#1698

  11. angelozerr commented on Oct 17, 2024

    @angelozerr
    Contributor

    Ok thanks for your feedback! That's strange that it works in vscode but not with LSP4J?

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions