fix usages after rename

This commit is contained in:
Aleksey Kladov 2019-01-08 22:30:32 +03:00
parent 1967884d68
commit fa3c9ce392
10 changed files with 62 additions and 45 deletions

58
Cargo.lock generated
View file

@ -171,7 +171,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -548,7 +548,7 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
@ -645,8 +645,8 @@ dependencies = [
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"ra_db 0.1.0",
"ra_editor 0.1.0",
"ra_hir 0.1.0",
"ra_ide_api_light 0.1.0",
"ra_syntax 0.1.0",
"ra_text_edit 0.1.0",
"rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -668,7 +668,7 @@ dependencies = [
"clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"join_to_string 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"ra_editor 0.1.0",
"ra_ide_api_light 0.1.0",
"ra_syntax 0.1.0",
"tools 0.1.0",
]
@ -686,20 +686,6 @@ dependencies = [
"test_utils 0.1.0",
]
[[package]]
name = "ra_editor"
version = "0.1.0"
dependencies = [
"itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"join_to_string 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"proptest 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)",
"ra_syntax 0.1.0",
"ra_text_edit 0.1.0",
"rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"superslice 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"test_utils 0.1.0",
]
[[package]]
name = "ra_hir"
version = "0.1.0"
@ -718,6 +704,20 @@ dependencies = [
"test_utils 0.1.0",
]
[[package]]
name = "ra_ide_api_light"
version = "0.1.0"
dependencies = [
"itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"join_to_string 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"proptest 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)",
"ra_syntax 0.1.0",
"ra_text_edit 0.1.0",
"rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"superslice 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"test_utils 0.1.0",
]
[[package]]
name = "ra_lsp_server"
version = "0.1.0"
@ -806,7 +806,7 @@ dependencies = [
[[package]]
name = "rand"
version = "0.6.3"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"autocfg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -815,7 +815,7 @@ dependencies = [
"rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_os 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_os 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_pcg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
@ -861,13 +861,14 @@ dependencies = [
[[package]]
name = "rand_os"
version = "0.1.0"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -909,6 +910,14 @@ dependencies = [
"num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rdrand"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "redox_syscall"
version = "0.1.50"
@ -1164,7 +1173,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)",
"remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1551,17 +1560,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0"
"checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c"
"checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c"
"checksum rand 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b65e163105a6284f841bd23100a015895f54340e88a5ffc9ca7b8b33827cfce0"
"checksum rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3906503e80ac6cbcacb2c2973fa8e473f24d7e2747c8c92bb230c2441cad96b5"
"checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef"
"checksum rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1961a422c4d189dfb50ffa9320bf1f2a9bd54ecb92792fb9477f99a1045f3372"
"checksum rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0905b6b7079ec73b314d4c748701f6931eb79fd97c668caa3f1899b22b32c6db"
"checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4"
"checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08"
"checksum rand_os 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de5ac4de1c2973e1391dc305cb0fbf8788cb58068e98255439b7485a77022273"
"checksum rand_os 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f46fbd5550acf75b0c2730f5dd1873751daf9beb8f11b44027778fae50d7feca"
"checksum rand_pcg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "086bd09a33c7044e56bb44d5bdde5a60e7f119a9e95b0775f545de759a32fe05"
"checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c"
"checksum rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "373814f27745b2686b350dd261bfd24576a6fb0e2c5919b3a2b6005f820b0473"
"checksum rayon-core 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b055d1e92aba6877574d8fe604a63c8b5df60f60e5982bf7ccbb1338ea527356"
"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
"checksum redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)" = "52ee9a534dc1301776eff45b4fa92d2c39b1d8c3d3357e6eb593e0d795506fc2"
"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
"checksum regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37e7cbbd370869ce2e8dff25c7018702d10b21a20ef7135316f8daecd6c25b7f"

View file

@ -16,7 +16,7 @@ parking_lot = "0.7.0"
unicase = "2.2.0"
ra_syntax = { path = "../ra_syntax" }
ra_editor = { path = "../ra_editor" }
ra_ide_api_light = { path = "../ra_ide_api_light" }
ra_text_edit = { path = "../ra_text_edit" }
ra_db = { path = "../ra_db" }
hir = { path = "../ra_hir", package = "ra_hir" }

View file

@ -14,7 +14,7 @@ pub(crate) fn extend_selection(db: &RootDatabase, frange: FileRange) -> TextRang
if let Some(range) = extend_selection_in_macro(db, &source_file, frange) {
return range;
}
ra_editor::extend_selection(source_file.syntax(), frange.range).unwrap_or(frange.range)
ra_ide_api_light::extend_selection(source_file.syntax(), frange.range).unwrap_or(frange.range)
}
fn extend_selection_in_macro(
@ -25,7 +25,7 @@ fn extend_selection_in_macro(
let macro_call = find_macro_call(source_file.syntax(), frange.range)?;
let (off, exp) = hir::MacroDef::ast_expand(macro_call)?;
let dst_range = exp.map_range_forward(frange.range - off)?;
let dst_range = ra_editor::extend_selection(&exp.syntax(), dst_range)?;
let dst_range = ra_ide_api_light::extend_selection(&exp.syntax(), dst_range)?;
let src_range = exp.map_range_back(dst_range)? + off;
Some(src_range)
}

View file

@ -6,7 +6,7 @@ use hir::{
self, Problem, source_binder,
};
use ra_db::{FilesDatabase, SourceRoot, SourceRootId, SyntaxDatabase};
use ra_editor::{self, assists, LocalEdit, Severity};
use ra_ide_api_light::{self, assists, LocalEdit, Severity};
use ra_syntax::{
TextRange, AstNode, SourceFile,
ast::{self, NameOwner},
@ -194,7 +194,7 @@ impl db::RootDatabase {
pub(crate) fn diagnostics(&self, file_id: FileId) -> Cancelable<Vec<Diagnostic>> {
let syntax = self.source_file(file_id);
let mut res = ra_editor::diagnostics(&syntax)
let mut res = ra_ide_api_light::diagnostics(&syntax)
.into_iter()
.map(|d| Diagnostic {
range: d.range,

View file

@ -44,7 +44,7 @@ pub use crate::{
completion::{CompletionItem, CompletionItemKind, InsertText},
runnables::{Runnable, RunnableKind},
};
pub use ra_editor::{
pub use ra_ide_api_light::{
Fold, FoldKind, HighlightedRange, Severity, StructureNode,
LineIndex, LineCol, translate_offset_with_edit,
};
@ -336,25 +336,28 @@ impl Analysis {
/// Returns position of the mathcing brace (all types of braces are
/// supported).
pub fn matching_brace(&self, file: &SourceFile, offset: TextUnit) -> Option<TextUnit> {
ra_editor::matching_brace(file, offset)
ra_ide_api_light::matching_brace(file, offset)
}
/// Returns a syntax tree represented as `String`, for debug purposes.
// FIXME: use a better name here.
pub fn syntax_tree(&self, file_id: FileId) -> String {
let file = self.db.source_file(file_id);
ra_editor::syntax_tree(&file)
ra_ide_api_light::syntax_tree(&file)
}
/// Returns an edit to remove all newlines in the range, cleaning up minor
/// stuff like trailing commas.
pub fn join_lines(&self, frange: FileRange) -> SourceChange {
let file = self.db.source_file(frange.file_id);
SourceChange::from_local_edit(frange.file_id, ra_editor::join_lines(&file, frange.range))
SourceChange::from_local_edit(
frange.file_id,
ra_ide_api_light::join_lines(&file, frange.range),
)
}
/// Returns an edit which should be applied when opening a new line, fixing
/// up minor stuff like continuing the comment.
pub fn on_enter(&self, position: FilePosition) -> Option<SourceChange> {
let file = self.db.source_file(position.file_id);
let edit = ra_editor::on_enter(&file, position.offset)?;
let edit = ra_ide_api_light::on_enter(&file, position.offset)?;
Some(SourceChange::from_local_edit(position.file_id, edit))
}
/// Returns an edit which should be applied after `=` was typed. Primarily,
@ -362,25 +365,25 @@ impl Analysis {
// FIXME: use a snippet completion instead of this hack here.
pub fn on_eq_typed(&self, position: FilePosition) -> Option<SourceChange> {
let file = self.db.source_file(position.file_id);
let edit = ra_editor::on_eq_typed(&file, position.offset)?;
let edit = ra_ide_api_light::on_eq_typed(&file, position.offset)?;
Some(SourceChange::from_local_edit(position.file_id, edit))
}
/// Returns an edit which should be applied when a dot ('.') is typed on a blank line, indenting the line appropriately.
pub fn on_dot_typed(&self, position: FilePosition) -> Option<SourceChange> {
let file = self.db.source_file(position.file_id);
let edit = ra_editor::on_dot_typed(&file, position.offset)?;
let edit = ra_ide_api_light::on_dot_typed(&file, position.offset)?;
Some(SourceChange::from_local_edit(position.file_id, edit))
}
/// Returns a tree representation of symbols in the file. Useful to draw a
/// file outline.
pub fn file_structure(&self, file_id: FileId) -> Vec<StructureNode> {
let file = self.db.source_file(file_id);
ra_editor::file_structure(&file)
ra_ide_api_light::file_structure(&file)
}
/// Returns the set of folding ranges.
pub fn folding_ranges(&self, file_id: FileId) -> Vec<Fold> {
let file = self.db.source_file(file_id);
ra_editor::folding_ranges(&file)
ra_ide_api_light::folding_ranges(&file)
}
/// Fuzzy searches for a symbol.
pub fn symbol_search(&self, query: Query) -> Cancelable<Vec<NavigationTarget>> {

View file

@ -1,22 +1,21 @@
use ra_syntax::{ast, AstNode,};
use ra_editor::HighlightedRange;
use ra_db::SyntaxDatabase;
use crate::{
FileId, Cancelable, HighlightedRange,
db::RootDatabase,
FileId, Cancelable,
};
pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Cancelable<Vec<HighlightedRange>> {
let source_file = db.source_file(file_id);
let mut res = ra_editor::highlight(source_file.syntax());
let mut res = ra_ide_api_light::highlight(source_file.syntax());
for macro_call in source_file
.syntax()
.descendants()
.filter_map(ast::MacroCall::cast)
{
if let Some((off, exp)) = hir::MacroDef::ast_expand(macro_call) {
let mapped_ranges = ra_editor::highlight(&exp.syntax())
let mapped_ranges = ra_ide_api_light::highlight(&exp.syntax())
.into_iter()
.filter_map(|r| {
let mapped_range = exp.map_range_back(r.range)?;

View file

@ -10,5 +10,5 @@ clap = "2.32.0"
failure = "0.1.4"
join_to_string = "0.1.1"
ra_syntax = { path = "../ra_syntax" }
ra_editor = { path = "../ra_editor" }
ra_ide_api_light = { path = "../ra_ide_api_light" }
tools = { path = "../tools" }

View file

@ -2,7 +2,7 @@ use std::{fs, io::Read, path::Path, time::Instant};
use clap::{App, Arg, SubCommand};
use join_to_string::join;
use ra_editor::{extend_selection, file_structure, syntax_tree};
use ra_ide_api_light::{extend_selection, file_structure, syntax_tree};
use ra_syntax::{SourceFile, TextRange, TreePtr, AstNode};
use tools::collect_tests;

View file

@ -1,6 +1,6 @@
[package]
edition = "2018"
name = "ra_editor"
name = "ra_ide_api_light"
version = "0.1.0"
authors = ["Aleksey Kladov <aleksey.kladov@gmail.com>"]
publish = false

View file

@ -1,3 +1,8 @@
//! This crate provides thouse IDE features which use only a single file.
//!
//! This usually means functions which take sytnax tree as an input and produce
//! an edit or some auxilarly info.
pub mod assists;
mod extend_selection;
mod folding_ranges;