Skip to content

Commit b2d6894

Browse files
committed
completed symbol info
1 parent 459600f commit b2d6894

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
1-
import { SymbolInformation } from 'vscode';
1+
import { SymbolInformation, TextDocument, Range, Uri, Location } from 'vscode';
2+
import * as proxy from "../../providers/jediProxy";
23
export class SymbolInformationParser {
3-
public static parse(data: Object): SymbolInformation[] {
4-
return [];
4+
public static parse(data: proxy.ISymbolResult, document: TextDocument): SymbolInformation[] {
5+
if (!data || !Array.isArray(data.definitions) || data.definitions.length === 0) {
6+
return [];
7+
}
8+
let symbols = data.definitions.filter(sym => sym.fileName === document.fileName);
9+
return symbols.map(sym => {
10+
const symbol = sym.kind;
11+
const range = new Range(
12+
sym.range.startLine, sym.range.startColumn,
13+
sym.range.endLine, sym.range.endColumn);
14+
const uri = Uri.file(sym.fileName);
15+
const location = new Location(uri, range);
16+
return new SymbolInformation(sym.text, symbol, sym.container, location);
17+
});
518
}
619
}

0 commit comments

Comments
 (0)