mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-07 01:05:39 +03:00
move diagnostics to a separate file
This commit is contained in:
@@ -1,13 +1,8 @@
|
||||
use hir::{
|
||||
self, Problem, source_binder
|
||||
};
|
||||
use ra_ide_api_light::{self, LocalEdit, Severity};
|
||||
use hir::{Problem, source_binder};
|
||||
use ra_ide_api_light::Severity;
|
||||
use ra_db::SourceDatabase;
|
||||
|
||||
use crate::{
|
||||
db, Diagnostic, FileId, FilePosition, FileSystemEdit,
|
||||
SourceChange, SourceFileEdit,
|
||||
};
|
||||
use crate::{db, Diagnostic, FileId, FileSystemEdit, SourceChange};
|
||||
|
||||
impl db::RootDatabase {
|
||||
pub(crate) fn diagnostics(&self, file_id: FileId) -> Vec<Diagnostic> {
|
||||
@@ -74,20 +69,3 @@ pub(crate) fn diagnostics(&self, file_id: FileId) -> Vec<Diagnostic> {
|
||||
res
|
||||
}
|
||||
}
|
||||
|
||||
impl SourceChange {
|
||||
pub(crate) fn from_local_edit(file_id: FileId, edit: LocalEdit) -> SourceChange {
|
||||
let file_edit = SourceFileEdit {
|
||||
file_id,
|
||||
edit: edit.edit,
|
||||
};
|
||||
SourceChange {
|
||||
label: edit.label,
|
||||
source_file_edits: vec![file_edit],
|
||||
file_system_edits: vec![],
|
||||
cursor_position: edit
|
||||
.cursor_position
|
||||
.map(|offset| FilePosition { offset, file_id }),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,6 @@
|
||||
#![recursion_limit = "128"]
|
||||
|
||||
mod db;
|
||||
mod imp;
|
||||
pub mod mock_analysis;
|
||||
mod symbol_index;
|
||||
mod navigation_target;
|
||||
@@ -32,6 +31,7 @@
|
||||
mod references;
|
||||
mod impls;
|
||||
mod assists;
|
||||
mod diagnostics;
|
||||
|
||||
#[cfg(test)]
|
||||
mod marks;
|
||||
@@ -58,7 +58,7 @@
|
||||
change::{AnalysisChange, LibraryData},
|
||||
};
|
||||
pub use ra_ide_api_light::{
|
||||
Fold, FoldKind, HighlightedRange, Severity, StructureNode,
|
||||
Fold, FoldKind, HighlightedRange, Severity, StructureNode, LocalEdit,
|
||||
LineIndex, LineCol, translate_offset_with_edit,
|
||||
};
|
||||
pub use ra_db::{
|
||||
@@ -399,6 +399,23 @@ fn with_db<F: FnOnce(&db::RootDatabase) -> T + std::panic::UnwindSafe, T>(
|
||||
}
|
||||
}
|
||||
|
||||
impl SourceChange {
|
||||
pub(crate) fn from_local_edit(file_id: FileId, edit: LocalEdit) -> SourceChange {
|
||||
let file_edit = SourceFileEdit {
|
||||
file_id,
|
||||
edit: edit.edit,
|
||||
};
|
||||
SourceChange {
|
||||
label: edit.label,
|
||||
source_file_edits: vec![file_edit],
|
||||
file_system_edits: vec![],
|
||||
cursor_position: edit
|
||||
.cursor_position
|
||||
.map(|offset| FilePosition { offset, file_id }),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn analysis_is_send() {
|
||||
fn is_send<T: Send>() {}
|
||||
|
||||
Reference in New Issue
Block a user