File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change 1
1
import { GetConfig } from '../types'
2
+ import { sharedCompletionContext } from './sharedContext'
2
3
3
4
export default (
4
5
entries : ts . CompletionEntry [ ] ,
@@ -7,14 +8,17 @@ export default (
7
8
preferences : ts . UserPreferences ,
8
9
c : GetConfig ,
9
10
) : ts . CompletionEntry [ ] | void => {
11
+ const { position } = sharedCompletionContext
12
+
10
13
if ( entries . length && node ) {
11
14
const enableMoreVariants = c ( 'objectLiteralCompletions.moreVariants' )
12
15
const keepOriginal = c ( 'objectLiteralCompletions.keepOriginal' )
13
16
if ( ! preferences . includeCompletionsWithObjectLiteralMethodSnippets && ! enableMoreVariants ) return
14
17
// plans to make it hihgly configurable! e.g. if user wants to make some subtype leading (e.g. from [] | {})
15
18
if ( ts . isIdentifier ( node ) ) node = node . parent
16
19
if ( ts . isShorthandPropertyAssignment ( node ) ) node = node . parent
17
- if ( ! ts . isObjectLiteralExpression ( node ) ) return
20
+ const nextChar = node . getSourceFile ( ) . getFullText ( ) [ position ]
21
+ if ( ! ts . isObjectLiteralExpression ( node ) || nextChar === ':' ) return
18
22
19
23
entries = [ ...entries ]
20
24
const typeChecker = languageService . getProgram ( ) ! . getTypeChecker ( ) !
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ export const decorateLanguageService = (
66
66
options ,
67
67
formatOptions ,
68
68
)
69
- : undefined
69
+ : null
70
70
// handled specialCommand request
71
71
if ( specialCommandResult !== null ) {
72
72
return {
You can’t perform that action at this time.
0 commit comments