Replies: 1 comment
-
Refactoring support to fix issues would be great. It would be nice if it was a generic library, like you said, so it can be used in the CLI independent of the LSP. We'd like to eventually implement something like this on top of smithy-syntax + smithy-model (use smithy-model validation events and the token tree of smithy-syntax to detect refactorable issues, then use smithy-syntax to fix them). Scalafix and how they wire up to the LSP and CLI looks like a good prior art for inspiration. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When building a validator/linter, one might want to give the user an option to automatically apply a fix.
For example, consider a linter of unused shapes: it could offer the action to remove such shapes, or to add a suppression where appropriate.
Of course, this particular example is a built-in validator, and the removal of unused shapes could be special-cased in the LSP. However, making it extensible would:
What do you think?
The implementation of a rewrite API is out of scope for this discussion: I'm thinking of a syntax tree-aware Scalafix-like thing, but for starters we could leave the details up to the implementor of the particular rewrite.
Other than rewrites, this API could be extended with navigation (e.g. "you used thing X here, but it conflicts with Y here"), but that can be a next step. There's a lot we could do with this!
This is inspired by ideas from the Scala ecosystem, but I think it originates from (among others) Rust.
Beta Was this translation helpful? Give feedback.
All reactions