microsoft / microsoft/TypeScript
Include Default Parameter Values in Signature Help
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Go
- Estrellas
- 111k
- Forks
- 14.3k
- Merge medio
- 1 d 19 h
- PR fusionados (30 d)
- 117
Descripción
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
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza con la respuesta de TSServer signatureHelp mostrada en el issue y sigue la implementación de la ayuda de firma en el servicio de lenguaje de TypeScript. Confirma cómo se ensamblan los displayParts de los parámetros, haz que el caso simple de valor predeterminado aparezca en esa respuesta y verifica la ayuda de firma resultante con el ejemplo foo.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- typescript
- Área
- tooling
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 42/100