Better parsing for extracting autocomplete/hint options from source code
- 主要言語
- Haskell
- スター
- 1.3k
- フォーク
- 201
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
There's some existing code for finding type declarations in the current module, and augmenting the autocomplete list with them. @nixorn is extending that to his new doc-on-hover feature, as well. However, the extraction code isn't all that great right now. Specifically:
1. It only looks at one line at a time. This generates incorrect results when the type declaration is wrapped across lines.
2. It mis-parses some syntax. For example `pic1,pic2 :: Picture` will add a single item called `pic1,pic2`, when it should add separate items for both of the two pictures.
3. It would be nice to extend the parsing to recognize definition lines (like `f x = sqrt x + 1`). Type inference isn't needed here, but I think it would be great if that gave `f` an incomplete type in autocomplete and docs, like `f :: ? -> ?`. Of course, an explicit type signature should replace the incomplete definition with a complete one.
4. When extraction does succeed, it still leaves unnecessary formatting in place. So if the original source code says:
short :: Number
reallyReallyVeryVeryLong :: Number
the extracted doc for `short` will have all those spaces between `short` and `::`, even though those extra spaces aren't sensible in the new context.
One must probably resist the temptation to completely reimplement the Haskell parser in JavaScript, but I think enough special cases could go a long way.
コントリビューションガイド
調査の方向性
型宣言用の既存のソース抽出コードを特定し、その結果が autocomplete と doc-on-hover にどのように渡されるかを追跡してください。Issue にある複数行、カンマ区切り、定義行、空白のケースを再現し、推論されたプレースホルダーと明示的なシグネチャが両方のコンシューマーに正しく表示されることを確認してください。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- haskell, javascript
- 領域
- developer-experience, documentation
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100