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 11import { GetConfig } from '../types'
2+ import { sharedCompletionContext } from './sharedContext'
23
34export default (
45 entries : ts . CompletionEntry [ ] ,
@@ -7,14 +8,17 @@ export default (
78 preferences : ts . UserPreferences ,
89 c : GetConfig ,
910) : ts . CompletionEntry [ ] | void => {
11+ const { position } = sharedCompletionContext
12+
1013 if ( entries . length && node ) {
1114 const enableMoreVariants = c ( 'objectLiteralCompletions.moreVariants' )
1215 const keepOriginal = c ( 'objectLiteralCompletions.keepOriginal' )
1316 if ( ! preferences . includeCompletionsWithObjectLiteralMethodSnippets && ! enableMoreVariants ) return
1417 // plans to make it hihgly configurable! e.g. if user wants to make some subtype leading (e.g. from [] | {})
1518 if ( ts . isIdentifier ( node ) ) node = node . parent
1619 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
1822
1923 entries = [ ...entries ]
2024 const typeChecker = languageService . getProgram ( ) ! . getTypeChecker ( ) !
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ export const decorateLanguageService = (
6666 options ,
6767 formatOptions ,
6868 )
69- : undefined
69+ : null
7070 // handled specialCommand request
7171 if ( specialCommandResult !== null ) {
7272 return {
You can’t perform that action at this time.
0 commit comments