You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An issue I've been having is that using the LS to format code results in immediate errors from lintr, particularly because the parameters sent in DocumentFormattingParams as part of formatting requests do not get used for the parameters of linters. This causes, e.g. the document to be indented according to the specified indent size, but the indentation linter to immediately tag it as wrong because it thinks the indent size is the default 2. Am I missing something here? Is there some way to manually specify the parameters that get sent to calls to linters?
For context, I am using emacs eglot to edit R code. Investigating the eglot code, the package uses the emacs parameter tab-width as part of the document formatting parameters. As things are, setting that width to anything other than the tidyverse 2-space standard causes the aforementioned "correction thrashing".
Edit:
I've found the relevant part of the codebase. It appears that the indent parameter of the indentation_linter is hard-coded to 2 (among other parameters that are left to defaults or hard-coded), when it should change according to the parameters sent to the server, as the DocumentFormattingParams do. The lintr documentation specifies that the linter parameters can be specified on-the-fly with options() or with every call to lint() (which would be consistent with the formatting behavior).
If my prelimary investigation is correct, changing the calls to lint()here to inject the format options with every call would 'fix' the issue (though it might increase memory usage, so using options() might be better). I am not a professional programmer or familiar with this codebase, so I am hesitant to write the patch myself.
The text was updated successfully, but these errors were encountered:
An issue I've been having is that using the LS to format code results in immediate errors from lintr, particularly because the parameters sent in
DocumentFormattingParams
as part of formatting requests do not get used for the parameters of linters. This causes, e.g. the document to be indented according to the specified indent size, but the indentation linter to immediately tag it as wrong because it thinks the indent size is the default 2. Am I missing something here? Is there some way to manually specify the parameters that get sent to calls to linters?For context, I am using emacs eglot to edit R code. Investigating the eglot code, the package uses the emacs parameter
tab-width
as part of the document formatting parameters. As things are, setting that width to anything other than the tidyverse 2-space standard causes the aforementioned "correction thrashing".Edit:
I've found the relevant part of the codebase. It appears that the
indent
parameter of the indentation_linter is hard-coded to 2 (among other parameters that are left to defaults or hard-coded), when it should change according to the parameters sent to the server, as the DocumentFormattingParams do. The lintr documentation specifies that the linter parameters can be specified on-the-fly withoptions()
or with every call tolint()
(which would be consistent with the formatting behavior).If my prelimary investigation is correct, changing the calls to
lint()
here to inject the format options with every call would 'fix' the issue (though it might increase memory usage, so usingoptions()
might be better). I am not a professional programmer or familiar with this codebase, so I am hesitant to write the patch myself.The text was updated successfully, but these errors were encountered: