@@ -3,8 +3,8 @@ import { getCannotFindCodes } from '../utils/cannotFindCodes'
3
3
4
4
const cannotFindCodes = getCannotFindCodes ( { includeFromLib : true } )
5
5
6
- // 1. add suggestions for unresolved indentifiers in code
7
- // 2. boost identifer or type name suggestion
6
+ // 1. add suggestions for unresolved identifiers in code
7
+ // 2. boost identifier or type name suggestion
8
8
export default (
9
9
entries : ts . CompletionEntry [ ] ,
10
10
position : number ,
@@ -17,35 +17,7 @@ export default (
17
17
const fileText = sourceFile . getFullText ( )
18
18
const fileTextBeforePos = fileText . slice ( 0 , position )
19
19
const beforeConstNodeOffset = fileTextBeforePos . match ( / (?: c o n s t | l e t ) ( [ \w \d ] * ) $ / i) ?. [ 1 ]
20
- const nodeWithStatements = node => {
21
- return node && 'statements' in node && Array . isArray ( node . statements ) ? node : undefined
22
- }
23
- const statementsNode = nodeWithStatements ( node ) || nodeWithStatements ( node . parent )
24
- // Workaround for current locality bonus & TS 5.1
25
- if (
26
- statementsNode &&
27
- // ensure completions are not blocked
28
- entries . length > 0
29
- ) {
30
- const statements = statementsNode . statements as any [ ]
31
- const prevNode =
32
- statementsNode === node
33
- ? [ ...statements ] . reverse ( ) . find ( ( statement : ts . Node ) => statement . pos + statement . getLeadingTriviaWidth ( ) < position )
34
- : statements [ statements . indexOf ( node ) - 1 ]
35
- if ( prevNode && ts . isVariableStatement ( prevNode ) && prevNode . declarationList . declarations . length === 1 ) {
36
- const { name } = prevNode . declarationList . declarations [ 0 ] !
37
- if ( ts . isIdentifier ( name ) ) {
38
- const kind : ts . ScriptElementKind =
39
- prevNode . declarationList . flags & ts . NodeFlags . Const ? ts . ScriptElementKind . constElement : ts . ScriptElementKind . letElement
40
- entries = boostOrAddSuggestions ( entries , [
41
- {
42
- name : name . text ,
43
- kind,
44
- } ,
45
- ] )
46
- }
47
- }
48
- }
20
+
49
21
/** false - pick all identifiers after cursor
50
22
* node - pick identifiers that within node */
51
23
let filterBlock : undefined | false | ts . Node
0 commit comments