switch editor to 2018

This commit is contained in:
Aleksey Kladov 2018-10-15 20:05:26 +03:00
parent 9434920648
commit 1624bf2d7f
10 changed files with 14 additions and 13 deletions

View File

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

View File

@ -11,7 +11,7 @@
},
};
use {EditBuilder, Edit, find_node_at_offset};
use crate::{EditBuilder, Edit, find_node_at_offset};
#[derive(Debug)]
pub struct LocalEdit {
@ -136,7 +136,7 @@ fn non_trivia_sibling(node: SyntaxNodeRef, direction: Direction) -> Option<Synta
#[cfg(test)]
mod tests {
use super::*;
use test_utils::{check_action, check_action_range};
use crate::test_utils::{check_action, check_action_range};
#[test]
fn test_swap_comma() {

View File

@ -9,7 +9,7 @@
text_utils::is_subrange,
};
use {
use crate::{
AtomEdit, find_node_at_offset,
scope::{FnScopes, ModuleScope},
};

View File

@ -1,4 +1,4 @@
use {TextRange, TextUnit};
use crate::{TextRange, TextUnit};
use ra_syntax::{
AtomEdit,
text_utils::contains_offset_nonstrict,

View File

@ -164,7 +164,7 @@ pub fn resolve_local_name(file: &File, offset: TextUnit, name_ref: ast::NameRef)
#[cfg(test)]
mod tests {
use super::*;
use test_utils::{assert_eq_dbg, extract_offset, add_cursor};
use crate::test_utils::{assert_eq_dbg, extract_offset, add_cursor};
#[test]
fn test_highlighting() {

View File

@ -1,5 +1,5 @@
use superslice::Ext;
use ::TextUnit;
use crate::TextUnit;
#[derive(Clone, Debug, Hash)]
pub struct LineIndex {

View File

@ -174,7 +174,7 @@ fn compute_expr_scopes(expr: ast::Expr, scopes: &mut FnScopes, scope: ScopeId) {
}
}
ast::Expr::LambdaExpr(e) => {
let mut scope = scopes.new_scope(scope);
let scope = scopes.new_scope(scope);
scopes.add_params_bindings(scope, e.param_list());
if let Some(body) = e.body() {
scopes.set_scope(body.syntax(), scope);
@ -256,7 +256,7 @@ pub fn resolve_local_name<'a>(name_ref: ast::NameRef, scopes: &'a FnScopes) -> O
mod tests {
use super::*;
use ra_syntax::File;
use {find_node_at_offset, test_utils::extract_offset};
use crate::{find_node_at_offset, test_utils::extract_offset};
fn do_check(code: &str, expected: &[&str]) {
let (off, code) = extract_offset(code);

View File

@ -6,7 +6,7 @@
walk::{walk, WalkEvent},
},
};
use TextRange;
use crate::TextRange;
#[derive(Debug, Clone)]
pub struct StructureNode {

View File

@ -1,6 +1,6 @@
use ra_syntax::{File, TextUnit, TextRange};
pub use _test_utils::*;
use LocalEdit;
pub use crate::_test_utils::*;
use crate::LocalEdit;
pub fn check_action<F: Fn(&File, TextUnit) -> Option<LocalEdit>> (
before: &str,

View File

@ -10,7 +10,7 @@
SyntaxKind::*,
};
use {LocalEdit, EditBuilder, find_node_at_offset};
use crate::{LocalEdit, EditBuilder, find_node_at_offset};
pub fn join_lines(file: &File, range: TextRange) -> LocalEdit {
let range = if range.is_empty() {
@ -244,7 +244,7 @@ fn compute_ws(left: SyntaxNodeRef, right: SyntaxNodeRef) -> &'static str {
#[cfg(test)]
mod tests {
use super::*;
use test_utils::{check_action, extract_range, extract_offset, add_cursor};
use crate::test_utils::{check_action, extract_range, extract_offset, add_cursor};
fn check_join_lines(before: &str, after: &str) {
check_action(before, after, |file, offset| {