google / google/vim-codefmt

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

オープン
#217 コメント 7 件 リアクション 1 件 担当者 0 名 GitHub で見る
主要言語
Vim Script
スター
1.1k
フォーク
102
PR マージ指標
30日以内にマージされた PR はありません

説明

**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!

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

init.vim の設定、base/run_loop.cc のような .cc ファイル、および :FormatCode コマンドを使って問題を再現し、clang-format -i を直接実行した場合の動作と比較します。:FormatCode のエントリポイントを追跡し、フォーマットを繰り返しても空白だけで構成された末尾の行が追加または削除されなくなっていることを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
cpp, vim
領域
tooling
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。