mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 02:48:24 +00:00
parent
268e47c0d8
commit
e8a81724bb
6 changed files with 109 additions and 74 deletions
|
@ -31,10 +31,22 @@ delete Object.prototype.__proto__;
|
|||
const stringifiedArgs = args.map((arg) =>
|
||||
typeof arg === "string" ? arg : JSON.stringify(arg)
|
||||
).join(" ");
|
||||
core.print(`DEBUG ${logSource} - ${stringifiedArgs}\n`);
|
||||
// adding a non-zero integer value to the end of the debug string causes
|
||||
// the message to be printed to stderr instead of stdout, which is better
|
||||
// aligned to the behaviour of debug messages
|
||||
core.print(`DEBUG ${logSource} - ${stringifiedArgs}\n`, 1);
|
||||
}
|
||||
}
|
||||
|
||||
function error(...args) {
|
||||
const stringifiedArgs = args.map((arg) =>
|
||||
typeof arg === "string" || arg instanceof Error
|
||||
? String(arg)
|
||||
: JSON.stringify(arg)
|
||||
).join(" ");
|
||||
core.print(`ERROR ${logSource} = ${stringifiedArgs}\n`, 1);
|
||||
}
|
||||
|
||||
class AssertionError extends Error {
|
||||
constructor(msg) {
|
||||
super(msg);
|
||||
|
@ -497,23 +509,18 @@ delete Object.prototype.__proto__;
|
|||
);
|
||||
return respond(id, sourceFile && sourceFile.text);
|
||||
}
|
||||
case "getSemanticDiagnostics": {
|
||||
const diagnostics = languageService.getSemanticDiagnostics(
|
||||
request.specifier,
|
||||
).filter(({ code }) => !IGNORED_DIAGNOSTICS.includes(code));
|
||||
return respond(id, fromTypeScriptDiagnostic(diagnostics));
|
||||
}
|
||||
case "getSuggestionDiagnostics": {
|
||||
const diagnostics = languageService.getSuggestionDiagnostics(
|
||||
request.specifier,
|
||||
).filter(({ code }) => !IGNORED_DIAGNOSTICS.includes(code));
|
||||
return respond(id, fromTypeScriptDiagnostic(diagnostics));
|
||||
}
|
||||
case "getSyntacticDiagnostics": {
|
||||
const diagnostics = languageService.getSyntacticDiagnostics(
|
||||
request.specifier,
|
||||
).filter(({ code }) => !IGNORED_DIAGNOSTICS.includes(code));
|
||||
return respond(id, fromTypeScriptDiagnostic(diagnostics));
|
||||
case "getDiagnostics": {
|
||||
try {
|
||||
const diagnostics = [
|
||||
...languageService.getSemanticDiagnostics(request.specifier),
|
||||
...languageService.getSuggestionDiagnostics(request.specifier),
|
||||
...languageService.getSyntacticDiagnostics(request.specifier),
|
||||
].filter(({ code }) => !IGNORED_DIAGNOSTICS.includes(code));
|
||||
return respond(id, fromTypeScriptDiagnostic(diagnostics));
|
||||
} catch (e) {
|
||||
error(e);
|
||||
return respond(id, []);
|
||||
}
|
||||
}
|
||||
case "getQuickInfo": {
|
||||
return respond(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue