aws / aws-toolkit-vscode

Amazon Q, CodeCatalyst, Local Lambda debug, SAM/CFN syntax, ECS Terminal, AWS resources
https://marketplace.visualstudio.com/items?itemName=AmazonWebServices.amazon-q-vscode
Apache License 2.0
1.51k stars 434 forks source link

CloudFormation/SAM authoring: rich language features (LSP) #1599

Open justinmk3 opened 3 years ago

justinmk3 commented 3 years ago

As a user, when editing template.yaml or any other SAM/CFN json or yaml template, I want language services (LSP) for CloudFormation syntax:

https://marketplace.visualstudio.com/items?itemName=keyboardDrummer.vscode-cloudformation https://github.com/keyboardDrummer/cloudformation-ide-tooling

LaurenceWarne commented 1 year ago

I've been passively working on: https://github.com/LaurenceWarne/cfn-lsp-extra, a language server which implements many of the features you describe. However, there is currently no vscode editor support (I'm not really familiar with developing vscode extensions) - though any contributions/suggestions are welcome!

justinmk3 commented 1 year ago

@LaurenceWarne nice, thanks for mentioning that! Are you happy with the results with "partially invalid" syntax as the user types?

For reference, in https://github.com/aws/aws-toolkit-common/pull/424 we are taking the direction of using https://github.com/redhat-developer/yaml-language-server as a library and feeding JSON-schema into it.

LaurenceWarne commented 1 year ago

@LaurenceWarne nice, thanks for mentioning that! Are you happy with the results with "partially invalid" syntax as the user types?

I'd not considered that before, yeah I can see how you could find that annoying. Maybe diagnostics could be published bu default on textDocument/didSave rather than textDocument/didOpen, and then allow this to be configured.

For reference, in https://github.com/aws/aws-toolkit-common/pull/424 we are taking the direction of using https://github.com/redhat-developer/yaml-language-server as a library and feeding JSON-schema into it.

Interesting, if you're looking for attribute/resource strings for hovers (I'm not sure any are present in https://raw.githubusercontent.com/awslabs/goformation/master/schema/cloudformation.schema.json?), I've parsed documentation attributes from: https://github.com/awsdocs/aws-cloudformation-user-guide (here: https://raw.githubusercontent.com/LaurenceWarne/cfn-lsp-extra/master/cfn_lsp_extra/resources/context.json). Since LSP supports markdown, you can return the descriptions as hovers verbatim :slightly_smiling_face: