@@ -180,7 +180,7 @@ namespace ts.Completions {
180
180
181
181
let insertText : string | undefined ;
182
182
let replacementSpan : TextSpan | undefined ;
183
- if ( kind === CompletionKind . Global && origin && origin . type === "this-type" ) {
183
+ if ( origin && origin . type === "this-type" ) {
184
184
insertText = needsConvertPropertyAccess ? `this["${ name } "]` : `this.${ name } ` ;
185
185
}
186
186
else if ( needsConvertPropertyAccess ) {
@@ -683,6 +683,7 @@ namespace ts.Completions {
683
683
684
684
const enum CompletionKind {
685
685
ObjectPropertyDeclaration ,
686
+ /** Note that sometimes we access completions from global scope, but use "None" instead of this. See isGlobalCompletionScope. */
686
687
Global ,
687
688
PropertyAccess ,
688
689
MemberLike ,
@@ -2112,13 +2113,13 @@ namespace ts.Completions {
2112
2113
const validIdentiferResult : CompletionEntryDisplayNameForSymbol = { name, needsConvertPropertyAccess : false } ;
2113
2114
if ( isIdentifierText ( name , target ) ) return validIdentiferResult ;
2114
2115
switch ( kind ) {
2115
- case CompletionKind . None :
2116
2116
case CompletionKind . MemberLike :
2117
2117
return undefined ;
2118
2118
case CompletionKind . ObjectPropertyDeclaration :
2119
2119
// TODO: GH#18169
2120
2120
return { name : JSON . stringify ( name ) , needsConvertPropertyAccess : false } ;
2121
2121
case CompletionKind . PropertyAccess :
2122
+ case CompletionKind . None :
2122
2123
case CompletionKind . Global :
2123
2124
// Don't add a completion for a name starting with a space. See https://github.com/Microsoft/TypeScript/pull/20547
2124
2125
return name . charCodeAt ( 0 ) === CharacterCodes . space ? undefined : { name, needsConvertPropertyAccess : true } ;
0 commit comments