Position of RBS::Location should be byte length
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
RBS::Location と RBS::Parser.parse_signature が返す位置から始め、π を再現ケースとして core/math.rbs の例を使用します。位置のオフセットが IO#read でどのように使用されるかを確認します。位置が UTF-8 のバイト長を考慮し、π/p の比較が意図したとおりに動作すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
I'm developing a tool using RBS.
And I'm trying to load RBS files using RBS::MethodType#location and display them with colors.
During development, a problem occurred where the display is off by one character only in core/math.rbs.
In core/math.rbs, the character π is used in the documentation, which is a 2 byte character.
Upon investigation, it appears that the positions in Location are recorded not in byte size but in the number of UTF-8 characters.
# Whether the comment is `π` or `p`, the class location has not changed.
::RBS::Parser.parse_signature("#π\nclass Foo\nend")[2][0].location.start_pos
#=> 3
::RBS::Parser.parse_signature("#p\nclass Foo\nend")[2][0].location.start_pos
#=> 3
Recording the position in bytesize would make it more convenient for reading with methods like IO#read, so I believe it should be recorded in bytesize.
What do you think?
- 主要言語
- Ruby
- スター
- 2.2k
- フォーク
- 263
- 平均マージ
- 1日 20時間
- マージ済み PR(30日)
- 64
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
ruby/rbs のほかの issue
-
InlineParser: `@rbs @ivar` annotation is reported as unused unless it is the first thing in the class body対応中かも @ksss が 50 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
bug f:request-creation professional
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
mysociety/alaveteli#9733 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
needs verification
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
メンテナーはふだん 13 日以内に返信
-
🐛 bug 👩💻 équipe CE 🧑🏭 entreprises
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
betagouv/conseillers-entreprises#4808 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100