@@ -17,7 +17,7 @@ import * as editorCommon from 'vs/editor/common/editorCommon';
1717import { EndOfLineSequence , IWordAtPosition } from 'vs/editor/common/model' ;
1818import { IModelChangedEvent , MirrorTextModel as BaseMirrorModel } from 'vs/editor/common/model/mirrorTextModel' ;
1919import { ensureValidWordDefinition , getWordAtText } from 'vs/editor/common/model/wordHelper' ;
20- import { CompletionItem , CompletionItemKind , CompletionList , IInplaceReplaceSupportResult , ILink , TextEdit } from 'vs/editor/common/modes' ;
20+ import { IInplaceReplaceSupportResult , ILink , TextEdit } from 'vs/editor/common/modes' ;
2121import { ILinkComputerTarget , computeLinks } from 'vs/editor/common/modes/linkComputer' ;
2222import { BasicInplaceReplace } from 'vs/editor/common/modes/supports/inplaceReplaceSupport' ;
2323import { IDiffComputationResult } from 'vs/editor/common/services/editorWorkerService' ;
@@ -529,44 +529,38 @@ export class EditorSimpleWorker implements IRequestHandler, IDisposable {
529529
530530 private static readonly _suggestionsLimit = 10000 ;
531531
532- public async textualSuggest ( modelUrl : string , position : IPosition , wordDef : string , wordDefFlags : string ) : Promise < CompletionList | null > {
532+ public async textualSuggest ( modelUrl : string , position : IPosition , wordDef : string , wordDefFlags : string ) : Promise < string [ ] | null > {
533533 const model = this . _getModel ( modelUrl ) ;
534534 if ( ! model ) {
535535 return null ;
536536 }
537537
538- const seen : Record < string , boolean > = Object . create ( null ) ;
539- const suggestions : CompletionItem [ ] = [ ] ;
538+
539+ const words : string [ ] = [ ] ;
540+ const seen = new Set < string > ( ) ;
540541 const wordDefRegExp = new RegExp ( wordDef , wordDefFlags ) ;
541- const wordUntil = model . getWordUntilPosition ( position , wordDefRegExp ) ;
542542
543543 const wordAt = model . getWordAtPosition ( position , wordDefRegExp ) ;
544544 if ( wordAt ) {
545- seen [ model . getValueInRange ( wordAt ) ] = true ;
545+ seen . add ( model . getValueInRange ( wordAt ) ) ;
546546 }
547547
548548 for (
549549 let iter = model . createWordIterator ( wordDefRegExp ) , e = iter . next ( ) ;
550- ! e . done && suggestions . length <= EditorSimpleWorker . _suggestionsLimit ;
550+ ! e . done && seen . size <= EditorSimpleWorker . _suggestionsLimit ;
551551 e = iter . next ( )
552552 ) {
553553 const word = e . value ;
554- if ( seen [ word ] ) {
554+ if ( seen . has ( word ) ) {
555555 continue ;
556556 }
557- seen [ word ] = true ;
557+ seen . add ( word ) ;
558558 if ( ! isNaN ( Number ( word ) ) ) {
559559 continue ;
560560 }
561-
562- suggestions . push ( {
563- kind : CompletionItemKind . Text ,
564- label : word ,
565- insertText : word ,
566- range : { startLineNumber : position . lineNumber , startColumn : wordUntil . startColumn , endLineNumber : position . lineNumber , endColumn : wordUntil . endColumn }
567- } ) ;
561+ words . push ( word ) ;
568562 }
569- return { suggestions } ;
563+ return words ;
570564 }
571565
572566
0 commit comments