buck2 icon indicating copy to clipboard operation
buck2 copied to clipboard

LSP: diagnose missing identifiers in scope

Open lf- opened this issue 5 months ago • 1 comments

It would be really helpful if the LSP could diagnose undefined identifiers in global scope that might need to be imported and produce LSP level diagnostics. I don't know how hard this is, though, as I'm not sure how much accurate information the LSP knows about what is in scope.

I think the LSP doesn't really do diagnostics? It doesn't yet give syntax errors for instance.

lf- avatar Jul 18 '25 18:07 lf-

I think the LSP doesn't really do diagnostics? It doesn't yet give syntax errors for instance.

It certainly doesn't output many, but it does diagnose parse failures. The actual diagnostics are pretty poor though:

some_rule(
    name = "hey",
    arg = "there",
)

[

another_rule(
    name = "foo",
    arg = "bar",
)

Will just flag "Error parsing: root//BUILD" at the first line...

I expect that it could at minimum output the few lints that buck2 starlark lint catches.

cbarrete avatar Jul 19 '25 01:07 cbarrete