mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-26 11:55:04 +00:00
minor: Access parser internals through ide_db for ide crates
This commit is contained in:
parent
a7d440e368
commit
533f178a52
5 changed files with 6 additions and 5 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -632,7 +632,6 @@ dependencies = [
|
||||||
"hir",
|
"hir",
|
||||||
"ide_db",
|
"ide_db",
|
||||||
"itertools",
|
"itertools",
|
||||||
"parser",
|
|
||||||
"profile",
|
"profile",
|
||||||
"rustc-hash",
|
"rustc-hash",
|
||||||
"sourcegen",
|
"sourcegen",
|
||||||
|
|
|
@ -16,7 +16,6 @@ itertools = "0.10.0"
|
||||||
either = "1.6.1"
|
either = "1.6.1"
|
||||||
|
|
||||||
stdx = { path = "../stdx", version = "0.0.0" }
|
stdx = { path = "../stdx", version = "0.0.0" }
|
||||||
parser = { path = "../parser", version = "0.0.0" }
|
|
||||||
syntax = { path = "../syntax", version = "0.0.0" }
|
syntax = { path = "../syntax", version = "0.0.0" }
|
||||||
text_edit = { path = "../text_edit", version = "0.0.0" }
|
text_edit = { path = "../text_edit", version = "0.0.0" }
|
||||||
profile = { path = "../profile", version = "0.0.0" }
|
profile = { path = "../profile", version = "0.0.0" }
|
||||||
|
|
|
@ -7,7 +7,6 @@ use ide_db::{
|
||||||
defs::{Definition, NameClass, NameRefClass},
|
defs::{Definition, NameClass, NameRefClass},
|
||||||
search::{FileReference, SearchScope},
|
search::{FileReference, SearchScope},
|
||||||
};
|
};
|
||||||
use parser::SyntaxKind::WHITESPACE;
|
|
||||||
use stdx::format_to;
|
use stdx::format_to;
|
||||||
use syntax::{
|
use syntax::{
|
||||||
algo::find_node_at_range,
|
algo::find_node_at_range,
|
||||||
|
@ -16,7 +15,9 @@ use syntax::{
|
||||||
edit::{AstNodeEdit, IndentLevel},
|
edit::{AstNodeEdit, IndentLevel},
|
||||||
make, HasName, HasVisibility,
|
make, HasName, HasVisibility,
|
||||||
},
|
},
|
||||||
match_ast, ted, AstNode, SourceFile, SyntaxNode, TextRange,
|
match_ast, ted, AstNode, SourceFile,
|
||||||
|
SyntaxKind::WHITESPACE,
|
||||||
|
SyntaxNode, TextRange,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{AssistContext, Assists};
|
use crate::{AssistContext, Assists};
|
||||||
|
|
|
@ -135,7 +135,7 @@ fn normalize(name: &str) -> Option<String> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_valid_name(name: &str) -> bool {
|
fn is_valid_name(name: &str) -> bool {
|
||||||
match parser::LexedStr::single_token(name) {
|
match ide_db::syntax_helpers::LexedStr::single_token(name) {
|
||||||
Some((syntax::SyntaxKind::IDENT, _error)) => true,
|
Some((syntax::SyntaxKind::IDENT, _error)) => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,8 @@ pub mod syntax_helpers {
|
||||||
pub mod node_ext;
|
pub mod node_ext;
|
||||||
pub mod insert_whitespace_into_node;
|
pub mod insert_whitespace_into_node;
|
||||||
pub mod format_string;
|
pub mod format_string;
|
||||||
|
|
||||||
|
pub use parser::LexedStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
use std::{fmt, mem::ManuallyDrop, sync::Arc};
|
use std::{fmt, mem::ManuallyDrop, sync::Arc};
|
||||||
|
|
Loading…
Reference in a new issue