microsoft / microsoft/TypeScript
Distinguishing suggestions from global scope from local suggestions
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.3k
- Ø Merge
- 1 T. 19 Std.
- Gemergte PRs (30 T.)
- 117
Beschreibung
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
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Verwende das FooClass-Beispiel, um die von completionInfo zurückgegebenen doppelten toString-Vervollständigungen zu reproduzieren. Lies nach, wie completionEntryDetails derzeit source für automatische Importe verwendet, und bewerte dann den vorgeschlagenen Fall für globale Symbole aus dom.d.ts; fertig ist es, wenn Aufrufer die Einträge unterscheiden und die passenden Details anfordern können.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- compilers
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100