mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
Add parse_to_token_tree
This commit is contained in:
parent
013e908056
commit
e7206467d5
5 changed files with 213 additions and 37 deletions
|
@ -7,6 +7,7 @@ use crate::{
|
|||
|
||||
use crate::{quote, EagerMacroId, LazyMacroId, MacroCallId};
|
||||
use either::Either;
|
||||
use mbe::parse_to_token_tree;
|
||||
use ra_db::{FileId, RelativePath};
|
||||
use ra_parser::FragmentKind;
|
||||
|
||||
|
@ -306,10 +307,9 @@ fn include_expand(
|
|||
|
||||
// FIXME:
|
||||
// Handle include as expression
|
||||
let node =
|
||||
db.parse_or_expand(file_id.into()).ok_or_else(|| mbe::ExpandError::ConversionError)?;
|
||||
let res =
|
||||
mbe::syntax_node_to_token_tree(&node).ok_or_else(|| mbe::ExpandError::ConversionError)?.0;
|
||||
let res = parse_to_token_tree(&db.file_text(file_id.into()))
|
||||
.ok_or_else(|| mbe::ExpandError::ConversionError)?
|
||||
.0;
|
||||
|
||||
Ok((res, FragmentKind::Items))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue