File tree 1 file changed +24
-3
lines changed
1 file changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -208,10 +208,31 @@ export = function ({ typescript }: { typescript: typeof import('typescript/lib/t
208
208
209
209
if ( c ( 'suggestions.keywordsInsertText' ) === 'space' ) {
210
210
const charAhead = scriptSnapshot . getText ( position , position + 1 )
211
+ const bannedKeywords = [
212
+ 'true' ,
213
+ 'false' ,
214
+ 'undefined' ,
215
+ 'null' ,
216
+ 'never' ,
217
+ 'unknown' ,
218
+ 'any' ,
219
+ 'symbol' ,
220
+ 'string' ,
221
+ 'number' ,
222
+ 'boolean' ,
223
+ 'object' ,
224
+ 'this' ,
225
+ 'catch' ,
226
+ 'constructor' ,
227
+ 'continue' ,
228
+ 'break' ,
229
+ 'debugger' ,
230
+ 'default' ,
231
+ 'super' ,
232
+ ]
211
233
prior . entries = prior . entries . map ( entry => {
212
- if ( entry . kind !== ts . ScriptElementKind . keyword ) return entry
213
- entry . insertText = charAhead === ' ' ? entry . name : `${ entry . name } `
214
- return entry
234
+ if ( entry . kind !== ts . ScriptElementKind . keyword || charAhead === ' ' || bannedKeywords . includes ( entry . name ) ) return entry
235
+ return { ...entry , insertText : `${ entry . name } ` }
215
236
} )
216
237
}
217
238
You can’t perform that action at this time.
0 commit comments