mirror of
https://github.com/microsoft/monaco-editor.git
synced 2024-11-25 16:35:44 +08:00
Merge pull request #4482 from jakebailey/emit-file-diagnostics
Call clearFiles on internal EmitOutput diagnostics, pass args down
This commit is contained in:
commit
c49fdf9f0c
@ -216,9 +216,10 @@ export interface DiagnosticRelatedInformation {
|
||||
messageText: string | DiagnosticMessageChain;
|
||||
}
|
||||
|
||||
interface EmitOutput {
|
||||
export interface EmitOutput {
|
||||
outputFiles: OutputFile[];
|
||||
emitSkipped: boolean;
|
||||
diagnostics?: Diagnostic[];
|
||||
}
|
||||
interface OutputFile {
|
||||
name: string;
|
||||
@ -521,7 +522,11 @@ export interface TypeScriptWorker {
|
||||
* Get transpiled output for the given file.
|
||||
* @returns `typescript.EmitOutput`
|
||||
*/
|
||||
getEmitOutput(fileName: string): Promise<EmitOutput>;
|
||||
getEmitOutput(
|
||||
fileName: string,
|
||||
emitOnlyDtsFiles?: boolean,
|
||||
forceDtsEmit?: boolean
|
||||
): Promise<EmitOutput>;
|
||||
|
||||
/**
|
||||
* Get possible code fixes at the given position in the file.
|
||||
|
@ -8,6 +8,7 @@ import { libFileMap } from './lib/lib';
|
||||
import {
|
||||
Diagnostic,
|
||||
DiagnosticRelatedInformation,
|
||||
EmitOutput,
|
||||
IExtraLibs,
|
||||
TypeScriptWorker as ITypeScriptWorker
|
||||
} from './monaco.contribution';
|
||||
@ -401,11 +402,26 @@ export class TypeScriptWorker implements ts.LanguageServiceHost, ITypeScriptWork
|
||||
return this._languageService.getRenameInfo(fileName, position, options);
|
||||
}
|
||||
|
||||
async getEmitOutput(fileName: string): Promise<ts.EmitOutput> {
|
||||
async getEmitOutput(
|
||||
fileName: string,
|
||||
emitOnlyDtsFiles?: boolean,
|
||||
forceDtsEmit?: boolean
|
||||
): Promise<EmitOutput> {
|
||||
if (fileNameIsLib(fileName)) {
|
||||
return { outputFiles: [], emitSkipped: true };
|
||||
}
|
||||
return this._languageService.getEmitOutput(fileName);
|
||||
// The diagnostics property is internal, returning it without clearing breaks message serialization.
|
||||
const emitOutput = this._languageService.getEmitOutput(
|
||||
fileName,
|
||||
emitOnlyDtsFiles,
|
||||
forceDtsEmit
|
||||
) as ts.EmitOutput & {
|
||||
diagnostics?: ts.Diagnostic[];
|
||||
};
|
||||
const diagnostics = emitOutput.diagnostics
|
||||
? TypeScriptWorker.clearFiles(emitOutput.diagnostics)
|
||||
: undefined;
|
||||
return { ...emitOutput, diagnostics };
|
||||
}
|
||||
|
||||
async getCodeFixesAtPosition(
|
||||
|
Loading…
Reference in New Issue
Block a user