TypeScript/tests/cases/fourslash/completionsJsxAttributeInitializer.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

19 lines
816 B
TypeScript

/// <reference path="fourslash.ts" />
// @Filename: /a.tsx
////function f(this: { p: number; "a b": number }, x: number): void {
//// <div foo=/**/ />;
////}
verify.completions({
marker: "",
includes: [
{ name: "x", text: "(parameter) x: number", kind: "parameter", insertText: "{x}" },
{ name: "p", text: "(JSX attribute) p: number", kind: "JSX attribute", insertText: "{this.p}", sortText: completion.SortText.SuggestedClassMembers, source: completion.CompletionSource.ThisProperty },
{ name: "a b", text: '(JSX attribute) "a b": number', kind: "JSX attribute", insertText: '{this["a b"]}', sortText: completion.SortText.SuggestedClassMembers, source: completion.CompletionSource.ThisProperty },
],
preferences: {
includeInsertTextCompletions: true,
},
});