Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Formatter not using styler?

Chiusa
#675 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
r
Ambito
tooling

Direzione di ricerca

Inizia riproducendo la formattazione tramite R languageserver in VSCode e confronta il suo output con l’esecuzione diretta di styler sullo stesso file. Il lavoro è completo quando il formatter di languageserver usa un’indentazione di due spazi compatibile con styler, così che il codice formattato non attivi più il linter.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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?

Lingua principale
R
Stelle
675
Fork
118
Merge medio
1g 11h
PR unite (30g)
11

Preparare l'ambiente

Non abbiamo ancora controllato i file di configurazione di questo progetto. Parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di REditorSupport/languageserver

Tutte le issue di REditorSupport/languageserver

Issue simili

Altre issue su R

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.