Lexer counts a leading tab as 4 columns in token spans; LSP rename then edits the wrong bytes
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 72/100
調査の方向性
Start at the lexer’s token span and column tracking, then follow how the LSP rename operation consumes those spans. Run or extend the rename tests for a tab-indented identifier and an identifier after a leading tab inside an f-string. Done means both renames produce programs with identical output and token positions use source byte offsets.
索引モデルが issue の本文から書いたものです。
説明
Found by /code-review on PR #1331. The problem predates that PR, which extends it to f-strings.
At line start, the lexer counts a tab as 4 columns for indentation, and it records token columns in those units rather than in bytes. So the token spans that the LSP uses for rename, cursor lookup and semantic tokens are off by 3 per leading tab:
- on tab-indented lines (pre-existing);
- after #1331, for an identifier right after a leading tab inside an f-string's braces:
print of f"{<TAB>count}".
A rename then rewrites the wrong bytes.
Done when
- Token columns and lengths are byte offsets in the source (indentation width is tracked separately from the column), or the LSP converts them correctly.
- Rename tests: renaming an identifier on a tab-indented line, and after a leading tab inside
f"{...}", produces a program with identical output.
- 主要言語
- C
- スター
- 3
- フォーク
- 7
- 平均マージ
- 4時間 7分
- マージ済み PR(30日)
- 112
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
InauguralSystems/EigenScript のほかの issue
-
area:embed kind:silent-wrong
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
InauguralSystems/EigenScript#1387 ·
メンテナーはふだん 1 日以内に返信
-
area:stdlib kind:silent-wrong
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
InauguralSystems/EigenScript#1378 ·
メンテナーはふだん 1 日以内に返信
-
area:gates kind:gate-defect
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
InauguralSystems/EigenScript#1374 ·
メンテナーはふだん 1 日以内に返信
-
Error carets pad multi-byte UTF-8 byte-for-byte, so the ^ lands right of the token on a terminalオープンarea:lint-tooling kind:silent-wrong
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
InauguralSystems/EigenScript#1373 ·
メンテナーはふだん 1 日以内に返信
-
area:gates kind:docs-drift
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
InauguralSystems/EigenScript#1372 ·
メンテナーはふだん 1 日以内に返信
InauguralSystems/EigenScript の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
-
[Issue]: Headers - vx_ext_amd.h does not compile as C (enum types used without the enum keyword)オープン
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
Qiskit/qiskit#17079 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信