Skip to content

Commit 82160d1

Browse files
Tweak the appearance to match the old managed LS behavior.
1 parent b43c123 commit 82160d1

File tree

1 file changed

+41
-4
lines changed

1 file changed

+41
-4
lines changed

src/services/services.ts

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2255,26 +2255,63 @@ module ts {
22552255
return undefined;
22562256
}
22572257

2258+
// Having all this logic here is pretty unclean. Consider moving to the roslyn model
2259+
// where all symbol display logic is encapsulated into visitors and options.
22582260
var totalParts: SymbolDisplayPart[] = [];
2261+
var addType = false;
2262+
22592263
if (symbol.flags & SymbolFlags.Class) {
22602264
totalParts.push({ text: "class", kind: SymbolDisplayPartKind.keyword, symbol: undefined });
2265+
totalParts.push({ text: " ", kind: SymbolDisplayPartKind.space, symbol: undefined });
22612266
}
22622267
else if (symbol.flags & SymbolFlags.Interface) {
22632268
totalParts.push({ text: "interface", kind: SymbolDisplayPartKind.keyword, symbol: undefined });
2269+
totalParts.push({ text: " ", kind: SymbolDisplayPartKind.space, symbol: undefined });
22642270
}
22652271
else if (symbol.flags & SymbolFlags.Enum) {
22662272
totalParts.push({ text: "enum", kind: SymbolDisplayPartKind.keyword, symbol: undefined });
2273+
totalParts.push({ text: " ", kind: SymbolDisplayPartKind.space, symbol: undefined });
22672274
}
22682275
else if (symbol.flags & SymbolFlags.Module) {
22692276
totalParts.push({ text: "module", kind: SymbolDisplayPartKind.keyword, symbol: undefined });
2277+
totalParts.push({ text: " ", kind: SymbolDisplayPartKind.space, symbol: undefined });
2278+
}
2279+
else if (symbol.flags & SymbolFlags.TypeParameter) {
2280+
}
2281+
else {
2282+
addType = true;
2283+
totalParts.push({ text: "(", kind: SymbolDisplayPartKind.punctuation, symbol: undefined });
2284+
var text: string;
2285+
2286+
if (symbol.flags & SymbolFlags.Property) { text = "property" }
2287+
else if (symbol.flags & SymbolFlags.EnumMember) { text = "enum member" }
2288+
else if (symbol.flags & SymbolFlags.Function) { text = "function" }
2289+
else if (symbol.flags & SymbolFlags.Variable) { text = "variable" }
2290+
else if (symbol.flags & SymbolFlags.Method) { text = "method" }
2291+
2292+
if (!text) {
2293+
return undefined;
2294+
}
2295+
2296+
totalParts.push({ text: text, kind: SymbolDisplayPartKind.text, symbol: undefined });
2297+
totalParts.push({ text: ")", kind: SymbolDisplayPartKind.punctuation, symbol: undefined });
2298+
totalParts.push({ text: " ", kind: SymbolDisplayPartKind.space, symbol: undefined });
22702299
}
22712300

2272-
totalParts.push({ text: " ", kind: SymbolDisplayPartKind.space, symbol: undefined });
22732301
totalParts.push.apply(totalParts, typeInfoResolver.symbolToDisplayParts(symbol, getContainerNode(node)));
22742302

2275-
var type = typeInfoResolver.getTypeOfSymbol(symbol);
2276-
if (type) {
2277-
totalParts.push.apply(totalParts, typeInfoResolver.typeToDisplayParts(type));
2303+
if (symbol.flags & SymbolFlags.Property ||
2304+
symbol.flags & SymbolFlags.EnumMember ||
2305+
symbol.flags & SymbolFlags.Variable) {
2306+
2307+
totalParts.push({ text: ".", kind: SymbolDisplayPartKind.punctuation, symbol: undefined });
2308+
}
2309+
2310+
if (addType) {
2311+
var type = typeInfoResolver.getTypeOfSymbol(symbol);
2312+
if (type) {
2313+
totalParts.push.apply(totalParts, typeInfoResolver.typeToDisplayParts(type));
2314+
}
22782315
}
22792316

22802317
return new QuickInfo(

0 commit comments

Comments
 (0)