From dc496d05160f9693a4e48977b7f7a3fe2689ac51 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 28 Dec 2018 13:14:39 +0300 Subject: move highlightning to a separate file --- crates/ra_analysis/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/ra_analysis/src/lib.rs') diff --git a/crates/ra_analysis/src/lib.rs b/crates/ra_analysis/src/lib.rs index 65c3eb3ec..b26e9e9ff 100644 --- a/crates/ra_analysis/src/lib.rs +++ b/crates/ra_analysis/src/lib.rs @@ -14,6 +14,7 @@ mod db; mod imp; mod completion; mod symbol_index; +mod syntax_highlighting; pub mod mock_analysis; use std::{fmt, sync::Arc}; @@ -340,8 +341,7 @@ impl Analysis { Ok(ra_editor::runnables(&file)) } pub fn highlight(&self, file_id: FileId) -> Cancelable> { - let file = self.imp.file_syntax(file_id); - Ok(ra_editor::highlight(&file)) + syntax_highlighting::highlight(&*self.imp.db, file_id) } pub fn completions(&self, position: FilePosition) -> Cancelable>> { self.imp.completions(position) -- cgit v1.2.3 From 02924174bb084d73cab67af6665ddf00e91983f6 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 28 Dec 2018 18:03:03 +0300 Subject: introduce FileRange --- crates/ra_analysis/src/lib.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'crates/ra_analysis/src/lib.rs') diff --git a/crates/ra_analysis/src/lib.rs b/crates/ra_analysis/src/lib.rs index b26e9e9ff..3fa4189ce 100644 --- a/crates/ra_analysis/src/lib.rs +++ b/crates/ra_analysis/src/lib.rs @@ -38,7 +38,7 @@ pub use ra_editor::{ pub use hir::FnSignatureInfo; pub use ra_db::{ - Canceled, Cancelable, FilePosition, + Canceled, Cancelable, FilePosition, FileRange, CrateGraph, CrateId, SourceRootId, FileId }; @@ -287,9 +287,9 @@ impl Analysis { let file = self.imp.file_syntax(file_id); ra_editor::syntax_tree(&file) } - pub fn join_lines(&self, file_id: FileId, range: TextRange) -> SourceChange { - let file = self.imp.file_syntax(file_id); - SourceChange::from_local_edit(file_id, ra_editor::join_lines(&file, range)) + pub fn join_lines(&self, frange: FileRange) -> SourceChange { + let file = self.imp.file_syntax(frange.file_id); + SourceChange::from_local_edit(frange.file_id, ra_editor::join_lines(&file, frange.range)) } pub fn on_enter(&self, position: FilePosition) -> Option { let file = self.imp.file_syntax(position.file_id); @@ -346,8 +346,8 @@ impl Analysis { pub fn completions(&self, position: FilePosition) -> Cancelable>> { self.imp.completions(position) } - pub fn assists(&self, file_id: FileId, range: TextRange) -> Cancelable> { - Ok(self.imp.assists(file_id, range)) + pub fn assists(&self, frange: FileRange) -> Cancelable> { + Ok(self.imp.assists(frange)) } pub fn diagnostics(&self, file_id: FileId) -> Cancelable> { self.imp.diagnostics(file_id) @@ -358,8 +358,8 @@ impl Analysis { ) -> Cancelable)>> { self.imp.resolve_callable(position) } - pub fn type_of(&self, file_id: FileId, range: TextRange) -> Cancelable> { - self.imp.type_of(file_id, range) + pub fn type_of(&self, frange: FileRange) -> Cancelable> { + self.imp.type_of(frange) } } -- cgit v1.2.3 From fd33c89207f6dc621ef6e8c26ea288089448d811 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 28 Dec 2018 18:15:19 +0300 Subject: switch to FileRange --- crates/ra_analysis/src/lib.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'crates/ra_analysis/src/lib.rs') diff --git a/crates/ra_analysis/src/lib.rs b/crates/ra_analysis/src/lib.rs index 3fa4189ce..98abe8523 100644 --- a/crates/ra_analysis/src/lib.rs +++ b/crates/ra_analysis/src/lib.rs @@ -14,9 +14,11 @@ mod db; mod imp; mod completion; mod symbol_index; -mod syntax_highlighting; pub mod mock_analysis; +mod extend_selection; +mod syntax_highlighting; + use std::{fmt, sync::Arc}; use rustc_hash::FxHashMap; @@ -277,8 +279,8 @@ impl Analysis { pub fn file_line_index(&self, file_id: FileId) -> Arc { self.imp.file_line_index(file_id) } - pub fn extend_selection(&self, file: &SourceFileNode, range: TextRange) -> TextRange { - ra_editor::extend_selection(file, range).unwrap_or(range) + pub fn extend_selection(&self, frange: FileRange) -> TextRange { + extend_selection::extend_selection(&self.imp.db, frange) } pub fn matching_brace(&self, file: &SourceFileNode, offset: TextUnit) -> Option { ra_editor::matching_brace(file, offset) -- cgit v1.2.3 From b911ee542b2f4d1cd62a655f24197856cd9b9097 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 28 Dec 2018 18:21:30 +0300 Subject: move macro to a separate module --- crates/ra_analysis/src/lib.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'crates/ra_analysis/src/lib.rs') diff --git a/crates/ra_analysis/src/lib.rs b/crates/ra_analysis/src/lib.rs index 98abe8523..67b1c1482 100644 --- a/crates/ra_analysis/src/lib.rs +++ b/crates/ra_analysis/src/lib.rs @@ -18,6 +18,7 @@ pub mod mock_analysis; mod extend_selection; mod syntax_highlighting; +mod macros; use std::{fmt, sync::Arc}; -- cgit v1.2.3