mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 10:59:13 +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(
|
||||
|
|
20
cli/tsc/compiler.d.ts
vendored
20
cli/tsc/compiler.d.ts
vendored
|
@ -36,16 +36,14 @@ declare global {
|
|||
// deno-lint-ignore no-explicit-any
|
||||
jsonOpSync<T>(name: string, params: T): any;
|
||||
ops(): void;
|
||||
print(msg: string): void;
|
||||
print(msg: string, code?: number): void;
|
||||
registerErrorClass(name: string, Ctor: typeof Error): void;
|
||||
}
|
||||
|
||||
type LanguageServerRequest =
|
||||
| ConfigureRequest
|
||||
| GetAsset
|
||||
| GetSyntacticDiagnosticsRequest
|
||||
| GetSemanticDiagnosticsRequest
|
||||
| GetSuggestionDiagnosticsRequest
|
||||
| GetDiagnosticsRequest
|
||||
| GetQuickInfoRequest
|
||||
| GetDocumentHighlightsRequest
|
||||
| GetReferencesRequest
|
||||
|
@ -69,18 +67,8 @@ declare global {
|
|||
specifier: string;
|
||||
}
|
||||
|
||||
interface GetSyntacticDiagnosticsRequest extends BaseLanguageServerRequest {
|
||||
method: "getSyntacticDiagnostics";
|
||||
specifier: string;
|
||||
}
|
||||
|
||||
interface GetSemanticDiagnosticsRequest extends BaseLanguageServerRequest {
|
||||
method: "getSemanticDiagnostics";
|
||||
specifier: string;
|
||||
}
|
||||
|
||||
interface GetSuggestionDiagnosticsRequest extends BaseLanguageServerRequest {
|
||||
method: "getSuggestionDiagnostics";
|
||||
interface GetDiagnosticsRequest extends BaseLanguageServerRequest {
|
||||
method: "getDiagnostics";
|
||||
specifier: string;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue