Skip to content

Commit 01a8ef7

Browse files
committed
Trim file+location line before parsing
See #71 (comment)
1 parent 4019b0b commit 01a8ef7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

server/src/utils.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,9 @@ let parseFileAndRange = (fileAndRange: string) => {
194194
endLineOrChar,
195195
_colonPlusEndCharOrNothing,
196196
endCharOrNothing,
197-
] = fileAndRange.match(regex)!;
197+
] = fileAndRange.trim().match(regex)!;
198+
// for the trimming, see https://github.com/rescript-lang/rescript-vscode/pull/71#issuecomment-769160576
199+
198200
// language-server position is 0-based. Ours is 1-based. Convert
199201
// also, our end character is inclusive. Language-server's is exclusive
200202
let range;
@@ -307,7 +309,7 @@ export let parseCompilerLogOutput = (
307309
let result: filesDiagnostics = {};
308310
parsedDiagnostics.forEach((parsedDiagnostic) => {
309311
let [fileAndRangeLine, ...diagnosticMessage] = parsedDiagnostic.content;
310-
let { file, range } = parseFileAndRange(fileAndRangeLine.slice(2));
312+
let { file, range } = parseFileAndRange(fileAndRangeLine);
311313

312314
if (result[file] == null) {
313315
result[file] = [];

0 commit comments

Comments
 (0)