feat: add a first code-action quickfix (add missing attributes)#1549
feat: add a first code-action quickfix (add missing attributes)#1549kevineor wants to merge 2 commits intohashicorp:mainfrom
Conversation
fix: do not use struct for missing attributes
e448881 to
6431c57
Compare
|
Waw! |
radeksimko
left a comment
There was a problem hiding this comment.
There is a plan for introducing some abstraction layers first before we begin to introduce more code actions. This is to ensure they all stay reasonably maintainable as we can anticipate many more will come.
I outlined some more details in #1575 but this is mostly for transparency, not in the anticipation of an external contributor picking up any of that work. We do expect external contributors like you to participate in maintaining those individual code actions however, which will hopefully make use of the abstraction layers.
I know this may not be the answer you were hoping for but I prefer to be honest and open, even if that implies high likelihood of the PR being closed in the near term and/or need significant rewrite later.
For now I'm putting it on hold and a team member will revisit this PR later. I cannot commit to any timeline at this point unfortunately.
Thank you for your effort and understanding!
Implementation for a first LS CodeAction
quickfixfeatureRelated issues
hashicorp/vscode-terraform#801
#1530
Proposal
The implementation relies on
Diagnosticsdata property : https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#diagnosticThis property is stated as an extra data that is kept between
textDocument/publishDiagnosticsnotifications andtextDocument/codeActionrequests, this permits to avoid the need of parsing again the document.This could be proposed for other issues that are pushed through Diagnostics
Actual state
Currently filling the missing attribute using a
nullvalue, it may be possible to use the default value, when one is provided.