Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bumping to monaco 0.14.2 #107

Merged
merged 3 commits into from
Sep 3, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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))
Expand Down
2 changes: 1 addition & 1 deletion examples/browser/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ monaco.languages.registerDocumentRangeFormattingEditProvider(LANGUAGE_ID, {
});

monaco.languages.registerDocumentSymbolProvider(LANGUAGE_ID, {
provideDocumentSymbols(model, token): monaco.languages.SymbolInformation[] | Thenable<monaco.languages.SymbolInformation[]> {
provideDocumentSymbols(model, token): monaco.languages.DocumentSymbol[] | Thenable<monaco.languages.DocumentSymbol[]> {
const document = createDocument(model);
const jsonDocument = jsonService.parseJSONDocument(document);
return p2m.asSymbolInformations(jsonService.findDocumentSymbols(document, jsonDocument));
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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"
Expand Down
15 changes: 9 additions & 6 deletions src/monaco-converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -477,30 +477,33 @@ export class ProtocolToMonacoConverter {
};
}

asDocumentSymbolResult(values: SymbolInformation[] | DocumentSymbol[]): monaco.languages.SymbolInformation[] {
asDocumentSymbolResult(values: SymbolInformation[] | DocumentSymbol[]): monaco.languages.DocumentSymbol[] {
if (DocumentSymbol.is(values[0])) {
// FIXME when Monaco supports DocumentSymbol
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Twinside this is great! Would you be able also to add missing conversion? Now it should be possible. We should do it by analogy with https://github.com/Microsoft/vscode-languageserver-node/blob/7850be5cce4ed39485150969de14947d08c47375/client/src/protocolConverter.ts#L517-L542

return [];
}
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
};
}

Expand Down