@@ -32,6 +32,7 @@ import {
32
32
endsWith ,
33
33
ensureTrailingDirectorySeparator ,
34
34
equateStringsCaseSensitive ,
35
+ escapeString ,
35
36
Extension ,
36
37
fileExtensionIsOneOf ,
37
38
filter ,
@@ -63,6 +64,7 @@ import {
63
64
getSupportedExtensions ,
64
65
getSupportedExtensionsWithJsonIfResolveJsonModule ,
65
66
getTextOfJsxAttributeName ,
67
+ getTextOfNode ,
66
68
getTokenAtPosition ,
67
69
hasIndexSignature ,
68
70
hasProperty ,
@@ -262,8 +264,13 @@ function convertStringLiteralCompletions(
262
264
return { isGlobalCompletion : false , isMemberCompletion : true , isNewIdentifierLocation : completion . hasIndexSignature , optionalReplacementSpan, entries } ;
263
265
}
264
266
case StringLiteralCompletionKind . Types : {
267
+ const quoteChar = contextToken . kind === SyntaxKind . NoSubstitutionTemplateLiteral
268
+ ? CharacterCodes . backtick
269
+ : startsWith ( getTextOfNode ( contextToken ) , "'" )
270
+ ? CharacterCodes . singleQuote
271
+ : CharacterCodes . doubleQuote ;
265
272
const entries = completion . types . map ( type => ( {
266
- name : type . value ,
273
+ name : escapeString ( type . value , quoteChar ) ,
267
274
kindModifiers : ScriptElementKindModifier . none ,
268
275
kind : ScriptElementKind . string ,
269
276
sortText : SortText . LocationPriority ,
0 commit comments