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

Commit ca78b58

Browse files
committed
Reduce lint/format output to a single value. resolves #435, resolves #443
1 parent 27c958e commit ca78b58

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

server/src/formatters/BaseFormatter.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Position, Range, TextDocument, TextEdit } from 'vscode-languageserver';
22
import { spawn } from 'spawn-rx';
33
import { of, Observable, throwError } from 'rxjs';
4-
import { map, catchError } from 'rxjs/operators';
4+
import { catchError, map, reduce } from 'rxjs/operators';
55
import {
66
diff_match_patch as DiffMatchPatch,
77
Diff,
@@ -74,9 +74,8 @@ export default abstract class BaseFormatter implements IFormatter {
7474
const err: Error | null = this.processError(error, formatStr);
7575
return err ? throwError(err) : of('');
7676
}),
77-
map((result: string) => {
78-
return this.processResults(result);
79-
})
77+
reduce((acc: string, value: string) => acc + value, ''),
78+
map((result: string) => this.processResults(result))
8079
);
8180
}
8281

server/src/linters/BaseLinter.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Diagnostic, TextDocument } from 'vscode-languageserver';
22
import { spawn } from 'spawn-rx';
33
import { of, Observable, empty } from 'rxjs';
4-
import { map, catchError } from 'rxjs/operators';
4+
import { catchError, map, reduce } from 'rxjs/operators';
55
import { IEnvironment, RubyCommandConfiguration } from '../SettingsCache';
66

77
export interface ILinter {
@@ -54,7 +54,8 @@ export default abstract class BaseLinter implements ILinter {
5454
this.processError(error);
5555
return empty();
5656
}),
57-
map(result => this.processResults(result))
57+
reduce((acc: string, value: string) => acc + value, ''),
58+
map((result: string) => this.processResults(result))
5859
);
5960
}
6061

0 commit comments

Comments
 (0)