File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -252,6 +252,15 @@ export const completionProvider = {
252
252
getTranslations ( ) . items . translations ,
253
253
) . length ;
254
254
255
+ const precedingCharacter = document . getText (
256
+ new vscode . Range (
257
+ position . line ,
258
+ position . character - 1 ,
259
+ position . line ,
260
+ position . character ,
261
+ ) ,
262
+ ) ;
263
+
255
264
return Object . entries ( getTranslations ( ) . items . translations ) . map (
256
265
( [ key , translations ] ) => {
257
266
let completionItem = new vscode . CompletionItem (
@@ -264,6 +273,12 @@ export const completionProvider = {
264
273
wordMatchRegex ,
265
274
) ;
266
275
276
+ if ( precedingCharacter === "'" ) {
277
+ completionItem . insertText = key . replaceAll ( "'" , "\\'" ) ;
278
+ } else if ( precedingCharacter === '"' ) {
279
+ completionItem . insertText = key . replaceAll ( '"' , '\\"' ) ;
280
+ }
281
+
267
282
if ( totalTranslationItems < 200 ) {
268
283
// This will bomb if we have too many translations,
269
284
// 200 is an arbitrary but probably safe number
You can’t perform that action at this time.
0 commit comments