Skip to content

Commit

Permalink
Adding missing conversion from DocumentSymbol
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Berthoux authored and akosyakov committed Sep 3, 2018
1 parent 6305d31 commit 6d6f321
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
19 changes: 16 additions & 3 deletions src/monaco-converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -477,10 +477,23 @@ export class ProtocolToMonacoConverter {
};
}

asDocumentSymbolResult(values: SymbolInformation[] | DocumentSymbol[]): monaco.languages.DocumentSymbol[] {
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[]);
}
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

0 comments on commit 6d6f321

Please sign in to comment.