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 all 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
32 changes: 24 additions & 8 deletions src/monaco-converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
}

Expand Down
2 changes: 1 addition & 1 deletion src/monaco-languages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}
}
Expand Down