diff options
author | Aleksey Kladov <[email protected]> | 2019-10-24 12:01:02 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-10-24 12:16:36 +0100 |
commit | 4529da906db7f18aaf384c079332e4ea12c82d55 (patch) | |
tree | df095e7f3a20f9c5b3df09c4722d0e3e406b122f /crates/ra_lsp_server | |
parent | 6d186ec3beff14bc161d1c7b7c98b412c4f833d9 (diff) |
for highlighting, search only the current file
Diffstat (limited to 'crates/ra_lsp_server')
-rw-r--r-- | crates/ra_lsp_server/src/main_loop/handlers.rs | 11 |
1 files changed, 8 insertions, 3 deletions
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::{ | |||
9 | Hover, HoverContents, Location, MarkupContent, MarkupKind, Position, PrepareRenameResponse, | 9 | Hover, HoverContents, Location, MarkupContent, MarkupKind, Position, PrepareRenameResponse, |
10 | Range, RenameParams, SymbolInformation, TextDocumentIdentifier, TextEdit, WorkspaceEdit, | 10 | Range, RenameParams, SymbolInformation, TextDocumentIdentifier, TextEdit, WorkspaceEdit, |
11 | }; | 11 | }; |
12 | use ra_ide_api::{AssistId, FileId, FilePosition, FileRange, Query, Runnable, RunnableKind}; | 12 | use ra_ide_api::{ |
13 | AssistId, FileId, FilePosition, FileRange, Query, Runnable, RunnableKind, SearchScope, | ||
14 | }; | ||
13 | use ra_prof::profile; | 15 | use ra_prof::profile; |
14 | use ra_syntax::{AstNode, SyntaxKind, TextRange, TextUnit}; | 16 | use ra_syntax::{AstNode, SyntaxKind, TextRange, TextUnit}; |
15 | use rustc_hash::FxHashMap; | 17 | use rustc_hash::FxHashMap; |
@@ -485,7 +487,7 @@ pub fn handle_references( | |||
485 | let _p = profile("handle_references"); | 487 | let _p = profile("handle_references"); |
486 | let position = params.text_document_position.try_conv_with(&world)?; | 488 | let position = params.text_document_position.try_conv_with(&world)?; |
487 | 489 | ||
488 | let refs = match world.analysis().find_all_refs(position)? { | 490 | let refs = match world.analysis().find_all_refs(position, None)? { |
489 | None => return Ok(None), | 491 | None => return Ok(None), |
490 | Some(refs) => refs, | 492 | Some(refs) => refs, |
491 | }; | 493 | }; |
@@ -748,7 +750,10 @@ pub fn handle_document_highlight( | |||
748 | let file_id = params.text_document.try_conv_with(&world)?; | 750 | let file_id = params.text_document.try_conv_with(&world)?; |
749 | let line_index = world.analysis().file_line_index(file_id)?; | 751 | let line_index = world.analysis().file_line_index(file_id)?; |
750 | 752 | ||
751 | let refs = match world.analysis().find_all_refs(params.try_conv_with(&world)?)? { | 753 | let refs = match world |
754 | .analysis() | ||
755 | .find_all_refs(params.try_conv_with(&world)?, Some(SearchScope::single_file(file_id)))? | ||
756 | { | ||
752 | None => return Ok(None), | 757 | None => return Ok(None), |
753 | Some(refs) => refs, | 758 | Some(refs) => refs, |
754 | }; | 759 | }; |