@@ -27,6 +27,7 @@ import addSourceDefinition from './completions/addSourceDefinition'
27
27
import { sharedCompletionContext } from './completions/sharedContext'
28
28
import displayImportedInfo from './completions/displayImportedInfo'
29
29
import changeKindToFunction from './completions/changeKindToFunction'
30
+ import functionPropsAndMethods from './completions/functionPropsAndMethods'
30
31
31
32
export type PrevCompletionMap = Record <
32
33
string ,
@@ -183,32 +184,7 @@ export const getCompletionsAtPosition = (
183
184
prior . entries = fixPropertiesSorting ( prior . entries ) ?? prior . entries
184
185
if ( node ) prior . entries = boostKeywordSuggestions ( prior . entries , position , node ) ?? prior . entries
185
186
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 )
212
188
213
189
// if (c('completionHelpers') && node) prior.entries = objectLiteralHelpers(node, prior.entries) ?? prior.entries
214
190
0 commit comments