Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Differentiate between interfaces and structs in outline #2114

Merged
merged 9 commits into from
Nov 21, 2018
9 changes: 6 additions & 3 deletions src/goOutline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,13 @@ function convertToCodeSymbols(
let start = byteOffsetToDocumentOffset(decl.start - 1);
let end = byteOffsetToDocumentOffset(decl.end - 1);
range = new vscode.Range(document.positionAt(start), document.positionAt(end));
if (decl.type === 'type') {
let line = document.lineAt(document.positionAt(start));
let regex = new RegExp('\\bstruct\\b');
karthikraobr marked this conversation as resolved.
Show resolved Hide resolved
decl.type = line.text.match(regex) ? 'struct' : 'type';
}
}
if (decl.type === 'type') {
decl.type = document.getText(range).includes('struct') ? 'struct' : 'type';
}

let symbolInfo = new vscode.SymbolInformation(
label,
goKindToCodeKind[decl.type],
Expand Down