mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 17:25:39 +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();
|
importLibs();
|
||||||
|
|
||||||
const npmLsOutput = JSON.parse(child_process.execSync("npm ls typescript --depth=0 --json=true").toString());
|
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(
|
fs.writeFileSync(
|
||||||
path.join(TYPESCRIPT_LIB_DESTINATION, 'typescriptServicesMetadata.ts'),
|
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`)
|
tsServices.replace(/\n ts\.sys =([^]*)\n \}\)\(\);/m, `\n // MONACOCHANGE\n ts.sys = undefined;\n // END MONACOCHANGE`)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Eliminate another require() call...
|
// Eliminate more require() calls...
|
||||||
tsServices = (
|
tsServices = tsServices.replace(/^( +)etwModule = require\(.*$/m, '$1// MONACOCHANGE\n$1etwModule = undefined;\n$1// END MONACOCHANGE');
|
||||||
tsServices.replace(/return require\(fileNameToRequire\);/, `// MONACOCHANGE\n return undefined;\n // 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
|
// Make sure process.args don't get called in the browser, this
|
||||||
// should only happen in TS 2.6.2
|
// should only happen in TS 2.6.2
|
||||||
|
|
|
||||||
|
|
@ -181,6 +181,7 @@ export class DiagnosticsAdapter extends Adapter {
|
||||||
}
|
}
|
||||||
const markers = diagnostics
|
const markers = diagnostics
|
||||||
.reduce((p, c) => c.concat(p), [])
|
.reduce((p, c) => c.concat(p), [])
|
||||||
|
.filter(d => (this._defaults.getDiagnosticsOptions().diagnosticCodesToIgnore || []).indexOf(d.code) === -1)
|
||||||
.map(d => this._convertDiagnostics(resource, d));
|
.map(d => this._convertDiagnostics(resource, d));
|
||||||
|
|
||||||
monaco.editor.setModelMarkers(monaco.editor.getModel(resource), this._selector, markers);
|
monaco.editor.setModelMarkers(monaco.editor.getModel(resource), this._selector, markers);
|
||||||
|
|
@ -200,10 +201,32 @@ export class DiagnosticsAdapter extends Adapter {
|
||||||
endLineNumber,
|
endLineNumber,
|
||||||
endColumn,
|
endColumn,
|
||||||
message: flattenDiagnosticMessageText(diag.messageText, '\n'),
|
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 {
|
private _tsDiagnosticCategoryToMarkerSeverity(category: ts.DiagnosticCategory): monaco.MarkerSeverity {
|
||||||
switch (category) {
|
switch (category) {
|
||||||
case ts.DiagnosticCategory.Error: return monaco.MarkerSeverity.Error
|
case ts.DiagnosticCategory.Error: return monaco.MarkerSeverity.Error
|
||||||
|
|
|
||||||
|
|
@ -2349,7 +2349,9 @@ var ts;
|
||||||
try {
|
try {
|
||||||
if (ts.sys && ts.sys.require) {
|
if (ts.sys && ts.sys.require) {
|
||||||
var basePath = ts.getDirectoryPath(ts.resolvePath(ts.sys.getExecutingFilePath()));
|
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) {
|
if (!result.error) {
|
||||||
result.module.init(ts);
|
result.module.init(ts);
|
||||||
extendedDebugModule = result.module;
|
extendedDebugModule = result.module;
|
||||||
|
|
@ -2515,7 +2517,9 @@ var ts;
|
||||||
try {
|
try {
|
||||||
// require() will throw an exception if the module is not installed
|
// require() will throw an exception if the module is not installed
|
||||||
// It may also return undefined if not installed properly
|
// It may also return undefined if not installed properly
|
||||||
etwModule = require("@microsoft/typescript-etw");
|
// MONACOCHANGE
|
||||||
|
etwModule = undefined;
|
||||||
|
// END MONACOCHANGE
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
etwModule = undefined;
|
etwModule = undefined;
|
||||||
|
|
|
||||||
|
|
@ -2349,7 +2349,9 @@ var ts;
|
||||||
try {
|
try {
|
||||||
if (ts.sys && ts.sys.require) {
|
if (ts.sys && ts.sys.require) {
|
||||||
var basePath = ts.getDirectoryPath(ts.resolvePath(ts.sys.getExecutingFilePath()));
|
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) {
|
if (!result.error) {
|
||||||
result.module.init(ts);
|
result.module.init(ts);
|
||||||
extendedDebugModule = result.module;
|
extendedDebugModule = result.module;
|
||||||
|
|
@ -2515,7 +2517,9 @@ var ts;
|
||||||
try {
|
try {
|
||||||
// require() will throw an exception if the module is not installed
|
// require() will throw an exception if the module is not installed
|
||||||
// It may also return undefined if not installed properly
|
// It may also return undefined if not installed properly
|
||||||
etwModule = require("@microsoft/typescript-etw");
|
// MONACOCHANGE
|
||||||
|
etwModule = undefined;
|
||||||
|
// END MONACOCHANGE
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
etwModule = undefined;
|
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;
|
noSemanticValidation?: boolean;
|
||||||
noSyntaxValidation?: boolean;
|
noSyntaxValidation?: boolean;
|
||||||
noSuggestionDiagnostics?: boolean;
|
noSuggestionDiagnostics?: boolean;
|
||||||
|
diagnosticCodesToIgnore?: number[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface LanguageServiceDefaults {
|
export interface LanguageServiceDefaults {
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"module": "esnext",
|
"module": "esnext",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
|
"declaration": true,
|
||||||
"outDir": "../release/esm",
|
"outDir": "../release/esm",
|
||||||
"target": "es5",
|
"target": "es5",
|
||||||
"lib": [
|
"lib": [
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
"module": "amd",
|
"module": "amd",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"outDir": "../release/dev",
|
"outDir": "../release/dev",
|
||||||
|
"declaration": true,
|
||||||
"target": "es5",
|
"target": "es5",
|
||||||
"lib": [
|
"lib": [
|
||||||
"dom",
|
"dom",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue