Skip to content

Commit 2c2afcd

Browse files
authored
fix: pluginHost low/smart null check (#2979)
1 parent 11bc4bc commit 2c2afcd

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

packages/language-server/src/plugins/PluginHost.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -266,14 +266,13 @@ export class PluginHost implements LSProvider, OnWatchFileChanges {
266266
async getDocumentColors(textDocument: TextDocumentIdentifier): Promise<ColorInformation[]> {
267267
const document = this.getDocument(textDocument.uri);
268268

269-
return (
270-
await this.execute<ColorInformation[]>(
271-
'getDocumentColors',
272-
[document],
273-
ExecuteMode.Collect,
274-
'low'
275-
)
276-
).flat();
269+
const result = await this.execute<ColorInformation[]>(
270+
'getDocumentColors',
271+
[document],
272+
ExecuteMode.Collect,
273+
'low'
274+
);
275+
return result?.flat() ?? [];
277276
}
278277

279278
async getColorPresentations(
@@ -697,7 +696,7 @@ export class PluginHost implements LSProvider, OnWatchFileChanges {
697696
ExecuteMode.Collect,
698697
'smart'
699698
);
700-
return result.filter(Boolean).flat();
699+
return result?.filter(Boolean).flat();
701700
}
702701

703702
async getFoldingRanges(textDocument: TextDocumentIdentifier): Promise<FoldingRange[]> {

0 commit comments

Comments
 (0)