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: 8 additions & 1 deletion src/goOutline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ const goKindToCodeKind: { [key: string]: vscode.SymbolKind } = {
'import': vscode.SymbolKind.Namespace,
'variable': vscode.SymbolKind.Variable,
'type': vscode.SymbolKind.Interface,
'function': vscode.SymbolKind.Function
'function': vscode.SymbolKind.Function,
'struct': vscode.SymbolKind.Struct,
};


Expand All @@ -149,11 +150,17 @@ function convertToCodeSymbols(
label = '(' + decl.receiverType + ').' + label;
}


let range = null;
if (document && byteOffsetToDocumentOffset) {
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';
}
}

let symbolInfo = new vscode.SymbolInformation(
Expand Down