11671: minor: Access parser internals through ide_db for ide crates r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
bors[bot] 2022-03-10 16:15:12 +00:00 committed by GitHub
commit 356c507357
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 5 deletions

1
Cargo.lock generated
View file

@ -632,7 +632,6 @@ dependencies = [
"hir",
"ide_db",
"itertools",
"parser",
"profile",
"rustc-hash",
"sourcegen",

View file

@ -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" }

View file

@ -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};

View file

@ -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,
}

View file

@ -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};