move highlightning to a separate file
This commit is contained in:
parent
e80021cbd0
commit
dc496d0516
@ -14,6 +14,7 @@ macro_rules! ctry {
|
||||
mod imp;
|
||||
mod completion;
|
||||
mod symbol_index;
|
||||
mod syntax_highlighting;
|
||||
pub mod mock_analysis;
|
||||
|
||||
use std::{fmt, sync::Arc};
|
||||
@ -340,8 +341,7 @@ pub fn runnables(&self, file_id: FileId) -> Cancelable<Vec<Runnable>> {
|
||||
Ok(ra_editor::runnables(&file))
|
||||
}
|
||||
pub fn highlight(&self, file_id: FileId) -> Cancelable<Vec<HighlightedRange>> {
|
||||
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<Option<Vec<CompletionItem>>> {
|
||||
self.imp.completions(position)
|
||||
|
12
crates/ra_analysis/src/syntax_highlighting.rs
Normal file
12
crates/ra_analysis/src/syntax_highlighting.rs
Normal file
@ -0,0 +1,12 @@
|
||||
use ra_editor::HighlightedRange;
|
||||
use ra_db::SyntaxDatabase;
|
||||
|
||||
use crate::{
|
||||
db::RootDatabase,
|
||||
FileId, Cancelable,
|
||||
};
|
||||
|
||||
pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Cancelable<Vec<HighlightedRange>> {
|
||||
let file = db.source_file(file_id);
|
||||
Ok(ra_editor::highlight(&file))
|
||||
}
|
Loading…
Reference in New Issue
Block a user