ra_db is independent from editor

This commit is contained in:
Aleksey Kladov 2019-01-08 21:00:51 +03:00
parent 0c88360eb4
commit 695294bbb9
7 changed files with 28 additions and 24 deletions

View file

@ -5,9 +5,6 @@ mod input;
mod loc2id;
pub mod mock;
use std::sync::Arc;
use ra_editor::LineIndex;
use ra_syntax::{TextUnit, TextRange, SourceFile, TreePtr};
pub use crate::{
@ -36,9 +33,6 @@ salsa::query_group! {
fn source_file(file_id: FileId) -> TreePtr<SourceFile> {
type SourceFileQuery;
}
fn file_lines(file_id: FileId) -> Arc<LineIndex> {
type FileLinesQuery;
}
}
}
@ -46,10 +40,6 @@ fn source_file(db: &impl SyntaxDatabase, file_id: FileId) -> TreePtr<SourceFile>
let text = db.file_text(file_id);
SourceFile::parse(&*text)
}
fn file_lines(db: &impl SyntaxDatabase, file_id: FileId) -> Arc<LineIndex> {
let text = db.file_text(file_id);
Arc::new(LineIndex::new(&*text))
}
#[derive(Clone, Copy, Debug)]
pub struct FilePosition {