From 4529da906db7f18aaf384c079332e4ea12c82d55 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 24 Oct 2019 14:01:02 +0300 Subject: for highlighting, search only the current file --- crates/ra_lsp_server/src/main_loop/handlers.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'crates/ra_lsp_server') diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs index e65f075a6..a29971d10 100644 --- a/crates/ra_lsp_server/src/main_loop/handlers.rs +++ b/crates/ra_lsp_server/src/main_loop/handlers.rs @@ -9,7 +9,9 @@ use lsp_types::{ Hover, HoverContents, Location, MarkupContent, MarkupKind, Position, PrepareRenameResponse, Range, RenameParams, SymbolInformation, TextDocumentIdentifier, TextEdit, WorkspaceEdit, }; -use ra_ide_api::{AssistId, FileId, FilePosition, FileRange, Query, Runnable, RunnableKind}; +use ra_ide_api::{ + AssistId, FileId, FilePosition, FileRange, Query, Runnable, RunnableKind, SearchScope, +}; use ra_prof::profile; use ra_syntax::{AstNode, SyntaxKind, TextRange, TextUnit}; use rustc_hash::FxHashMap; @@ -485,7 +487,7 @@ pub fn handle_references( let _p = profile("handle_references"); let position = params.text_document_position.try_conv_with(&world)?; - let refs = match world.analysis().find_all_refs(position)? { + let refs = match world.analysis().find_all_refs(position, None)? { None => return Ok(None), Some(refs) => refs, }; @@ -748,7 +750,10 @@ pub fn handle_document_highlight( let file_id = params.text_document.try_conv_with(&world)?; let line_index = world.analysis().file_line_index(file_id)?; - let refs = match world.analysis().find_all_refs(params.try_conv_with(&world)?)? { + let refs = match world + .analysis() + .find_all_refs(params.try_conv_with(&world)?, Some(SearchScope::single_file(file_id)))? + { None => return Ok(None), Some(refs) => refs, }; -- cgit v1.2.3