google / google/vim-codefmt

FormatCode adds line filled with spaces when run on .cc file

Ouverte
#217 7 commentaires 1 réaction 0 personnes assignées Voir sur GitHub
Langage dominant
Vim Script
Étoiles
1.1k
Forks
102
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

**Description**

Running `:FormatCode` on a cpp source (not header) file causes a trailing line filled with whitespaces to appear at the end of the document.
Running `:FormatCode` again and again removes and re-adds and removes and ... this line.

**Steps to reproduce**

1) Use this init.vim file:

```
call plug#begin('~/.local/share/nvim/plugged-minimal')
Plug 'google/vim-maktaba' " Needed for vim-codefmt
Plug 'google/vim-glaive' " Needed for vim-codefmt
Plug 'google/vim-codefmt' " Code formatting
call plug#end()
```

2) Open any .cc file (for example I use `base/run_loop.cc` from the chromium project

3) Run `:FormatCode`. Observe line with trailing whitespaces at the end of the file
4) Run `:FormatCode`. Observe line with trailing whitespaces at the end of the file is gone.
5) Repeat

**My Setup**

* 'vim-codefmt' is up-to-date (I ran `:PlugUpdate`)

```
─❯ nvim --version
NVIM v0.7.2
```

```
╰─❯ clang-format --version
clang-format version google3-trunk (30af2fb33ed2f610abfa50e53df9712887b2bd25)
```

**Gif of the bug**

![bug](https://github.com/google/vim-codefmt/assets/10767030/04a4649d-b5a0-445a-88a8-18bf5a7e24fb)

**Other things I tried**

* Manually running `clang-format -i base/run_loop.cc` from the command line **does not introduce these whitespaces**, which is why I opened the bug against `vim-codefmt` and not `clang-format`.

Please let me know if you need any more information.

Thanks!

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Reproduisez le problème avec la configuration init.vim, un fichier .cc tel que base/run_loop.cc et la commande :FormatCode ; comparez cela au comportement direct de clang-format -i. Suivez le point d’entrée de :FormatCode et vérifiez que le formatage répété n’ajoute ni ne supprime plus de ligne finale composée uniquement d’espaces blancs.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
cpp, vim
Domaine
tooling
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
45/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.