mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-28 22:13:39 +00:00
Merge #1826
1826: don't break parser error recovery in presence of macros r=matklad a=matklad Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
fd9e6c649f
2 changed files with 6 additions and 2 deletions
|
@ -89,6 +89,10 @@ pub fn load(
|
||||||
vfs.root2path(root)
|
vfs.root2path(root)
|
||||||
);
|
);
|
||||||
analysis_change.add_root(source_root_id, is_local);
|
analysis_change.add_root(source_root_id, is_local);
|
||||||
|
analysis_change.set_debug_root_path(
|
||||||
|
source_root_id,
|
||||||
|
source_roots[&source_root_id].path().display().to_string(),
|
||||||
|
);
|
||||||
|
|
||||||
let mut file_map = FxHashMap::default();
|
let mut file_map = FxHashMap::default();
|
||||||
for (vfs_file, path, text) in files {
|
for (vfs_file, path, text) in files {
|
||||||
|
|
|
@ -5,7 +5,7 @@ use drop_bomb::DropBomb;
|
||||||
use crate::{
|
use crate::{
|
||||||
event::Event,
|
event::Event,
|
||||||
ParseError,
|
ParseError,
|
||||||
SyntaxKind::{self, EOF, ERROR, L_DOLLAR, R_DOLLAR, TOMBSTONE},
|
SyntaxKind::{self, EOF, ERROR, TOMBSTONE},
|
||||||
TokenSet, TokenSource, T,
|
TokenSet, TokenSource, T,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ impl<'t> Parser<'t> {
|
||||||
/// Create an error node and consume the next token.
|
/// Create an error node and consume the next token.
|
||||||
pub(crate) fn err_recover(&mut self, message: &str, recovery: TokenSet) {
|
pub(crate) fn err_recover(&mut self, message: &str, recovery: TokenSet) {
|
||||||
match self.current() {
|
match self.current() {
|
||||||
T!['{'] | T!['}'] | L_DOLLAR | R_DOLLAR => {
|
T!['{'] | T!['}'] => {
|
||||||
self.error(message);
|
self.error(message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue