microsoft / microsoft/TypeScript

Include Default Parameter Values in Signature Help

オープン
#16,665 コメント 51 件 リアクション 190 件 担当者 0 名 GitHub で見る

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

Awaiting More Feedback Domain: LS: Quick Info Domain: LS: Signature Help Suggestion VS Code Tracked
主要言語
Go
スター
111k
フォーク
14.3k
平均マージ
2日 4時間
マージ済み PR(30日)
132

説明

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

TypeScript Version: 2.4.0

Feature Request
signatureHelp current shows when a parameter is optional but does not include any information about that parameter's default value:

function foo(x = 10) { }
foo(|)

Result of TSServer signatureHelp on foo

[Trace  - 5:42:22 PM] Response received: signatureHelp (378). Request took 20 ms. Success: true 
Result: {
    "items": [
        {
            "isVariadic": false,
            "prefixDisplayParts": [
                {
                    "text": "foo",
                    "kind": "functionName"
                },
                {
                    "text": "(",
                    "kind": "punctuation"
                }
            ],
            "suffixDisplayParts": [
                {
                    "text": ")",
                    "kind": "punctuation"
                },
                {
                    "text": ":",
                    "kind": "punctuation"
                },
                {
                    "text": " ",
                    "kind": "space"
                },
                {
                    "text": "void",
                    "kind": "keyword"
                }
            ],
            "separatorDisplayParts": [
                {
                    "text": ",",
                    "kind": "punctuation"
                },
                {
                    "text": " ",
                    "kind": "space"
                }
            ],
            "parameters": [
                {
                    "name": "x",
                    "documentation": [],
                    "displayParts": [
                        {
                            "text": "x",
                            "kind": "parameterName"
                        },
                        {
                            "text": "?",
                            "kind": "punctuation"
                        },
                        {
                            "text": ":",
                            "kind": "punctuation"
                        },
                        {
                            "text": " ",
                            "kind": "space"
                        },
                        {
                            "text": "number",
                            "kind": "keyword"
                        }
                    ],
                    "isOptional": true
                }
            ],
            "documentation": [],
            "tags": []
        }
    ],
    "applicableSpan": {
        "start": {
            "line": 3,
            "offset": 5
        },
        "end": {
            "line": 3,
            "offset": 5
        }
    },
    "selectedItemIndex": 0,
    "argumentIndex": 0,
    "argumentCount": 0
}

When the default value is a simple literal type, it would be helpful to display this default value in the signature help. This information could be included in the displayParts response

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

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

はじめの一歩

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

調査の方向性

issue に示されている TSServer signatureHelp レスポンスから始め、TypeScript 言語サービスのシグネチャヘルプ実装を追跡します。パラメーターの displayParts がどのように組み立てられるかを確認し、そのレスポンスに単純なデフォルト値のケースが現れるようにして、foo の例に対して結果のシグネチャヘルプを検証します。

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

評価

技術スタック
typescript
領域
tooling
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
42/100

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

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