mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 20:52: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;
|
return location;
|
||||||
}
|
}
|
||||||
|
|
||||||
var jsoncLocation = getDependencyLocation('jsonc-parser', 'lib', 'vscode-json-languageservice');
|
var jsoncLocation = getDependencyLocation('jsonc-parser', 'lib/umd', 'vscode-json-languageservice');
|
||||||
var uriLocation = getDependencyLocation('vscode-uri', 'lib', 'vscode-json-languageservice');
|
var uriLocation = getDependencyLocation('vscode-uri', 'lib/umd', 'vscode-json-languageservice');
|
||||||
|
|
||||||
function bundleOne(moduleId, exclude) {
|
function bundleOne(moduleId, exclude) {
|
||||||
|
|
||||||
|
|
@ -60,11 +60,11 @@ gulp.task('release', ['clean-release','compile'], function() {
|
||||||
},
|
},
|
||||||
packages: [{
|
packages: [{
|
||||||
name: 'vscode-json-languageservice',
|
name: 'vscode-json-languageservice',
|
||||||
location: __dirname + '/node_modules/vscode-json-languageservice/lib',
|
location: __dirname + '/node_modules/vscode-json-languageservice/lib/umd',
|
||||||
main: 'jsonLanguageService'
|
main: 'jsonLanguageService'
|
||||||
}, {
|
}, {
|
||||||
name: 'vscode-languageserver-types',
|
name: 'vscode-languageserver-types',
|
||||||
location: __dirname + '/node_modules/vscode-languageserver-types/lib',
|
location: __dirname + '/node_modules/vscode-languageserver-types/lib/umd',
|
||||||
main: 'main'
|
main: 'main'
|
||||||
}, {
|
}, {
|
||||||
name: 'vscode-uri',
|
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-requirejs": "^0.1.3",
|
||||||
"gulp-tsb": "^2.0.0",
|
"gulp-tsb": "^2.0.0",
|
||||||
"gulp-uglify": "^1.5.3",
|
"gulp-uglify": "^1.5.3",
|
||||||
|
"jsonc-parser": "^1.0.3",
|
||||||
"merge-stream": "^1.0.0",
|
"merge-stream": "^1.0.0",
|
||||||
"monaco-editor-core": "^0.10.1",
|
"monaco-editor-core": "^0.11.1",
|
||||||
"monaco-languages": "^0.9.0",
|
"monaco-languages": "^0.9.0",
|
||||||
"object-assign": "^4.1.0",
|
"object-assign": "^4.1.0",
|
||||||
"rimraf": "^2.5.2",
|
"rimraf": "^2.5.2",
|
||||||
"typescript": "^2.7.1",
|
"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);
|
this.wrapped = new monaco.Promise<T>(executor);
|
||||||
}
|
}
|
||||||
public then<TResult>(onfulfilled?: (value: T) => TResult | jsonService.Thenable<TResult>, onrejected?: (reason: any) => void): jsonService.Thenable<TResult> {
|
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);
|
return thenable.then(onfulfilled, onrejected);
|
||||||
}
|
}
|
||||||
public getWrapped(): monaco.Thenable<T> {
|
public getWrapped(): monaco.Thenable<T> {
|
||||||
|
|
@ -31,20 +31,13 @@ class PromiseAdapter<T> implements jsonService.Thenable<T> {
|
||||||
return <monaco.Thenable<T>> monaco.Promise.as(v);
|
return <monaco.Thenable<T>> monaco.Promise.as(v);
|
||||||
}
|
}
|
||||||
public static reject<T>(v: T): jsonService.Thenable<T> {
|
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[]> {
|
public static all<T>(values: jsonService.Thenable<T>[]): jsonService.Thenable<T[]> {
|
||||||
return monaco.Promise.join(values);
|
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 {
|
export class JSONWorker {
|
||||||
|
|
||||||
private _ctx: IWorkerContext;
|
private _ctx: IWorkerContext;
|
||||||
|
|
@ -89,7 +82,7 @@ export class JSONWorker {
|
||||||
resetSchema(uri: string): Thenable<boolean> {
|
resetSchema(uri: string): Thenable<boolean> {
|
||||||
return Promise.as(this._languageService.resetSchema(uri));
|
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 document = this._getTextDocument(uri);
|
||||||
let jsonDocument = this._languageService.parseJSONDocument(document);
|
let jsonDocument = this._languageService.parseJSONDocument(document);
|
||||||
let symbols = this._languageService.findDocumentSymbols(document, jsonDocument);
|
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 {
|
function fromCompletionItem(entry: DataCompletionItem): ls.CompletionItem {
|
||||||
let item : ls.CompletionItem = {
|
let item : ls.CompletionItem = {
|
||||||
label: entry.label,
|
label: entry.label,
|
||||||
sortText: entry.sortText,
|
sortText: entry.sortText,
|
||||||
filterText: entry.filterText,
|
filterText: entry.filterText,
|
||||||
documentation: entry.documentation,
|
documentation: fromMarkdownString(entry.documentation),
|
||||||
detail: entry.detail,
|
detail: entry.detail,
|
||||||
kind: fromCompletionItemKind(entry.kind),
|
kind: fromCompletionItemKind(entry.kind),
|
||||||
data: entry.data
|
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) {
|
if (!contents) {
|
||||||
return void 0;
|
return void 0;
|
||||||
}
|
}
|
||||||
if (Array.isArray(contents)) {
|
if (Array.isArray(contents)) {
|
||||||
return (<ls.MarkedString[]>contents);
|
return contents.map(toMarkdownString);
|
||||||
}
|
}
|
||||||
return [<ls.MarkedString>contents];
|
return [toMarkdownString(contents)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue