mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 18:32:56 +01:00
Adopt latest deps and fix errors
This commit is contained in:
parent
ff043657bd
commit
ae43973e77
5 changed files with 3671 additions and 22 deletions
|
|
@ -44,8 +44,8 @@ gulp.task('release', ['clean-release','compile'], function() {
|
|||
return location;
|
||||
}
|
||||
|
||||
var jsoncLocation = getDependencyLocation('jsonc-parser', 'lib', 'vscode-json-languageservice');
|
||||
var uriLocation = getDependencyLocation('vscode-uri', 'lib', 'vscode-json-languageservice');
|
||||
var jsoncLocation = getDependencyLocation('jsonc-parser', 'lib/umd', 'vscode-json-languageservice');
|
||||
var uriLocation = getDependencyLocation('vscode-uri', 'lib/umd', 'vscode-json-languageservice');
|
||||
|
||||
function bundleOne(moduleId, exclude) {
|
||||
|
||||
|
|
@ -60,11 +60,11 @@ gulp.task('release', ['clean-release','compile'], function() {
|
|||
},
|
||||
packages: [{
|
||||
name: 'vscode-json-languageservice',
|
||||
location: __dirname + '/node_modules/vscode-json-languageservice/lib',
|
||||
location: __dirname + '/node_modules/vscode-json-languageservice/lib/umd',
|
||||
main: 'jsonLanguageService'
|
||||
}, {
|
||||
name: 'vscode-languageserver-types',
|
||||
location: __dirname + '/node_modules/vscode-languageserver-types/lib',
|
||||
location: __dirname + '/node_modules/vscode-languageserver-types/lib/umd',
|
||||
main: 'main'
|
||||
}, {
|
||||
name: 'vscode-uri',
|
||||
|
|
|
|||
3624
package-lock.json
generated
Normal file
3624
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -24,13 +24,14 @@
|
|||
"gulp-requirejs": "^0.1.3",
|
||||
"gulp-tsb": "^2.0.0",
|
||||
"gulp-uglify": "^1.5.3",
|
||||
"jsonc-parser": "^1.0.3",
|
||||
"merge-stream": "^1.0.0",
|
||||
"monaco-editor-core": "^0.10.1",
|
||||
"monaco-editor-core": "^0.11.1",
|
||||
"monaco-languages": "^0.9.0",
|
||||
"object-assign": "^4.1.0",
|
||||
"rimraf": "^2.5.2",
|
||||
"typescript": "^2.7.1",
|
||||
"vscode-languageserver-types": "^3.5.0",
|
||||
"vscode-json-languageservice": "^3.0.5"
|
||||
"vscode-json-languageservice": "^3.0.5",
|
||||
"vscode-languageserver-types": "3.7.0-next.1"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class PromiseAdapter<T> implements jsonService.Thenable<T> {
|
|||
this.wrapped = new monaco.Promise<T>(executor);
|
||||
}
|
||||
public then<TResult>(onfulfilled?: (value: T) => TResult | jsonService.Thenable<TResult>, onrejected?: (reason: any) => void): jsonService.Thenable<TResult> {
|
||||
let thenable : monaco.Thenable<T> = this.wrapped;
|
||||
let thenable : jsonService.Thenable<T> = this.wrapped;
|
||||
return thenable.then(onfulfilled, onrejected);
|
||||
}
|
||||
public getWrapped(): monaco.Thenable<T> {
|
||||
|
|
@ -31,20 +31,13 @@ class PromiseAdapter<T> implements jsonService.Thenable<T> {
|
|||
return <monaco.Thenable<T>> monaco.Promise.as(v);
|
||||
}
|
||||
public static reject<T>(v: T): jsonService.Thenable<T> {
|
||||
return monaco.Promise.wrapError(v);
|
||||
return monaco.Promise.wrapError(<any>v);
|
||||
}
|
||||
public static all<T>(values: jsonService.Thenable<T>[]): jsonService.Thenable<T[]> {
|
||||
return monaco.Promise.join(values);
|
||||
}
|
||||
}
|
||||
|
||||
function toMonacoPromise<R>(thenable: jsonService.Thenable<R>): Thenable<R> {
|
||||
if (thenable instanceof PromiseAdapter) {
|
||||
return thenable.getWrapped();
|
||||
}
|
||||
return thenable;
|
||||
}
|
||||
|
||||
export class JSONWorker {
|
||||
|
||||
private _ctx: IWorkerContext;
|
||||
|
|
@ -89,7 +82,7 @@ export class JSONWorker {
|
|||
resetSchema(uri: string): Thenable<boolean> {
|
||||
return Promise.as(this._languageService.resetSchema(uri));
|
||||
}
|
||||
findDocumentSymbols(uri: string): Promise<ls.SymbolInformation[]> {
|
||||
findDocumentSymbols(uri: string): Thenable<ls.SymbolInformation[]> {
|
||||
let document = this._getTextDocument(uri);
|
||||
let jsonDocument = this._languageService.parseJSONDocument(document);
|
||||
let symbols = this._languageService.findDocumentSymbols(document, jsonDocument);
|
||||
|
|
|
|||
|
|
@ -233,12 +233,19 @@ function toCompletionItem(entry: ls.CompletionItem): DataCompletionItem {
|
|||
};
|
||||
}
|
||||
|
||||
function fromMarkdownString(entry: string | monaco.IMarkdownString): ls.MarkupContent {
|
||||
return {
|
||||
kind: (typeof entry === 'string' ? ls.MarkupKind.PlainText : ls.MarkupKind.PlainText),
|
||||
value: (typeof entry === 'string' ? entry : entry.value)
|
||||
}
|
||||
}
|
||||
|
||||
function fromCompletionItem(entry: DataCompletionItem): ls.CompletionItem {
|
||||
let item : ls.CompletionItem = {
|
||||
label: entry.label,
|
||||
sortText: entry.sortText,
|
||||
filterText: entry.filterText,
|
||||
documentation: entry.documentation,
|
||||
documentation: fromMarkdownString(entry.documentation),
|
||||
detail: entry.detail,
|
||||
kind: fromCompletionItemKind(entry.kind),
|
||||
data: entry.data
|
||||
|
|
@ -303,14 +310,38 @@ export class CompletionAdapter implements monaco.languages.CompletionItemProvide
|
|||
}
|
||||
}
|
||||
|
||||
function toMarkedStringArray(contents: ls.MarkedString | ls.MarkedString[]): monaco.MarkedString[] {
|
||||
function isMarkupContent(thing: any): thing is ls.MarkupContent {
|
||||
return thing && typeof thing === 'object' && typeof (<ls.MarkupContent>thing).kind === 'string';
|
||||
}
|
||||
|
||||
function toMarkdownString(entry: ls.MarkupContent | ls.MarkedString): monaco.IMarkdownString {
|
||||
if (typeof entry === 'string') {
|
||||
return {
|
||||
value: entry
|
||||
};
|
||||
}
|
||||
if (isMarkupContent(entry)) {
|
||||
if (entry.kind === 'plaintext') {
|
||||
return {
|
||||
value: entry.value.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&')
|
||||
};
|
||||
}
|
||||
return {
|
||||
value: entry.value
|
||||
};
|
||||
}
|
||||
|
||||
return { value: '```' + entry.value + '\n' + entry.value + '\n```\n' };
|
||||
}
|
||||
|
||||
function toMarkedStringArray(contents: ls.MarkupContent | ls.MarkedString | ls.MarkedString[]): monaco.IMarkdownString[] {
|
||||
if (!contents) {
|
||||
return void 0;
|
||||
}
|
||||
if (Array.isArray(contents)) {
|
||||
return (<ls.MarkedString[]>contents);
|
||||
return contents.map(toMarkdownString);
|
||||
}
|
||||
return [<ls.MarkedString>contents];
|
||||
return [toMarkdownString(contents)];
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -403,7 +434,7 @@ export class DocumentSymbolAdapter implements monaco.languages.DocumentSymbolPro
|
|||
function fromFormattingOptions(options: monaco.languages.FormattingOptions): ls.FormattingOptions {
|
||||
return {
|
||||
tabSize: options.tabSize,
|
||||
insertSpaces: options.insertSpaces
|
||||
insertSpaces: options.insertSpaces
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue