"if" in comment can mess up indentaction

Aperta
#479 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
52/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
rust, vim
Ambito
tooling

Direzione di ricerca

Start with the referenced logic in indent/rust.vim at lines 148–149 and check how it handles the example comment before a struct block. Reproduce the indentation issue with the supplied steps, then confirm that the closing brace is no longer indented by the comment. No test file is mentioned in the issue.

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

Descrizione

  • rust.vim version: 4aa69b84c8a58fcec6b6dad6fe244b916b1cf830

Steps to reproduce:

  • Edit a file with "If" inside a comment, on an indented line (I believe "fn" will also trigger the issue)
  • Begin and end any block

Expected behavior: The comment shouldn't affect indenting
Actual behavior: The } char will be indented to match the indent of the comment line. Note the leading space in the example below:

/**
 * Something is wrong if rust.vim adds indent to the last line
 */

struct Foo {
 }

I believe this is due to this line, which doesn't take into account if a line is a comment or not: https://github.com/rust-lang/rust.vim/blob/master/indent/rust.vim#L148-L149

Lingua principale
Vim Script
Stelle
4.2k
Fork
323
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: 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 rust-lang/rust.vim

Tutte le issue di rust-lang/rust.vim

Issue simili

Altre issue su DevTools

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.