microsoft / microsoft/TypeScript

Distinguishing suggestions from global scope from local suggestions

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

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

Experience Enhancement Suggestion VS Code Tracked
主要言語
Go
スター
111k
フォーク
14.4k
平均マージ
1日 19時間
マージ済み PR(30日)
117

説明

From https://github.com/Microsoft/vscode/issues/59437

Search Terms:

  • TSServer
  • completions
  • suggestions

Code
For the example ts file:

class FooClass {
    toString(): void {
        |
    }
}

Trigger suggestions at the | inside the toString method

Problem
We get back two completions from completionInfo:

     {
            "name": "toString",
            "kind": "function",
            "kindModifiers": "declare",
            "sortText": "0"
        },
        {
            "name": "toString",
            "kind": "method",
            "kindModifiers": "",
            "sortText": "0",
            "insertText": "this.toString"
        },

However when we then make the completionEntryDetails request, we can only pass the identifier name: "toString". This makes it unclear which completion entry we are actually requesting completion details for.

Proposal
completionEntryDetails already has a source field that is used to identify when a suggestion is an auto import. I believe that this field could also be used for global symbols, such as when a symbol name comes from a global lib.d.ts file. In this case, the first toString suggestion comes from a global in dom.d.ts

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

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

はじめの一歩

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

調査の方向性

FooClass の例を使って、completionInfo が返す重複した toString 補完を再現します。completionEntryDetails が現在、自動インポートに source をどのように使っているかを確認し、次に dom.d.ts のグローバルシンボルについて提案されているケースを評価します。呼び出し元がエントリを区別して、対応する詳細を要求できれば完了です。

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

評価

技術スタック
typescript
領域
compilers
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

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

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