@@ -3,7 +3,7 @@ import type tslib from 'typescript/lib/tsserverlibrary'
3
3
// import * as emmet from '@vscode/emmet-helper'
4
4
import isInBannedPosition from './completions/isInBannedPosition'
5
5
import { GetConfig } from './types'
6
- import { findChildContainingPosition } from './utils'
6
+ import { findChildContainingExactPosition , findChildContainingPosition } from './utils'
7
7
import indexSignatureAccessCompletions from './completions/indexSignatureAccess'
8
8
import fixPropertiesSorting from './completions/fixPropertiesSorting'
9
9
import { isGoodPositionBuiltinMethodCompletion } from './completions/isGoodPositionMethodCompletion'
@@ -49,7 +49,7 @@ export const getCompletionsAtPosition = (
49
49
/** node that is one character behind
50
50
* useful as in most cases we work with node that is behind the cursor */
51
51
const leftNode = findChildContainingPosition ( ts , sourceFile , position - 1 )
52
- const tokenAtPosition = tsFull . getTokenAtPosition ( sourceFile as any , position ) as ts . Node
52
+ const exactNode = findChildContainingExactPosition ( sourceFile , position )
53
53
if ( [ '.jsx' , '.tsx' ] . some ( ext => fileName . endsWith ( ext ) ) ) {
54
54
// #region JSX tag improvements
55
55
if ( node ) {
@@ -160,7 +160,7 @@ export const getCompletionsAtPosition = (
160
160
} )
161
161
162
162
if ( c ( 'suggestions.keywordsInsertText' ) === 'space' ) {
163
- prior . entries = keywordsSpace ( prior . entries , scriptSnapshot , position , tokenAtPosition )
163
+ prior . entries = keywordsSpace ( prior . entries , scriptSnapshot , position , exactNode )
164
164
}
165
165
166
166
if ( leftNode && c ( 'switchExcludeCoveredCases' ) ) prior . entries = switchCaseExcludeCovered ( prior . entries , position , sourceFile , leftNode ) ?? prior . entries
0 commit comments