diff --git a/package.json b/package.json index 57f2b8d0..d127973e 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "gulp-uglify": "^1.5.3", "merge-stream": "^1.0.0", "mocha": "^2.5.3", - "monaco-editor-core": "^0.3.1", + "monaco-editor-core": "^0.4.0", "object-assign": "^4.1.0", "rimraf": "^2.5.2", "typescript": "1.8.10", diff --git a/src/languageFeatures.ts b/src/languageFeatures.ts index 54d2a69a..be9aa2a4 100644 --- a/src/languageFeatures.ts +++ b/src/languageFeatures.ts @@ -464,7 +464,7 @@ outlineTypeTable[Kind.localFunction] = monaco.languages.SymbolKind.Function; // --- formatting ---- export abstract class FormatHelper extends Adapter { - protected static _convertOptions(options: monaco.languages.IFormattingOptions): ts.FormatCodeOptions { + protected static _convertOptions(options: monaco.languages.FormattingOptions): ts.FormatCodeOptions { return { ConvertTabsToSpaces: options.insertSpaces, TabSize: options.tabSize, @@ -494,7 +494,7 @@ export abstract class FormatHelper extends Adapter { export class FormatAdapter extends FormatHelper implements monaco.languages.DocumentRangeFormattingEditProvider { - provideDocumentRangeFormattingEdits(model: monaco.editor.IReadOnlyModel, range: Range, options: monaco.languages.IFormattingOptions, token: CancellationToken): Thenable { + provideDocumentRangeFormattingEdits(model: monaco.editor.IReadOnlyModel, range: Range, options: monaco.languages.FormattingOptions, token: CancellationToken): Thenable { const resource = model.uri; return wireCancellationToken(token, this._worker(resource).then(worker => { @@ -516,7 +516,7 @@ export class FormatOnTypeAdapter extends FormatHelper implements monaco.language return [';', '}', '\n']; } - provideOnTypeFormattingEdits(model: monaco.editor.IReadOnlyModel, position: Position, ch: string, options: monaco.languages.IFormattingOptions, token: CancellationToken): Thenable { + provideOnTypeFormattingEdits(model: monaco.editor.IReadOnlyModel, position: Position, ch: string, options: monaco.languages.FormattingOptions, token: CancellationToken): Thenable { const resource = model.uri; return wireCancellationToken(token, this._worker(resource).then(worker => { diff --git a/src/mode.ts b/src/mode.ts index 0b1dda15..bd7204a4 100644 --- a/src/mode.ts +++ b/src/mode.ts @@ -55,7 +55,7 @@ function setupMode(defaults:LanguageServiceDefaultsImpl, modeId:string, language disposables.push(monaco.languages.setTokensProvider(modeId, createTokenizationSupport(language))); } -const richEditConfiguration:monaco.languages.IRichLanguageConfiguration = { +const richEditConfiguration:monaco.languages.LanguageConfiguration = { wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g, comments: { diff --git a/src/monaco.contribution.ts b/src/monaco.contribution.ts index a6c0625c..a8fd29cb 100644 --- a/src/monaco.contribution.ts +++ b/src/monaco.contribution.ts @@ -122,6 +122,7 @@ const javascriptDefaults = new LanguageServiceDefaultsImpl( { noSemanticValidation: true, noSyntaxValidation: false }); +// Export API function createAPI(): typeof monaco.languages.typescript { return { ModuleKind: ModuleKind, @@ -133,6 +134,7 @@ function createAPI(): typeof monaco.languages.typescript { javascriptDefaults: javascriptDefaults } } +monaco.languages.typescript = createAPI(); // --- Registration to monaco editor --- diff --git a/src/worker.ts b/src/worker.ts index 7f08ae8d..5afe747e 100644 --- a/src/worker.ts +++ b/src/worker.ts @@ -44,12 +44,12 @@ export class TypeScriptWorker implements ts.LanguageServiceHost { } getScriptFileNames(): string[] { - let models = monaco.worker.mirrorModels.map(model => model.uri.toString()); + let models = monaco.worker.getMirrorModels().map(model => model.uri.toString()); return models.concat(Object.keys(this._extraLibs)); } private _getModel(fileName:string): monaco.worker.IMirrorModel { - let models = monaco.worker.mirrorModels; + let models = monaco.worker.getMirrorModels(); for (let i = 0; i < models.length; i++) { if (models[i].uri.toString() === fileName) { return models[i]; diff --git a/tsconfig.json b/tsconfig.json index 2d9f3096..9cb9c0da 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -16,7 +16,6 @@ "src/monaco.contribution.ts", "src/monaco.d.ts", "src/tokenization.ts", - "src/typescript.ts", "src/worker.ts", "src/workerManager.ts", "test/assert.d.ts",