Skip to content

Commit 391729d

Browse files
committed
fix get_index_key
1 parent 76faea7 commit 391729d

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

  • crates/emmylua_parser/src/syntax/node/lua

crates/emmylua_parser/src/syntax/node/lua/expr.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,20 @@ impl LuaIndexExpr {
331331

332332
return Some(LuaIndexKey::Expr(LuaExpr::cast(node).unwrap()));
333333
}
334-
_ => return None,
334+
_ => {
335+
if let Some(token) = child.as_token()
336+
&& matches!(
337+
token.kind().to_token(),
338+
LuaTokenKind::TkWhitespace
339+
| LuaTokenKind::TkEndOfLine
340+
| LuaTokenKind::TkShortComment
341+
| LuaTokenKind::TkLongComment
342+
)
343+
{
344+
continue;
345+
}
346+
return None;
347+
}
335348
}
336349
} else if let Some(token) = child.as_token() {
337350
if token.kind() == LuaTokenKind::TkLeftBracket.into() {

0 commit comments

Comments
 (0)