mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 11:35:40 +01:00
Merge remote-tracking branch 'origin/master' into pr/katis/51
This commit is contained in:
commit
9f9255e30e
8 changed files with 57 additions and 11 deletions
|
|
@ -19,7 +19,7 @@ const TYPESCRIPT_LIB_DESTINATION = path.join(__dirname, '../src/lib');
|
|||
importLibs();
|
||||
|
||||
const npmLsOutput = JSON.parse(child_process.execSync("npm ls typescript --depth=0 --json=true").toString());
|
||||
const typeScriptDependencyVersion = npmLsOutput.dependencies.typescript.version;
|
||||
const typeScriptDependencyVersion = '3.5.1';//npmLsOutput.dependencies.typescript.version;
|
||||
|
||||
fs.writeFileSync(
|
||||
path.join(TYPESCRIPT_LIB_DESTINATION, 'typescriptServicesMetadata.ts'),
|
||||
|
|
@ -34,10 +34,22 @@ const TYPESCRIPT_LIB_DESTINATION = path.join(__dirname, '../src/lib');
|
|||
tsServices.replace(/\n ts\.sys =([^]*)\n \}\)\(\);/m, `\n // MONACOCHANGE\n ts.sys = undefined;\n // END MONACOCHANGE`)
|
||||
);
|
||||
|
||||
// Eliminate another require() call...
|
||||
tsServices = (
|
||||
tsServices.replace(/return require\(fileNameToRequire\);/, `// MONACOCHANGE\n return undefined;\n // END MONACOCHANGE`)
|
||||
);
|
||||
// Eliminate more require() calls...
|
||||
tsServices = tsServices.replace(/^( +)etwModule = require\(.*$/m, '$1// MONACOCHANGE\n$1etwModule = undefined;\n$1// END MONACOCHANGE');
|
||||
tsServices = tsServices.replace(/^( +)var result = ts\.sys\.require\(.*$/m, '$1// MONACOCHANGE\n$1var result = undefined;\n$1// END MONACOCHANGE');
|
||||
|
||||
// Flag any new require calls (outside comments) so they can be corrected preemptively.
|
||||
// To avoid missing cases (or using an even more complex regex), temporarily remove comments
|
||||
// about require() and then check for lines actually calling require().
|
||||
// \/[*/] matches the start of a comment (single or multi-line).
|
||||
// ^\s+\*[^/] matches (presumably) a later line of a multi-line comment.
|
||||
const tsServicesNoCommentedRequire = tsServices.replace(/(\/[*/]|^\s+\*[^/]).*\brequire\(.*/gm, '');
|
||||
const linesWithRequire = tsServicesNoCommentedRequire.match(/^.*?\brequire\(.*$/gm);
|
||||
if (linesWithRequire && linesWithRequire.length) {
|
||||
console.error('Found new require() calls on the following lines. These should be removed to avoid breaking webpack builds.\n');
|
||||
console.error(linesWithRequire.join('\n'));
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Make sure process.args don't get called in the browser, this
|
||||
// should only happen in TS 2.6.2
|
||||
|
|
|
|||
|
|
@ -181,6 +181,7 @@ export class DiagnosticsAdapter extends Adapter {
|
|||
}
|
||||
const markers = diagnostics
|
||||
.reduce((p, c) => c.concat(p), [])
|
||||
.filter(d => (this._defaults.getDiagnosticsOptions().diagnosticCodesToIgnore || []).indexOf(d.code) === -1)
|
||||
.map(d => this._convertDiagnostics(resource, d));
|
||||
|
||||
monaco.editor.setModelMarkers(monaco.editor.getModel(resource), this._selector, markers);
|
||||
|
|
@ -200,10 +201,32 @@ export class DiagnosticsAdapter extends Adapter {
|
|||
endLineNumber,
|
||||
endColumn,
|
||||
message: flattenDiagnosticMessageText(diag.messageText, '\n'),
|
||||
code: diag.code.toString()
|
||||
code: diag.code.toString(),
|
||||
tags: diag.reportsUnnecessary ? [monaco.MarkerTag.Unnecessary] : [],
|
||||
relatedInformation: this._convertRelatedInformation(resource, diag.relatedInformation),
|
||||
};
|
||||
}
|
||||
|
||||
private _convertRelatedInformation(resource: Uri, relatedInformation?: ts.DiagnosticRelatedInformation[]): monaco.editor.IRelatedInformation[] {
|
||||
if (relatedInformation === undefined)
|
||||
return undefined;
|
||||
|
||||
return relatedInformation.map(info => {
|
||||
const relatedResource = info.file === undefined ? resource : monaco.Uri.parse(info.file.fileName);
|
||||
const { lineNumber: startLineNumber, column: startColumn } = this._offsetToPosition(relatedResource, info.start);
|
||||
const { lineNumber: endLineNumber, column: endColumn } = this._offsetToPosition(relatedResource, info.start + info.length);
|
||||
|
||||
return {
|
||||
resource: relatedResource,
|
||||
startLineNumber,
|
||||
startColumn,
|
||||
endLineNumber,
|
||||
endColumn,
|
||||
message: flattenDiagnosticMessageText(info.messageText, '\n')
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
private _tsDiagnosticCategoryToMarkerSeverity(category: ts.DiagnosticCategory): monaco.MarkerSeverity {
|
||||
switch (category) {
|
||||
case ts.DiagnosticCategory.Error: return monaco.MarkerSeverity.Error
|
||||
|
|
|
|||
|
|
@ -2349,7 +2349,9 @@ var ts;
|
|||
try {
|
||||
if (ts.sys && ts.sys.require) {
|
||||
var basePath = ts.getDirectoryPath(ts.resolvePath(ts.sys.getExecutingFilePath()));
|
||||
var result = ts.sys.require(basePath, "./compiler-debug");
|
||||
// MONACOCHANGE
|
||||
var result = undefined;
|
||||
// END MONACOCHANGE
|
||||
if (!result.error) {
|
||||
result.module.init(ts);
|
||||
extendedDebugModule = result.module;
|
||||
|
|
@ -2515,7 +2517,9 @@ var ts;
|
|||
try {
|
||||
// require() will throw an exception if the module is not installed
|
||||
// It may also return undefined if not installed properly
|
||||
etwModule = require("@microsoft/typescript-etw");
|
||||
// MONACOCHANGE
|
||||
etwModule = undefined;
|
||||
// END MONACOCHANGE
|
||||
}
|
||||
catch (e) {
|
||||
etwModule = undefined;
|
||||
|
|
|
|||
|
|
@ -2349,7 +2349,9 @@ var ts;
|
|||
try {
|
||||
if (ts.sys && ts.sys.require) {
|
||||
var basePath = ts.getDirectoryPath(ts.resolvePath(ts.sys.getExecutingFilePath()));
|
||||
var result = ts.sys.require(basePath, "./compiler-debug");
|
||||
// MONACOCHANGE
|
||||
var result = undefined;
|
||||
// END MONACOCHANGE
|
||||
if (!result.error) {
|
||||
result.module.init(ts);
|
||||
extendedDebugModule = result.module;
|
||||
|
|
@ -2515,7 +2517,9 @@ var ts;
|
|||
try {
|
||||
// require() will throw an exception if the module is not installed
|
||||
// It may also return undefined if not installed properly
|
||||
etwModule = require("@microsoft/typescript-etw");
|
||||
// MONACOCHANGE
|
||||
etwModule = undefined;
|
||||
// END MONACOCHANGE
|
||||
}
|
||||
catch (e) {
|
||||
etwModule = undefined;
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
export const typescriptVersion = "3.7.2";
|
||||
export const typescriptVersion = "3.5.1";
|
||||
|
|
|
|||
1
src/monaco.d.ts
vendored
1
src/monaco.d.ts
vendored
|
|
@ -129,6 +129,7 @@ declare module monaco.languages.typescript {
|
|||
noSemanticValidation?: boolean;
|
||||
noSyntaxValidation?: boolean;
|
||||
noSuggestionDiagnostics?: boolean;
|
||||
diagnosticCodesToIgnore?: number[];
|
||||
}
|
||||
|
||||
export interface LanguageServiceDefaults {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
"compilerOptions": {
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"declaration": true,
|
||||
"outDir": "../release/esm",
|
||||
"target": "es5",
|
||||
"lib": [
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
"module": "amd",
|
||||
"moduleResolution": "node",
|
||||
"outDir": "../release/dev",
|
||||
"declaration": true,
|
||||
"target": "es5",
|
||||
"lib": [
|
||||
"dom",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue