mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 21:54:42 +00:00
switch editor to 2018
This commit is contained in:
parent
9434920648
commit
1624bf2d7f
10 changed files with 14 additions and 13 deletions
|
@ -1,4 +1,5 @@
|
||||||
[package]
|
[package]
|
||||||
|
edition = "2018"
|
||||||
name = "ra_editor"
|
name = "ra_editor"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Aleksey Kladov <aleksey.kladov@gmail.com>"]
|
authors = ["Aleksey Kladov <aleksey.kladov@gmail.com>"]
|
||||||
|
|
|
@ -11,7 +11,7 @@ use ra_syntax::{
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
use {EditBuilder, Edit, find_node_at_offset};
|
use crate::{EditBuilder, Edit, find_node_at_offset};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct LocalEdit {
|
pub struct LocalEdit {
|
||||||
|
@ -136,7 +136,7 @@ fn non_trivia_sibling(node: SyntaxNodeRef, direction: Direction) -> Option<Synta
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use test_utils::{check_action, check_action_range};
|
use crate::test_utils::{check_action, check_action_range};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_swap_comma() {
|
fn test_swap_comma() {
|
||||||
|
|
|
@ -9,7 +9,7 @@ use ra_syntax::{
|
||||||
text_utils::is_subrange,
|
text_utils::is_subrange,
|
||||||
};
|
};
|
||||||
|
|
||||||
use {
|
use crate::{
|
||||||
AtomEdit, find_node_at_offset,
|
AtomEdit, find_node_at_offset,
|
||||||
scope::{FnScopes, ModuleScope},
|
scope::{FnScopes, ModuleScope},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use {TextRange, TextUnit};
|
use crate::{TextRange, TextUnit};
|
||||||
use ra_syntax::{
|
use ra_syntax::{
|
||||||
AtomEdit,
|
AtomEdit,
|
||||||
text_utils::contains_offset_nonstrict,
|
text_utils::contains_offset_nonstrict,
|
||||||
|
|
|
@ -164,7 +164,7 @@ pub fn resolve_local_name(file: &File, offset: TextUnit, name_ref: ast::NameRef)
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use test_utils::{assert_eq_dbg, extract_offset, add_cursor};
|
use crate::test_utils::{assert_eq_dbg, extract_offset, add_cursor};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_highlighting() {
|
fn test_highlighting() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use superslice::Ext;
|
use superslice::Ext;
|
||||||
use ::TextUnit;
|
use crate::TextUnit;
|
||||||
|
|
||||||
#[derive(Clone, Debug, Hash)]
|
#[derive(Clone, Debug, Hash)]
|
||||||
pub struct LineIndex {
|
pub struct LineIndex {
|
||||||
|
|
|
@ -174,7 +174,7 @@ fn compute_expr_scopes(expr: ast::Expr, scopes: &mut FnScopes, scope: ScopeId) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ast::Expr::LambdaExpr(e) => {
|
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());
|
scopes.add_params_bindings(scope, e.param_list());
|
||||||
if let Some(body) = e.body() {
|
if let Some(body) = e.body() {
|
||||||
scopes.set_scope(body.syntax(), scope);
|
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 {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use ra_syntax::File;
|
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]) {
|
fn do_check(code: &str, expected: &[&str]) {
|
||||||
let (off, code) = extract_offset(code);
|
let (off, code) = extract_offset(code);
|
||||||
|
|
|
@ -6,7 +6,7 @@ use ra_syntax::{
|
||||||
walk::{walk, WalkEvent},
|
walk::{walk, WalkEvent},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use TextRange;
|
use crate::TextRange;
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct StructureNode {
|
pub struct StructureNode {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use ra_syntax::{File, TextUnit, TextRange};
|
use ra_syntax::{File, TextUnit, TextRange};
|
||||||
pub use _test_utils::*;
|
pub use crate::_test_utils::*;
|
||||||
use LocalEdit;
|
use crate::LocalEdit;
|
||||||
|
|
||||||
pub fn check_action<F: Fn(&File, TextUnit) -> Option<LocalEdit>> (
|
pub fn check_action<F: Fn(&File, TextUnit) -> Option<LocalEdit>> (
|
||||||
before: &str,
|
before: &str,
|
||||||
|
|
|
@ -10,7 +10,7 @@ use ra_syntax::{
|
||||||
SyntaxKind::*,
|
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 {
|
pub fn join_lines(file: &File, range: TextRange) -> LocalEdit {
|
||||||
let range = if range.is_empty() {
|
let range = if range.is_empty() {
|
||||||
|
@ -244,7 +244,7 @@ fn compute_ws(left: SyntaxNodeRef, right: SyntaxNodeRef) -> &'static str {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
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) {
|
fn check_join_lines(before: &str, after: &str) {
|
||||||
check_action(before, after, |file, offset| {
|
check_action(before, after, |file, offset| {
|
||||||
|
|
Loading…
Reference in a new issue