Skip to content
This repository was archived by the owner on Jul 31, 2023. It is now read-only.

Commit 327afd3

Browse files
committed
Fix multiple linter output not showing up at the same time. Resolves #524
Also resolves a deprecated selector function being used in mergeMap
1 parent aa43f9f commit 327afd3

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

packages/language-server-ruby/src/Linter.ts

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import URI from 'vscode-uri';
2-
import { empty, iif, from, of, Observable } from 'rxjs';
2+
import { iif, from, forkJoin, of, Observable } from 'rxjs';
33
import { map, mergeMap, switchMap } from 'rxjs/operators';
44
import { Diagnostic, TextDocument } from 'vscode-languageserver';
55
import {
@@ -44,24 +44,23 @@ function getLinter(
4444

4545
function lint(document: TextDocument): Observable<LintResult> {
4646
return from(documentConfigurationCache.get(document)).pipe(
47-
mergeMap(
48-
config => workspaceRubyEnvironmentCache.get(config.workspaceFolderUri),
49-
(config, env) => {
50-
return { config, env };
51-
}
52-
),
53-
switchMap(({ config, env }) => {
54-
return from(Object.keys(config.lint)).pipe(
55-
mergeMap(l => {
56-
return config.lint[l] ? getLinter(l, document, env, config).lint() : empty();
47+
mergeMap(config => {
48+
return from(workspaceRubyEnvironmentCache.get(config.workspaceFolderUri)).pipe(
49+
map(env => {
50+
return { config, env };
5751
})
5852
);
5953
}),
60-
map(diagnostics => {
61-
return {
62-
document,
63-
diagnostics,
64-
};
54+
mergeMap(({ config, env }) => {
55+
const linters = Object.keys(config.lint).map(l => getLinter(l, document, env, config).lint());
56+
return forkJoin(linters).pipe(
57+
map(diagnostics => {
58+
return {
59+
document,
60+
diagnostics: diagnostics.flat(),
61+
};
62+
})
63+
);
6564
})
6665
);
6766
}

packages/tsconfig.base.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
"noUnusedParameters": true,
77
"sourceMap": true,
88
"esModuleInterop": true,
9-
"lib": ["dom", "es2017", "es2019.string"]
9+
"lib": ["dom", "es2017", "es2019.string", "esnext.array"]
1010
}
1111
}

0 commit comments

Comments
 (0)