@@ -27,6 +27,7 @@ import addSourceDefinition from './completions/addSourceDefinition'
2727import { sharedCompletionContext } from './completions/sharedContext'
2828import displayImportedInfo from './completions/displayImportedInfo'
2929import changeKindToFunction from './completions/changeKindToFunction'
30+ import functionPropsAndMethods from './completions/functionPropsAndMethods'
3031
3132export type PrevCompletionMap = Record <
3233 string ,
@@ -183,32 +184,7 @@ export const getCompletionsAtPosition = (
183184 prior . entries = fixPropertiesSorting ( prior . entries ) ?? prior . entries
184185 if ( node ) prior . entries = boostKeywordSuggestions ( prior . entries , position , node ) ?? prior . entries
185186
186- const entryNames = new Set ( prior . entries . map ( ( { name } ) => name ) )
187- if ( c ( 'removeUselessFunctionProps.enable' ) ) {
188- prior . entries = prior . entries . filter ( entry => {
189- if ( oneOf ( entry . kind , ts . ScriptElementKind . warning ) ) return true
190- return ! [ 'Symbol' , 'caller' , 'prototype' ] . includes ( entry . name )
191- } )
192- }
193- if ( [ 'bind' , 'call' , 'caller' ] . every ( name => entryNames . has ( name ) ) && c ( 'highlightNonFunctionMethods.enable' ) ) {
194- const standardProps = new Set ( [ 'Symbol' , 'apply' , 'arguments' , 'bind' , 'call' , 'caller' , 'length' , 'name' , 'prototype' , 'toString' ] )
195- // TODO lift up!
196- prior . entries = prior . entries . map ( entry => {
197- if ( ! standardProps . has ( entry . name ) && entry . kind !== ts . ScriptElementKind . warning ) {
198- const newName = `☆${ entry . name } `
199- prevCompletionsMap [ newName ] = {
200- originalName : entry . name ,
201- }
202- return {
203- ...entry ,
204- insertText : entry . insertText ?? entry . name ,
205- name : newName ,
206- }
207- }
208-
209- return entry
210- } )
211- }
187+ prior . entries = functionPropsAndMethods ( prior . entries )
212188
213189 // if (c('completionHelpers') && node) prior.entries = objectLiteralHelpers(node, prior.entries) ?? prior.entries
214190
0 commit comments