Skip to content

Commit

Permalink
fix: mapped type/signatures dont have icons
Browse files Browse the repository at this point in the history
  • Loading branch information
mxsdev committed Oct 18, 2022
1 parent ce78ef7 commit 1f16913
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/api/src/localizedTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ type TypeInfoChildren = ({ info?: TypeInfo, localizedInfo?: LocalizedTypeInfo, o

export type LocalizedTypeInfo = {
kindText?: string,
kind?: ResolvedTypeInfo['kind'],
kind?: ResolvedTypeInfo['kind']|'signature'|'index_info',
primitiveKind?: TypeInfoKind<'primitive'>['primitive'],
alias?: string,
symbol?: LocalizedSymbolInfo,
Expand Down Expand Up @@ -324,6 +324,7 @@ function getChildren(info: ResolvedTypeInfo, { typeArguments: contextualTypeArgu
function getLocalizedIndex(indexInfo: IndexInfo) {
return createChild({
kindText: "index",
kind: "index_info",
symbol: wrapSafe(localizeSymbol)(indexInfo.parameterSymbol),
children: [
...indexInfo.keyType ? [localizeOpts(indexInfo.keyType, { purpose: 'index_type'})] : [],
Expand All @@ -337,6 +338,7 @@ function getChildren(info: ResolvedTypeInfo, { typeArguments: contextualTypeArgu

return createChild({
kindText: "signature",
kind: "signature",
symbol, locations: symbol?.locations,
children: getLocalizedSignatureChildren(signature, typeArguments),
})
Expand Down
2 changes: 2 additions & 0 deletions packages/typescript-explorer/src/view/typeTreeView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ function getMeta(info: LocalizedTypeInfo): TypeTreeItemMeta {
return ["symbol-struct"]
}

case "signature":
case "function": {
if(info.symbol?.insideClassOrInterface) {
return ["symbol-method"]
Expand All @@ -301,6 +302,7 @@ function getMeta(info: LocalizedTypeInfo): TypeTreeItemMeta {
return ["symbol-class"]
}

case "index_info":
case "indexed_access":
case "index": {
return ["key", "symbolIcon.keyForeground"]
Expand Down

0 comments on commit 1f16913

Please sign in to comment.