-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow linters to provide fix #784
Comments
This sounds promising. Maybe we could upgrade the We could add optional attributes to each vector (e.g. attr(., "fix")) or add a new attribute to |
A simple way is to add structure(
list(
filename = filename,
line_number = as.integer(line_number),
column_number = as.integer(column_number),
type = type,
message = message,
line = line,
ranges = ranges,
fixes = fixes,
linter = NA_character_
),
class = "lint") where In most cases, a |
Here's a simple demo with #785 and REditorSupport/languageserver#397: |
FWIW this is exactly the sort of thing I had in mind for #710 |
Some code editors (e.g. vscode) supports code actions to allow language server to provide code refactoring or fixes via the language server protocol.
In languageserver, I'm trying to support code actions like this to provide quick fixes of the lint results for many linters. However, lintr might be the best place to provide the fix along with the problem as each linter has the best knowledge of the problem it finds and how it should be resolved if possible.
Does it make sense to allow an optional a field
fix
in the lint result which contains a list of edits (each has a range and a new text) so that languageserver could directly transform these fixes into code actions at downstream?The code issues found by many linters could be easy to fix and the fix is optional rather than required so that implementing fixes could be done in a progressive way.
Also see REditorSupport/languageserver#396.
The text was updated successfully, but these errors were encountered: