From 1b19a8aa5ecfc9d7115f291b97d413bd845c89b5 Mon Sep 17 00:00:00 2001 From: Jeremy Kolb Date: Mon, 30 Dec 2019 09:12:06 -0500 Subject: Implement proposed CallHierarchy feature See: https://github.com/microsoft/vscode-languageserver-node/blob/master/protocol/src/protocol.callHierarchy.proposed.ts --- crates/ra_lsp_server/src/conv.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'crates/ra_lsp_server/src/conv.rs') diff --git a/crates/ra_lsp_server/src/conv.rs b/crates/ra_lsp_server/src/conv.rs index e93d4ea33..c260b51c4 100644 --- a/crates/ra_lsp_server/src/conv.rs +++ b/crates/ra_lsp_server/src/conv.rs @@ -490,6 +490,24 @@ impl TryConvWith<&WorldSnapshot> for (FileId, RangeInfo>) } } +pub fn to_call_hierarchy_item( + file_id: FileId, + range: TextRange, + world: &WorldSnapshot, + line_index: &LineIndex, + nav: NavigationTarget, +) -> Result { + Ok(lsp_types::CallHierarchyItem { + name: nav.name().to_string(), + kind: nav.kind().conv(), + tags: None, + detail: nav.description().map(|it| it.to_string()), + uri: file_id.try_conv_with(&world)?, + range: nav.range().conv_with(&line_index), + selection_range: range.conv_with(&line_index), + }) +} + pub fn to_location( file_id: FileId, range: TextRange, -- cgit v1.2.3