diff options
| author | Lukas Wirth <lukastw97@gmail.com> | 2022-03-10 17:07:11 +0100 |
|---|---|---|
| committer | Lukas Wirth <lukastw97@gmail.com> | 2022-03-10 17:07:28 +0100 |
| commit | 533f178a524dabe6c56ee533966f2a2be1a4104b (patch) | |
| tree | 86f5e6513b186b72d667b2dfa87c0bb70e53f2a4 | |
| parent | a7d440e368395804511fc86ae3a2ef2ae748f308 (diff) | |
| download | rust-533f178a524dabe6c56ee533966f2a2be1a4104b.tar.gz rust-533f178a524dabe6c56ee533966f2a2be1a4104b.zip | |
minor: Access parser internals through ide_db for ide crates
| -rw-r--r-- | Cargo.lock | 1 | ||||
| -rw-r--r-- | crates/ide_assists/Cargo.toml | 1 | ||||
| -rw-r--r-- | crates/ide_assists/src/handlers/extract_module.rs | 5 | ||||
| -rw-r--r-- | crates/ide_assists/src/utils/suggest_name.rs | 2 | ||||
| -rw-r--r-- | crates/ide_db/src/lib.rs | 2 |
5 files changed, 6 insertions, 5 deletions
diff --git a/Cargo.lock b/Cargo.lock index f1b559f4059..5dfc14e8b39 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -632,7 +632,6 @@ dependencies = [ "hir", "ide_db", "itertools", - "parser", "profile", "rustc-hash", "sourcegen", diff --git a/crates/ide_assists/Cargo.toml b/crates/ide_assists/Cargo.toml index 878c556d771..09242e0aaf7 100644 --- a/crates/ide_assists/Cargo.toml +++ b/crates/ide_assists/Cargo.toml @@ -16,7 +16,6 @@ itertools = "0.10.0" either = "1.6.1" stdx = { path = "../stdx", version = "0.0.0" } -parser = { path = "../parser", version = "0.0.0" } syntax = { path = "../syntax", version = "0.0.0" } text_edit = { path = "../text_edit", version = "0.0.0" } profile = { path = "../profile", version = "0.0.0" } diff --git a/crates/ide_assists/src/handlers/extract_module.rs b/crates/ide_assists/src/handlers/extract_module.rs index 08bfd10dc79..9e1481b2f63 100644 --- a/crates/ide_assists/src/handlers/extract_module.rs +++ b/crates/ide_assists/src/handlers/extract_module.rs @@ -7,7 +7,6 @@ use ide_db::{ defs::{Definition, NameClass, NameRefClass}, search::{FileReference, SearchScope}, }; -use parser::SyntaxKind::WHITESPACE; use stdx::format_to; use syntax::{ algo::find_node_at_range, @@ -16,7 +15,9 @@ use syntax::{ edit::{AstNodeEdit, IndentLevel}, make, HasName, HasVisibility, }, - match_ast, ted, AstNode, SourceFile, SyntaxNode, TextRange, + match_ast, ted, AstNode, SourceFile, + SyntaxKind::WHITESPACE, + SyntaxNode, TextRange, }; use crate::{AssistContext, Assists}; diff --git a/crates/ide_assists/src/utils/suggest_name.rs b/crates/ide_assists/src/utils/suggest_name.rs index f91b2fe44e4..5b79a7495f7 100644 --- a/crates/ide_assists/src/utils/suggest_name.rs +++ b/crates/ide_assists/src/utils/suggest_name.rs @@ -135,7 +135,7 @@ fn normalize(name: &str) -> Option<String> { } 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, _ => false, } diff --git a/crates/ide_db/src/lib.rs b/crates/ide_db/src/lib.rs index b11b70d1276..5abeb88837e 100644 --- a/crates/ide_db/src/lib.rs +++ b/crates/ide_db/src/lib.rs @@ -35,6 +35,8 @@ pub mod syntax_helpers { pub mod node_ext; pub mod insert_whitespace_into_node; pub mod format_string; + + pub use parser::LexedStr; } use std::{fmt, mem::ManuallyDrop, sync::Arc}; |
