Skip to content

Commit 21140d9

Browse files
committedSep 19, 2020
Temporarily disable formatting error fallback diagnostic
See previous commit's CONTRIBUTING.md
1 parent e2ee88b commit 21140d9

File tree

2 files changed

+13
-41
lines changed

2 files changed

+13
-41
lines changed
 

‎server/src/server.ts

+4-32
Original file line numberDiff line numberDiff line change
@@ -257,19 +257,6 @@ process.on('message', (a: (m.RequestMessage | m.NotificationMessage)) => {
257257
result: result,
258258
};
259259
process.send!(response);
260-
261-
// TODO: make sure the diagnostic diffing takes this into account
262-
if (!utils.compilerLogPresentAndNotEmpty(filePath)) {
263-
let params2: p.PublishDiagnosticsParams = {
264-
uri: params.textDocument.uri,
265-
diagnostics: [],
266-
}
267-
let notification: m.NotificationMessage = {
268-
jsonrpc: c.jsonrpcVersion,
269-
method: 'textDocument/publishDiagnostics',
270-
params: params2,
271-
};
272-
}
273260
} else {
274261
let response: m.ResponseMessage = {
275262
jsonrpc: c.jsonrpcVersion,
@@ -278,32 +265,17 @@ process.on('message', (a: (m.RequestMessage | m.NotificationMessage)) => {
278265
// technically a formatting failure should return the error but
279266
// since this is LSP... the idiom seems to be to silently return
280267
// nothing (to avoid an alert window each time on bad formatting)
281-
// while sending a diangosis about the error afterward
268+
// while sending a diagnostic about the error afterward. We won't
269+
// send an extra diagnostic because the .compiler.log watcher
270+
// should have reported th won't send an extra diagnostic because
271+
// theiler.log watcher should have reported them.
282272

283273
// error: {
284274
// code: m.ErrorCodes.ParseError,
285275
// message: formattedResult.error,
286276
// }
287277
};
288278
process.send!(response);
289-
290-
if (!utils.compilerLogPresentAndNotEmpty(filePath)) {
291-
let filesAndErrors = utils.parseCompilerLogOutput(formattedResult.error, ":")
292-
Object.keys(filesAndErrors).forEach(file => {
293-
let params2: p.PublishDiagnosticsParams = {
294-
uri: params.textDocument.uri,
295-
// there's a new optional version param from https://github.com/microsoft/language-server-protocol/issues/201
296-
// not using it for now, sigh
297-
diagnostics: filesAndErrors[file],
298-
}
299-
let notification: m.NotificationMessage = {
300-
jsonrpc: c.jsonrpcVersion,
301-
method: 'textDocument/publishDiagnostics',
302-
params: params2,
303-
};
304-
process.send!(notification);
305-
})
306-
}
307279
}
308280
}
309281
}

‎server/src/utils.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ export let findDirOfFileNearFile = (fileToFind: p.DocumentUri, source: p.Documen
2323
}
2424
}
2525

26-
export let compilerLogPresentAndNotEmpty = (filePath: string) => {
27-
let compilerLogDir = findDirOfFileNearFile(c.compilerLogPartialPath, filePath)
28-
if (compilerLogDir == null) {
29-
return false
30-
} else {
31-
let compilerLogPath = path.join(compilerLogDir, c.compilerLogPartialPath);
32-
return fs.statSync(compilerLogPath).size > 0
33-
}
34-
}
26+
// export let compilerLogPresentAndNotEmpty = (filePath: string) => {
27+
// let compilerLogDir = findDirOfFileNearFile(c.compilerLogPartialPath, filePath)
28+
// if (compilerLogDir == null) {
29+
// return false
30+
// } else {
31+
// let compilerLogPath = path.join(compilerLogDir, c.compilerLogPartialPath);
32+
// return fs.statSync(compilerLogPath).size > 0
33+
// }
34+
// }
3535

3636
type formattingResult = {
3737
kind: 'success',

0 commit comments

Comments
 (0)