rescript-lang / rescript-lang/rescript

Completions defined in `editor.autocomplete` don't work on type aliases

オープン
#7,501 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
OCaml
スター
7.5k
フォーク
485
平均マージ
1日 2時間
マージ済み PR(30日)
55

説明

I have a module BeltMapX with utility functions for working with Belt.Map.t.

I tried to set up autocomplete for pipe completion in rescript.json like so:

"editor": {
  "autocomplete": {
    "Belt.Map.t": ["BeltMapX"],
  }
}

This didn't work so I did some debugging in analysis/src/CompletionBackEnd.ml, and it turned out that mainTypeId is actually Belt_Map.t.

https://github.com/rescript-lang/rescript/blob/7b4bc420cd052e492aea6b607df8f7513210b422/analysis/src/CompletionBackEnd.ml#L1068-L1077

Updating my rescript.json config to use the unaliased type, as below, worked.

"editor": {
  "autocomplete": {
    "Belt_Map.t": ["BeltMapX"],
  }
}

Would it be possible to make the completions backend handle type aliases so that "Belt.Map.t": ["BeltMapX"] works?

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

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

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

Start in analysis/src/CompletionBackEnd.ml at the handling referenced around lines 1068-1077, and compare the configured type name Belt.Map.t with the resolved Belt_Map.t. The work is done when autocomplete configured with the aliased type name produces completions for BeltMapX, while the existing unaliased configuration continues to work.

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

評価

技術スタック
ocaml
領域
compilers, developer-experience
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
静か
明瞭さ
明確に書かれている
初心者へのやさしさ
58/100

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

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