move highlightning to a separate file
This commit is contained in:
parent
e80021cbd0
commit
dc496d0516
@ -14,6 +14,7 @@ mod db;
|
|||||||
mod imp;
|
mod imp;
|
||||||
mod completion;
|
mod completion;
|
||||||
mod symbol_index;
|
mod symbol_index;
|
||||||
|
mod syntax_highlighting;
|
||||||
pub mod mock_analysis;
|
pub mod mock_analysis;
|
||||||
|
|
||||||
use std::{fmt, sync::Arc};
|
use std::{fmt, sync::Arc};
|
||||||
@ -340,8 +341,7 @@ impl Analysis {
|
|||||||
Ok(ra_editor::runnables(&file))
|
Ok(ra_editor::runnables(&file))
|
||||||
}
|
}
|
||||||
pub fn highlight(&self, file_id: FileId) -> Cancelable<Vec<HighlightedRange>> {
|
pub fn highlight(&self, file_id: FileId) -> Cancelable<Vec<HighlightedRange>> {
|
||||||
let file = self.imp.file_syntax(file_id);
|
syntax_highlighting::highlight(&*self.imp.db, file_id)
|
||||||
Ok(ra_editor::highlight(&file))
|
|
||||||
}
|
}
|
||||||
pub fn completions(&self, position: FilePosition) -> Cancelable<Option<Vec<CompletionItem>>> {
|
pub fn completions(&self, position: FilePosition) -> Cancelable<Option<Vec<CompletionItem>>> {
|
||||||
self.imp.completions(position)
|
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…
x
Reference in New Issue
Block a user