Skip to content

Commit 96fbc1b

Browse files
committed
bangls 改进 op-expr 前插入值绑定识别为语句头部
1 parent db65a11 commit 96fbc1b

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tools/bangls/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "bangls"
3-
version = "0.1.29"
3+
version = "0.1.30"
44
edition = "2024"
55

66
[features]

tools/parser/src/lib.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,13 @@ fn trim_complete(v: &Var) -> Var {
3232
}
3333

3434
fn first_comp(values: &[Value]) -> bool {
35-
values.first().and_then(Value::as_var).is_some_and(|it| it.ends_with(syntax::LSP_DEBUG))
35+
let Some(first) = values.first() else { return false };
36+
match first {
37+
Value::ValueBindRef(ValueBindRef { bind_target: ValueBindRefTarget::NameBind(name), .. }) |
38+
Value::ValueBind(ValueBind(_, name)) |
39+
Value::Var(name) => name.ends_with(syntax::LSP_DEBUG),
40+
_ => false,
41+
}
3642
}
3743

3844
fn make_take_destructs(

0 commit comments

Comments
 (0)