Skip to content

Adding LSP as a standalone parser type #118

Open
@dangmai

Description

@dangmai

This is a continuation of our discussion on Twitter between me and @ntotten. The purpose is to add the ability for prettier-plugin-apex to interface directly with Salesforce LSP that is started in VSCode.

Here's my thought on how this would be implemented:

  • Currently there's an option called --apex-standalone-parser with 2 possible choices: none and built-in. I'd like to add another option lsp.
  • I'd need Salesforce to implement a custom endpoint on the LSP to get the AST from it. Preferably this will give me back the result in JSON format, like the implementation here: https://github.com/dangmai/apex-ast-serializer/blob/master/src/main/java/net/dangmai/serializer/Apex.java (a few things that apex-ast-serializer does: serializes the AST to JSON in a standard way for multiple data structures, mark circular references) If that's not possible, I will have to write custom code to parse their AST.
  • On Salesforce side, set the default for this option to lsp on their prettierrc documentation for VSCode integration, so that people who follow that documentation gets the benefits out of the box.

The 1.0.0 release is basically ready at this point, but if the previous steps can be done quickly then I'd be happy to wait for them to finish before releasing 1.0.0.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions