TypeScript/tests/cases/fourslash/completionsThisProperties_globalSameName.ts
Andrew Branch 23b500cadf
Don’t offer this. completions on self, window, global, globalThis. Disambiguate this. completions from others in details requests. (#37652)
* Special-case window, self, global, globalThis methods

* Disambiguate global and this property completions in details requests

* Hide the Map<boolean> implementation

* Update old tests

* Replace SymbolOriginKind stringification with dedicated enum
2020-03-31 12:40:57 -07:00

52 lines
1.1 KiB
TypeScript

/// <reference path="fourslash.ts" />
// @Filename: globals.d.ts
//// declare var foot: string;
// @Filename: index.ts
//// class Service {
//// foot!: number;
//// serve() {
//// foot/**/
//// }
//// }
verify.completions({
marker: "",
exact: [
"arguments",
completion.globalThisEntry,
...completion.globalsVars,
{
name: "foot",
insertText: undefined,
kind: "var",
kindModifiers: "declare",
sortText: completion.SortText.GlobalsOrKeywords,
text: "var foot: string"
},
"Service",
completion.undefinedVarEntry,
{
name: "foot",
insertText: "this.foot",
kind: "property",
sortText: completion.SortText.SuggestedClassMembers,
source: completion.CompletionSource.ThisProperty,
text: "(property) Service.foot: number"
},
{
name: "serve",
insertText: "this.serve",
kind: "method",
sortText: completion.SortText.SuggestedClassMembers,
source: completion.CompletionSource.ThisProperty
},
...completion.insideMethodKeywords
],
preferences: {
includeInsertTextCompletions: true
}
});