diff --git a/CHANGELOG.md b/CHANGELOG.md index 63931f204..1ce02aa0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Changelog All notable changes to this project will be documented in this file. +## [0.7.3] - 2018-08-?? +- updated dependency to Monaco 0.14.2, with adaptation for breaking changes from monaco. + ## [0.7.2] - 2018-08-02 - amd distribution ([#97](https://github.com/TypeFox/monaco-languageclient/pull/97)) - thanks to @zewa666 - updated dependency to Monaco 0.13.2 ([#100](https://github.com/TypeFox/monaco-languageclient/pull/100)) diff --git a/examples/browser/src/client.ts b/examples/browser/src/client.ts index 370618d7f..58ea04eb3 100644 --- a/examples/browser/src/client.ts +++ b/examples/browser/src/client.ts @@ -79,7 +79,7 @@ monaco.languages.registerDocumentRangeFormattingEditProvider(LANGUAGE_ID, { }); monaco.languages.registerDocumentSymbolProvider(LANGUAGE_ID, { - provideDocumentSymbols(model, token): monaco.languages.SymbolInformation[] | Thenable { + provideDocumentSymbols(model, token): monaco.languages.DocumentSymbol[] | Thenable { const document = createDocument(model); const jsonDocument = jsonService.parseJSONDocument(document); return p2m.asSymbolInformations(jsonService.findDocumentSymbols(document, jsonDocument)); diff --git a/package.json b/package.json index 9fd3f0712..880032d7f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "monaco-languageclient", - "version": "0.7.2", + "version": "0.7.3", "description": "Monaco Language client implementation", "author": "TypeFox GmbH (http://www.typefox.io)", "license": "MIT", @@ -24,7 +24,7 @@ }, "dependencies": { "glob-to-regexp": "^0.3.0", - "monaco-editor-core": "^0.13.2", + "monaco-editor-core": "^0.14.6", "vscode-jsonrpc": "^3.6.2", "vscode-base-languageclient": "4.4.0", "vscode-uri": "^1.0.5" diff --git a/src/monaco-converter.ts b/src/monaco-converter.ts index 320af156d..ee4e1f5b8 100644 --- a/src/monaco-converter.ts +++ b/src/monaco-converter.ts @@ -477,30 +477,46 @@ export class ProtocolToMonacoConverter { }; } - asDocumentSymbolResult(values: SymbolInformation[] | DocumentSymbol[]): monaco.languages.SymbolInformation[] { + asDocumentSymbolInformation(value: DocumentSymbol) : monaco.languages.DocumentSymbol { + return { + name: value.name, + detail: value.detail || "", + kind: this.asSymbolKind(value.kind), + containerName: "", + range: this.asRange(value.range), + selectionRange: this.asRange(value.selectionRange), + children: value.children + ? value.children.map(c => this.asDocumentSymbolInformation(c)) + : [] + }; + } + + asDocumentSymbol(values: SymbolInformation[] | DocumentSymbol[]): monaco.languages.DocumentSymbol[] { if (DocumentSymbol.is(values[0])) { - // FIXME when Monaco supports DocumentSymbol - return []; + return (values as DocumentSymbol[]).map(s => this.asDocumentSymbolInformation(s)); } return this.asSymbolInformations(values as SymbolInformation[]); } - asSymbolInformations(values: SymbolInformation[], uri?: monaco.Uri): monaco.languages.SymbolInformation[]; + asSymbolInformations(values: SymbolInformation[], uri?: monaco.Uri): monaco.languages.DocumentSymbol[]; asSymbolInformations(values: undefined | null, uri?: monaco.Uri): undefined; - asSymbolInformations(values: SymbolInformation[] | undefined | null, uri?: monaco.Uri): monaco.languages.SymbolInformation[] | undefined; - asSymbolInformations(values: SymbolInformation[] | undefined | null, uri?: monaco.Uri): monaco.languages.SymbolInformation[] | undefined { + asSymbolInformations(values: SymbolInformation[] | undefined | null, uri?: monaco.Uri): monaco.languages.DocumentSymbol[] | undefined; + asSymbolInformations(values: SymbolInformation[] | undefined | null, uri?: monaco.Uri): monaco.languages.DocumentSymbol[] | undefined { if (!values) { return undefined; } return values.map(information => this.asSymbolInformation(information, uri)); } - asSymbolInformation(item: SymbolInformation, uri?: monaco.Uri): monaco.languages.SymbolInformation { + asSymbolInformation(item: SymbolInformation, uri?: monaco.Uri): monaco.languages.DocumentSymbol { + const location = this.asLocation(uri ? { ...item.location, uri: uri.toString() } : item.location); return { name: item.name, + detail: '', containerName: item.containerName, kind: this.asSymbolKind(item.kind), - location: this.asLocation(uri ? { ...item.location, uri: uri.toString() } : item.location) + range: location.range, + selectionRange: location.range }; } diff --git a/src/monaco-languages.ts b/src/monaco-languages.ts index c6f60614a..dc225334f 100644 --- a/src/monaco-languages.ts +++ b/src/monaco-languages.ts @@ -234,7 +234,7 @@ export class MonacoLanguages implements Languages { return []; } const params = this.m2p.asDocumentSymbolParams(model); - return provider.provideDocumentSymbols(params, token).then(result => this.p2m.asDocumentSymbolResult(result)) + return provider.provideDocumentSymbols(params, token).then(result => this.p2m.asDocumentSymbol(result)) } } }