mirror of
https://github.com/joshuadavidthomas/django-language-server.git
synced 2025-09-10 20:36:21 +00:00
fix
This commit is contained in:
parent
6a2b13f6e7
commit
3de9d1bb19
1 changed files with 8 additions and 5 deletions
|
@ -24,6 +24,9 @@ impl Parser {
|
|||
Err(ParserError::ErrorSignal(Signal::SpecialTag(_))) => {
|
||||
continue;
|
||||
}
|
||||
Err(ParserError::Ast(AstError::StreamError(kind))) if kind == "AtEnd" => {
|
||||
break;
|
||||
}
|
||||
Err(err) => {
|
||||
if let ParserError::Ast(err) = err {
|
||||
ast.add_error(err);
|
||||
|
@ -46,10 +49,6 @@ impl Parser {
|
|||
|
||||
let token = self.peek()?;
|
||||
let node = match token.token_type() {
|
||||
TokenType::Comment(content, start, end) => {
|
||||
self.consume()?;
|
||||
self.parse_comment(content, start, end.as_deref())
|
||||
}
|
||||
TokenType::DjangoBlock(content) => {
|
||||
self.consume()?;
|
||||
self.parse_django_block(content)
|
||||
|
@ -58,6 +57,10 @@ impl Parser {
|
|||
self.consume()?;
|
||||
self.parse_django_variable(content)
|
||||
}
|
||||
TokenType::Comment(content, start, end) => {
|
||||
self.consume()?;
|
||||
self.parse_comment(content, start, end.as_deref())
|
||||
}
|
||||
TokenType::Text(_)
|
||||
| TokenType::Whitespace(_)
|
||||
| TokenType::Newline
|
||||
|
@ -604,7 +607,7 @@ mod tests {
|
|||
let ast = parser.parse().unwrap();
|
||||
insta::assert_yaml_snapshot!(ast);
|
||||
assert_eq!(ast.errors().len(), 1);
|
||||
assert!(matches!(&ast.errors()[0], AstError::UnclosedTag(tag) if tag == "div"));
|
||||
assert!(matches!(&ast.errors()[0], AstError::UnclosedTag(tag) if tag == "if"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue