Adds support for running on TS 3.6.0, and adds a daily update script

pull/2748/head
Orta Therox 6 years ago
parent 34095b6b55
commit 8440cba727

@ -1,6 +1,6 @@
{
"name": "monaco-typescript",
"version": "3.5.0",
"version": "3.6.0",
"description": "TypeScript and JavaScript language support for Monaco Editor",
"scripts": {
"compile-amd": "mcopy ./src/lib/typescriptServices-amd.js ./release/dev/lib/typescriptServices.js && tsc -p ./src/tsconfig.json",
@ -8,7 +8,8 @@
"compile": "mrmdir ./release && npm run compile-amd && npm run compile-esm",
"watch": "tsc -p ./src --watch",
"prepublishOnly": "npm run compile && node ./scripts/bundle && mcopy ./src/monaco.d.ts ./release/monaco.d.ts",
"import-typescript": "node ./scripts/importTypescript"
"import-typescript": "node ./scripts/importTypescript",
"run-nightly": "node ./scripts/runDaily",
},
"author": "Microsoft Corporation",
"license": "MIT",

@ -0,0 +1,27 @@
// @ts-check
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
const {execSync} = require('child_process');
const {join} = require('path')
const {readFileSync, writeFileSync} = require("fs")
// Update to the daily build
execSync("npm install --save typescript@next")
// Update the dts files
execSync("npm run import-typescript")
// Sync the versions
const packagePath = join(__dirname, "../package.json")
const package = JSON.parse(readFileSync(packagePath, "utf8"))
const tsPackagePath = join(__dirname, "../node_modules/typescript/package.json")
const tsPackage = JSON.parse(readFileSync(tsPackagePath, "utf8"))
// Set the monaco-typescript version to directly match the typescript nightly version
package.version = tsPackage.version
writeFileSync(packagePath, JSON.stringify(package), "utf8")

@ -23,26 +23,29 @@ enum IndentStyle {
Smart = 2
}
function flattenDiagnosticMessageText(messageText: string | ts.DiagnosticMessageChain, newLine: '\n'): string {
if (typeof messageText === "string") {
return messageText;
} else {
let diagnosticChain = messageText;
let result = "";
let indent = 0;
while (diagnosticChain) {
if (indent) {
result += newLine;
for (let i = 0; i < indent; i++) {
export function flattenDiagnosticMessageText(diag: string | ts.DiagnosticMessageChain | undefined, newLine: string, indent = 0): string {
if (typeof diag === "string") {
return diag;
}
else if (diag === undefined) {
return "";
}
let result = "";
if (indent) {
result += newLine;
for (let i = 0; i < indent; i++) {
result += " ";
}
}
result += diagnosticChain.messageText;
indent++;
diagnosticChain = diagnosticChain.next;
}
return result;
}
result += diag.messageText;
indent++;
if (diag.next) {
for (const kid of diag.next) {
result += flattenDiagnosticMessageText(kid, newLine, indent);
}
}
return result;
}
function displayPartsToString(displayParts: ts.SymbolDisplayPart[]): string {

Loading…
Cancel
Save