run import, minor edits

pull/2748/head
Alex Dima 5 years ago
parent fede24ed75
commit 151b807fee
No known key found for this signature in database
GPG Key ID: 6E58D7B045760DA0

@ -101,25 +101,19 @@ export = ts;
})();
function importLibs() {
function getFileName(name) {
return name
}
function getVariableName(name) {
return name.replace(/\./g, '_') + "_dts"
}
function readLibFile(name) {
var srcPath = path.join(TYPESCRIPT_LIB_SOURCE, name);
return fs.readFileSync(srcPath).toString();
}
var dtsFiles = fs.readdirSync(TYPESCRIPT_LIB_SOURCE).filter(f => f.includes("lib."))
var dtsFiles = fs.readdirSync(TYPESCRIPT_LIB_SOURCE).filter(f => f.includes("lib."));
var result = [];
while (dtsFiles.length > 0) {
var name = dtsFiles.shift();
var output = readLibFile(name);
result.push({
name: getVariableName(name),
name: name.replace(/\./g, '_') + "_dts",
filepath: name,
deps: [],
output: '"' + escapeText(output) + '"'

@ -7,7 +7,7 @@
import { LanguageServiceDefaultsImpl } from './monaco.contribution';
import * as ts from './lib/typescriptServices';
import { TypeScriptWorker } from './tsWorker';
import {libFileMap} from "./lib/lib"
import { libFileMap } from "./lib/lib"
import Uri = monaco.Uri;
import Position = monaco.Position;
@ -23,7 +23,7 @@ enum IndentStyle {
Smart = 2
}
function getOrCreateLibFile(uri: Uri) {
function getOrCreateLibFile(uri: Uri): monaco.editor.ITextModel | null {
let model = monaco.editor.getModel(uri)
if (!model) {
if (uri.path.indexOf("/lib.") === 0) {
@ -33,7 +33,6 @@ function getOrCreateLibFile(uri: Uri) {
return model
}
export function flattenDiagnosticMessageText(diag: string | ts.DiagnosticMessageChain | undefined, newLine: string, indent = 0): string {
if (typeof diag === "string") {
return diag;

File diff suppressed because one or more lines are too long

@ -130,7 +130,9 @@ export class TypeScriptWorker implements ts.LanguageServiceHost, monaco.language
// Note: This also looks in _extraLibs, If you want
// to add support for additional target options, you will need to
// add the extra dts files to _extraLibs via the API.
if (eslib in libFileMap || eslib in this._extraLibs) return eslib
if (eslib in libFileMap || eslib in this._extraLibs) {
return eslib;
}
return "lib.es6.d.ts"; // We don't use lib.es2015.full.d.ts due to breaking change.
case 1:

@ -6,7 +6,6 @@
import { LanguageServiceDefaultsImpl } from './monaco.contribution';
import { TypeScriptWorker } from './tsWorker';
import { libFileMap } from './lib/lib'
import IDisposable = monaco.IDisposable;
import Uri = monaco.Uri;
@ -65,13 +64,15 @@ export class WorkerManager {
// module that exports the create() method and returns a `TypeScriptWorker` instance
moduleId: 'vs/language/typescript/tsWorker',
label: this._modeId,
keepIdleModels: true,
// passed in to the create() method
createData: {
compilerOptions: this._defaults.getCompilerOptions(),
extraLibs: this._defaults.getExtraLibs(),
extraLibs: this._defaults.getExtraLibs()
}
});

Loading…
Cancel
Save