From a18d3e6e2d97286681c0479c578680afe998f6e9 Mon Sep 17 00:00:00 2001 From: Qiming Zhao Date: Mon, 16 Aug 2021 23:24:48 +0800 Subject: [PATCH] use relative path for callHierarchy detail --- src/server/features/callHierarchy.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/server/features/callHierarchy.ts b/src/server/features/callHierarchy.ts index e8bb791..af6338a 100644 --- a/src/server/features/callHierarchy.ts +++ b/src/server/features/callHierarchy.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { CallHierarchyProvider, TextDocument, Uri } from 'coc.nvim' +import { CallHierarchyProvider, TextDocument, Uri, workspace } from 'coc.nvim' import path from "path" import { CallHierarchyIncomingCall, CallHierarchyItem, CallHierarchyOutgoingCall, CancellationToken, Position, SymbolTag } from 'vscode-languageserver-protocol' import type * as Proto from '../protocol' @@ -80,9 +80,7 @@ function parseKindModifier(kindModifiers: string): Set { function fromProtocolCallHierarchyItem(item: Proto.CallHierarchyItem): CallHierarchyItem { const useFileName = isSourceFileItem(item) const name = useFileName ? path.basename(item.file) : item.name - // TODO - // const detail = useFileName ? workspace.asRelativePath(path.dirname(item.file)) : item.containerName ?? '' - const detail = item.containerName || '' + const detail = useFileName ? path.relative(workspace.cwd, path.dirname(item.file)) : item.containerName ?? '' const result: CallHierarchyItem = { name, detail,