Skip to content

Commit f0412c1

Browse files
committed
fix: don't activate plugins' object objectLiteralCompletions before :
chore: fix completions provider
1 parent 93fc923 commit f0412c1

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

typescript/src/completions/objectLiteralCompletions.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { GetConfig } from '../types'
2+
import { sharedCompletionContext } from './sharedContext'
23

34
export 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()!

typescript/src/decorateProxy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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 {

0 commit comments

Comments
 (0)