|
1 | 1 | import URI from 'vscode-uri'; |
2 | | -import { empty, iif, from, of, Observable } from 'rxjs'; |
| 2 | +import { iif, from, forkJoin, of, Observable } from 'rxjs'; |
3 | 3 | import { map, mergeMap, switchMap } from 'rxjs/operators'; |
4 | 4 | import { Diagnostic, TextDocument } from 'vscode-languageserver'; |
5 | 5 | import { |
@@ -44,24 +44,23 @@ function getLinter( |
44 | 44 |
|
45 | 45 | function lint(document: TextDocument): Observable<LintResult> { |
46 | 46 | 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 }; |
57 | 51 | }) |
58 | 52 | ); |
59 | 53 | }), |
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 | + ); |
65 | 64 | }) |
66 | 65 | ); |
67 | 66 | } |
|
0 commit comments