mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 11:35:40 +01:00
Adopt new editor, bump TypeScript
This commit is contained in:
parent
e054e6cb4c
commit
27f5823a7e
8 changed files with 238774 additions and 232347 deletions
38
package-lock.json
generated
38
package-lock.json
generated
|
|
@ -5,21 +5,21 @@
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"commander": {
|
"commander": {
|
||||||
"version": "2.16.0",
|
"version": "2.17.1",
|
||||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.16.0.tgz",
|
"resolved": "https://registry.npmjs.org/commander/-/commander-2.17.1.tgz",
|
||||||
"integrity": "sha512-sVXqklSaotK9at437sFlFpyOcJonxe0yST/AG9DkQKUdIE6IqGIMv4SfAQSKaJbSdVEJYItASCrBiVQHq1HQew==",
|
"integrity": "sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"monaco-editor-core": {
|
"monaco-editor-core": {
|
||||||
"version": "0.14.1",
|
"version": "0.15.0",
|
||||||
"resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.14.1.tgz",
|
"resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.15.0.tgz",
|
||||||
"integrity": "sha512-bWJuPbDEftxaN2bG+JZ29+aJhg0rmq+y6VmCUqPZpmw8bSevoYjuTcdLkt9BbNaGnwosAVy+vSktXgs/JW7OvQ==",
|
"integrity": "sha512-s1zuo+p6Gl6IC4WJP6HBkr4pWULm+HdFfacB8vOFPQLLi2oJseO20UuSkxYuZTUJQIjvhNrQfLNAmPKLZaf7tg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"monaco-languages": {
|
"monaco-languages": {
|
||||||
"version": "1.4.0",
|
"version": "1.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/monaco-languages/-/monaco-languages-1.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/monaco-languages/-/monaco-languages-1.6.0.tgz",
|
||||||
"integrity": "sha512-39MZMAEKToktfSpOS0Soj05IvkT5vbebL9AIBGPn8fGi8WgJOcfS3YLiMu07gZKViR7CFZ4RyQJKJHglx0fPdA==",
|
"integrity": "sha512-LBEWj8tngYwsq4kasQr+dIhnO4xUIEN36ns+cRepWAQiXZnzcrZ84gFHXm8f4mR4tssxvHVU5Vw7xMUYro6h3g==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"monaco-plugin-helpers": {
|
"monaco-plugin-helpers": {
|
||||||
|
|
@ -40,9 +40,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"requirejs": {
|
"requirejs": {
|
||||||
"version": "2.3.5",
|
"version": "2.3.6",
|
||||||
"resolved": "https://registry.npmjs.org/requirejs/-/requirejs-2.3.5.tgz",
|
"resolved": "https://registry.npmjs.org/requirejs/-/requirejs-2.3.6.tgz",
|
||||||
"integrity": "sha512-svnO+aNcR/an9Dpi44C7KSAy5fFGLtmPbaaCeQaklUz8BQhS64tWWIIlvEA5jrWICzlO/X9KSzSeXFnZdBu8nw==",
|
"integrity": "sha512-ipEzlWQe6RK3jkzikgCupiTbTvm4S0/CAU5GlgptkN5SO6F3u0UD0K18wy6ErDqiCyP4J4YYe1HuAShvsxePLg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"source-map": {
|
"source-map": {
|
||||||
|
|
@ -52,18 +52,18 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"typescript": {
|
"typescript": {
|
||||||
"version": "3.0.1",
|
"version": "3.1.6",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.1.6.tgz",
|
||||||
"integrity": "sha512-zQIMOmC+372pC/CCVLqnQ0zSBiY7HHodU7mpQdjiZddek4GMj31I3dUJ7gAs9o65X7mnRma6OokOkc6f9jjfBg==",
|
"integrity": "sha512-tDMYfVtvpb96msS1lDX9MEdHrW4yOuZ4Kdc4Him9oU796XldPYF/t2+uKoX0BBa0hXXwDlqYQbXY5Rzjzc5hBA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"uglify-js": {
|
"uglify-js": {
|
||||||
"version": "3.4.7",
|
"version": "3.4.9",
|
||||||
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.4.7.tgz",
|
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.4.9.tgz",
|
||||||
"integrity": "sha512-J0M2i1mQA+ze3EdN9SBi751DNdAXmeFLfJrd/MDIkRc3G3Gbb9OPVSx7GIQvVwfWxQARcYV2DTxIkMyDAk3o9Q==",
|
"integrity": "sha512-8CJsbKOtEbnJsTyv6LE6m6ZKniqMiFWmm9sRbopbkGs3gMPPfd3Fh8iIA4Ykv5MgaTbqHr4BaoGLJLZNhsrW1Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"commander": "~2.16.0",
|
"commander": "~2.17.1",
|
||||||
"source-map": "~0.6.1"
|
"source-map": "~0.6.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
12
package.json
12
package.json
|
|
@ -7,7 +7,7 @@
|
||||||
"compile-esm": "mcopy ./src/lib/typescriptServices.js ./release/esm/lib/typescriptServices.js && tsc -p ./src/tsconfig.esm.json",
|
"compile-esm": "mcopy ./src/lib/typescriptServices.js ./release/esm/lib/typescriptServices.js && tsc -p ./src/tsconfig.esm.json",
|
||||||
"compile": "mrmdir ./release && npm run compile-amd && npm run compile-esm",
|
"compile": "mrmdir ./release && npm run compile-amd && npm run compile-esm",
|
||||||
"watch": "tsc -p ./src --watch",
|
"watch": "tsc -p ./src --watch",
|
||||||
"prepublish": "npm run compile && node ./scripts/bundle && mcopy ./src/monaco.d.ts ./release/monaco.d.ts",
|
"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"
|
||||||
},
|
},
|
||||||
"author": "Microsoft Corporation",
|
"author": "Microsoft Corporation",
|
||||||
|
|
@ -20,11 +20,11 @@
|
||||||
"url": "https://github.com/Microsoft/monaco-typescript/issues"
|
"url": "https://github.com/Microsoft/monaco-typescript/issues"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"monaco-editor-core": "0.14.1",
|
"monaco-editor-core": "0.15.0",
|
||||||
"monaco-languages": "^1.4.0",
|
"monaco-languages": "^1.6.0",
|
||||||
"monaco-plugin-helpers": "^1.0.2",
|
"monaco-plugin-helpers": "^1.0.2",
|
||||||
"requirejs": "^2.3.5",
|
"requirejs": "^2.3.6",
|
||||||
"typescript": "3.0.1",
|
"typescript": "3.1.6",
|
||||||
"uglify-js": "^3.4.7"
|
"uglify-js": "^3.4.9"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -177,7 +177,7 @@ export class DiagnostcsAdapter extends Adapter {
|
||||||
.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);
|
||||||
}).done(undefined, err => {
|
}).then(undefined, err => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -210,12 +210,12 @@ export class SuggestAdapter extends Adapter implements monaco.languages.Completi
|
||||||
return ['.'];
|
return ['.'];
|
||||||
}
|
}
|
||||||
|
|
||||||
provideCompletionItems(model: monaco.editor.IReadOnlyModel, position: Position, token: CancellationToken): Thenable<monaco.languages.CompletionItem[]> {
|
provideCompletionItems(model: monaco.editor.IReadOnlyModel, position: Position, _context: monaco.languages.CompletionContext, token: CancellationToken): Thenable<monaco.languages.CompletionList> {
|
||||||
const wordInfo = model.getWordUntilPosition(position);
|
const wordInfo = model.getWordUntilPosition(position);
|
||||||
const resource = model.uri;
|
const resource = model.uri;
|
||||||
const offset = this._positionToOffset(resource, position);
|
const offset = this._positionToOffset(resource, position);
|
||||||
|
|
||||||
return wireCancellationToken(token, this._worker(resource).then(worker => {
|
return this._worker(resource).then(worker => {
|
||||||
return worker.getCompletionsAtPosition(resource.toString(), offset);
|
return worker.getCompletionsAtPosition(resource.toString(), offset);
|
||||||
}).then(info => {
|
}).then(info => {
|
||||||
if (!info) {
|
if (!info) {
|
||||||
|
|
@ -226,21 +226,24 @@ export class SuggestAdapter extends Adapter implements monaco.languages.Completi
|
||||||
uri: resource,
|
uri: resource,
|
||||||
position: position,
|
position: position,
|
||||||
label: entry.name,
|
label: entry.name,
|
||||||
|
insertText: entry.name,
|
||||||
sortText: entry.sortText,
|
sortText: entry.sortText,
|
||||||
kind: SuggestAdapter.convertKind(entry.kind)
|
kind: SuggestAdapter.convertKind(entry.kind)
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
return suggestions;
|
return {
|
||||||
}));
|
suggestions
|
||||||
|
};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
resolveCompletionItem(item: monaco.languages.CompletionItem, token: CancellationToken): Thenable<monaco.languages.CompletionItem> {
|
resolveCompletionItem(_model: monaco.editor.IReadOnlyModel, _position: Position, item: monaco.languages.CompletionItem, token: CancellationToken): Thenable<monaco.languages.CompletionItem> {
|
||||||
let myItem = <MyCompletionItem>item;
|
let myItem = <MyCompletionItem>item;
|
||||||
const resource = myItem.uri;
|
const resource = myItem.uri;
|
||||||
const position = myItem.position;
|
const position = myItem.position;
|
||||||
|
|
||||||
return wireCancellationToken(token, this._worker(resource).then(worker => {
|
return this._worker(resource).then(worker => {
|
||||||
return worker.getCompletionEntryDetails(resource.toString(),
|
return worker.getCompletionEntryDetails(resource.toString(),
|
||||||
this._positionToOffset(resource, position),
|
this._positionToOffset(resource, position),
|
||||||
myItem.label);
|
myItem.label);
|
||||||
|
|
@ -259,7 +262,7 @@ export class SuggestAdapter extends Adapter implements monaco.languages.Completi
|
||||||
value: displayPartsToString(details.documentation)
|
value: displayPartsToString(details.documentation)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}));
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static convertKind(kind: string): monaco.languages.CompletionItemKind {
|
private static convertKind(kind: string): monaco.languages.CompletionItemKind {
|
||||||
|
|
@ -302,7 +305,7 @@ export class SignatureHelpAdapter extends Adapter implements monaco.languages.Si
|
||||||
|
|
||||||
provideSignatureHelp(model: monaco.editor.IReadOnlyModel, position: Position, token: CancellationToken): Thenable<monaco.languages.SignatureHelp> {
|
provideSignatureHelp(model: monaco.editor.IReadOnlyModel, position: Position, token: CancellationToken): Thenable<monaco.languages.SignatureHelp> {
|
||||||
let resource = model.uri;
|
let resource = model.uri;
|
||||||
return wireCancellationToken(token, this._worker(resource).then(worker => worker.getSignatureHelpItems(resource.toString(), this._positionToOffset(resource, position))).then(info => {
|
return this._worker(resource).then(worker => worker.getSignatureHelpItems(resource.toString(), this._positionToOffset(resource, position))).then(info => {
|
||||||
|
|
||||||
if (!info) {
|
if (!info) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -341,7 +344,7 @@ export class SignatureHelpAdapter extends Adapter implements monaco.languages.Si
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
}));
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -352,7 +355,7 @@ export class QuickInfoAdapter extends Adapter implements monaco.languages.HoverP
|
||||||
provideHover(model: monaco.editor.IReadOnlyModel, position: Position, token: CancellationToken): Thenable<monaco.languages.Hover> {
|
provideHover(model: monaco.editor.IReadOnlyModel, position: Position, token: CancellationToken): Thenable<monaco.languages.Hover> {
|
||||||
let resource = model.uri;
|
let resource = model.uri;
|
||||||
|
|
||||||
return wireCancellationToken(token, this._worker(resource).then(worker => {
|
return this._worker(resource).then(worker => {
|
||||||
return worker.getQuickInfoAtPosition(resource.toString(), this._positionToOffset(resource, position));
|
return worker.getQuickInfoAtPosition(resource.toString(), this._positionToOffset(resource, position));
|
||||||
}).then(info => {
|
}).then(info => {
|
||||||
if (!info) {
|
if (!info) {
|
||||||
|
|
@ -376,7 +379,7 @@ export class QuickInfoAdapter extends Adapter implements monaco.languages.HoverP
|
||||||
value: documentation + (tags ? '\n\n' + tags : '')
|
value: documentation + (tags ? '\n\n' + tags : '')
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
}));
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -387,7 +390,7 @@ export class OccurrencesAdapter extends Adapter implements monaco.languages.Docu
|
||||||
public provideDocumentHighlights(model: monaco.editor.IReadOnlyModel, position: Position, token: CancellationToken): Thenable<monaco.languages.DocumentHighlight[]> {
|
public provideDocumentHighlights(model: monaco.editor.IReadOnlyModel, position: Position, token: CancellationToken): Thenable<monaco.languages.DocumentHighlight[]> {
|
||||||
const resource = model.uri;
|
const resource = model.uri;
|
||||||
|
|
||||||
return wireCancellationToken(token, this._worker(resource).then(worker => {
|
return this._worker(resource).then(worker => {
|
||||||
return worker.getOccurrencesAtPosition(resource.toString(), this._positionToOffset(resource, position));
|
return worker.getOccurrencesAtPosition(resource.toString(), this._positionToOffset(resource, position));
|
||||||
}).then(entries => {
|
}).then(entries => {
|
||||||
if (!entries) {
|
if (!entries) {
|
||||||
|
|
@ -399,7 +402,7 @@ export class OccurrencesAdapter extends Adapter implements monaco.languages.Docu
|
||||||
kind: entry.isWriteAccess ? monaco.languages.DocumentHighlightKind.Write : monaco.languages.DocumentHighlightKind.Text
|
kind: entry.isWriteAccess ? monaco.languages.DocumentHighlightKind.Write : monaco.languages.DocumentHighlightKind.Text
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}));
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -410,7 +413,7 @@ export class DefinitionAdapter extends Adapter {
|
||||||
public provideDefinition(model: monaco.editor.IReadOnlyModel, position: Position, token: CancellationToken): Thenable<monaco.languages.Definition> {
|
public provideDefinition(model: monaco.editor.IReadOnlyModel, position: Position, token: CancellationToken): Thenable<monaco.languages.Definition> {
|
||||||
const resource = model.uri;
|
const resource = model.uri;
|
||||||
|
|
||||||
return wireCancellationToken(token, this._worker(resource).then(worker => {
|
return this._worker(resource).then(worker => {
|
||||||
return worker.getDefinitionAtPosition(resource.toString(), this._positionToOffset(resource, position));
|
return worker.getDefinitionAtPosition(resource.toString(), this._positionToOffset(resource, position));
|
||||||
}).then(entries => {
|
}).then(entries => {
|
||||||
if (!entries) {
|
if (!entries) {
|
||||||
|
|
@ -427,7 +430,7 @@ export class DefinitionAdapter extends Adapter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}));
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -438,7 +441,7 @@ export class ReferenceAdapter extends Adapter implements monaco.languages.Refere
|
||||||
provideReferences(model: monaco.editor.IReadOnlyModel, position: Position, context: monaco.languages.ReferenceContext, token: CancellationToken): Thenable<monaco.languages.Location[]> {
|
provideReferences(model: monaco.editor.IReadOnlyModel, position: Position, context: monaco.languages.ReferenceContext, token: CancellationToken): Thenable<monaco.languages.Location[]> {
|
||||||
const resource = model.uri;
|
const resource = model.uri;
|
||||||
|
|
||||||
return wireCancellationToken(token, this._worker(resource).then(worker => {
|
return this._worker(resource).then(worker => {
|
||||||
return worker.getReferencesAtPosition(resource.toString(), this._positionToOffset(resource, position));
|
return worker.getReferencesAtPosition(resource.toString(), this._positionToOffset(resource, position));
|
||||||
}).then(entries => {
|
}).then(entries => {
|
||||||
if (!entries) {
|
if (!entries) {
|
||||||
|
|
@ -455,7 +458,7 @@ export class ReferenceAdapter extends Adapter implements monaco.languages.Refere
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}));
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -466,7 +469,7 @@ export class OutlineAdapter extends Adapter implements monaco.languages.Document
|
||||||
public provideDocumentSymbols(model: monaco.editor.IReadOnlyModel, token: CancellationToken): Thenable<monaco.languages.DocumentSymbol[]> {
|
public provideDocumentSymbols(model: monaco.editor.IReadOnlyModel, token: CancellationToken): Thenable<monaco.languages.DocumentSymbol[]> {
|
||||||
const resource = model.uri;
|
const resource = model.uri;
|
||||||
|
|
||||||
return wireCancellationToken(token, this._worker(resource).then(worker => worker.getNavigationBarItems(resource.toString())).then(items => {
|
return this._worker(resource).then(worker => worker.getNavigationBarItems(resource.toString())).then(items => {
|
||||||
if (!items) {
|
if (!items) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -493,7 +496,7 @@ export class OutlineAdapter extends Adapter implements monaco.languages.Document
|
||||||
let result: monaco.languages.DocumentSymbol[] = [];
|
let result: monaco.languages.DocumentSymbol[] = [];
|
||||||
items.forEach(item => convert(result, item));
|
items.forEach(item => convert(result, item));
|
||||||
return result;
|
return result;
|
||||||
}));
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -580,7 +583,7 @@ export class FormatAdapter extends FormatHelper implements monaco.languages.Docu
|
||||||
provideDocumentRangeFormattingEdits(model: monaco.editor.IReadOnlyModel, range: Range, options: monaco.languages.FormattingOptions, token: CancellationToken): Thenable<monaco.editor.ISingleEditOperation[]> {
|
provideDocumentRangeFormattingEdits(model: monaco.editor.IReadOnlyModel, range: Range, options: monaco.languages.FormattingOptions, token: CancellationToken): Thenable<monaco.editor.ISingleEditOperation[]> {
|
||||||
const resource = model.uri;
|
const resource = model.uri;
|
||||||
|
|
||||||
return wireCancellationToken(token, this._worker(resource).then(worker => {
|
return this._worker(resource).then(worker => {
|
||||||
return worker.getFormattingEditsForRange(resource.toString(),
|
return worker.getFormattingEditsForRange(resource.toString(),
|
||||||
this._positionToOffset(resource, { lineNumber: range.startLineNumber, column: range.startColumn }),
|
this._positionToOffset(resource, { lineNumber: range.startLineNumber, column: range.startColumn }),
|
||||||
this._positionToOffset(resource, { lineNumber: range.endLineNumber, column: range.endColumn }),
|
this._positionToOffset(resource, { lineNumber: range.endLineNumber, column: range.endColumn }),
|
||||||
|
|
@ -589,7 +592,7 @@ export class FormatAdapter extends FormatHelper implements monaco.languages.Docu
|
||||||
if (edits) {
|
if (edits) {
|
||||||
return edits.map(edit => this._convertTextChanges(resource, edit));
|
return edits.map(edit => this._convertTextChanges(resource, edit));
|
||||||
}
|
}
|
||||||
}));
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -602,7 +605,7 @@ export class FormatOnTypeAdapter extends FormatHelper implements monaco.language
|
||||||
provideOnTypeFormattingEdits(model: monaco.editor.IReadOnlyModel, position: Position, ch: string, options: monaco.languages.FormattingOptions, token: CancellationToken): Thenable<monaco.editor.ISingleEditOperation[]> {
|
provideOnTypeFormattingEdits(model: monaco.editor.IReadOnlyModel, position: Position, ch: string, options: monaco.languages.FormattingOptions, token: CancellationToken): Thenable<monaco.editor.ISingleEditOperation[]> {
|
||||||
const resource = model.uri;
|
const resource = model.uri;
|
||||||
|
|
||||||
return wireCancellationToken(token, this._worker(resource).then(worker => {
|
return this._worker(resource).then(worker => {
|
||||||
return worker.getFormattingEditsAfterKeystroke(resource.toString(),
|
return worker.getFormattingEditsAfterKeystroke(resource.toString(),
|
||||||
this._positionToOffset(resource, position),
|
this._positionToOffset(resource, position),
|
||||||
ch, FormatHelper._convertOptions(options));
|
ch, FormatHelper._convertOptions(options));
|
||||||
|
|
@ -610,14 +613,6 @@ export class FormatOnTypeAdapter extends FormatHelper implements monaco.language
|
||||||
if (edits) {
|
if (edits) {
|
||||||
return edits.map(edit => this._convertTextChanges(resource, edit));
|
return edits.map(edit => this._convertTextChanges(resource, edit));
|
||||||
}
|
}
|
||||||
}));
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Hook a cancellation token to a WinJS Promise
|
|
||||||
*/
|
|
||||||
function wireCancellationToken<T>(token: CancellationToken, promise: Promise<T>): Thenable<T> {
|
|
||||||
token.onCancellationRequested(() => promise.cancel());
|
|
||||||
return promise;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
11162
src/lib/typescriptServices.d.ts
vendored
11162
src/lib/typescriptServices.d.ts
vendored
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
|
|
@ -93,26 +93,10 @@ export class WorkerManager {
|
||||||
|
|
||||||
getLanguageServiceWorker(...resources: Uri[]): Promise<TypeScriptWorker> {
|
getLanguageServiceWorker(...resources: Uri[]): Promise<TypeScriptWorker> {
|
||||||
let _client: TypeScriptWorker;
|
let _client: TypeScriptWorker;
|
||||||
return toShallowCancelPromise(
|
return this._getClient().then((client) => {
|
||||||
this._getClient().then((client) => {
|
_client = client
|
||||||
_client = client
|
}).then(_ => {
|
||||||
}).then(_ => {
|
return this._worker.withSyncedResources(resources)
|
||||||
return this._worker.withSyncedResources(resources)
|
}).then(_ => _client);
|
||||||
}).then(_ => _client)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function toShallowCancelPromise<T>(p: Promise<T>): Promise<T> {
|
|
||||||
let completeCallback: (value: T) => void;
|
|
||||||
let errorCallback: (err: any) => void;
|
|
||||||
|
|
||||||
let r = new Promise<T>((c, e) => {
|
|
||||||
completeCallback = c;
|
|
||||||
errorCallback = e;
|
|
||||||
}, () => { });
|
|
||||||
|
|
||||||
p.then(completeCallback, errorCallback);
|
|
||||||
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue