REditorSupport / REditorSupport/languageserver
Formatter not using styler?
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 675
- Forks
- 118
- Avg merge
- 1d 37m
- Merged PRs (30d)
- 11
Description
I might have something wrong with my config but I can't figure out what. I am using vscode with the R extension using the languageserver. R is configured correctly (I think) such that I can run scripts, view plots, etc. Linting works as well.
Formatting does not seem to run through the styler package as expected.
Here is a file before formatting:
library("tidyverse")
tibble(x = 1:12, y = rnorm(12)) %>%
ggplot(aes(x = x, y = y)) +
geom_point() +
geom_smooth(method = "lm")
c(1,2,3)
And after formatting using the languageserver functionality in vscode (Right click > Format Document):
library("tidyverse")
tibble(x = 1:12, y = rnorm(12)) %>%
ggplot(aes(x = x, y = y)) +
geom_point() +
geom_smooth(method = "lm")
c(1, 2, 3)
As you can see, the lack of spaces in the last line is fixed. However, the indentation is using 4 spaces, not 2 spaces. The linter yells at me because of the wrong number of spaces.
If I use styler directly on the file (i.e. by opening an R terminal, and running the command style_file("/path/to/file.R")), I get the following:
library("tidyverse")
tibble(x = 1:12, y = rnorm(12)) %>%
ggplot(aes(x = x, y = y)) +
geom_point() +
geom_smooth(method = "lm")
c(1, 2, 3)
In this case, the indentation is correct.
Any advice?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing formatting through the R languageserver in VSCode and compare its output with running styler directly on the same file. Done means the languageserver formatter uses styler-compatible two-space indentation so the formatted code no longer triggers the linter.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100