facebook / starlark-rust

A Rust implementation of the Starlark language
Apache License 2.0
699 stars 57 forks source link

Fix "go to label" in bazel LSP #100

Closed cameron-martin closed 8 months ago

cameron-martin commented 9 months ago

When executing "go to definition" on a label, it would previously go to the correct file but not to the definition of that target. This was because we were searching for a function call where the name is the whole label. Now it parses the label, using the label parser introduced in #101, to extract the name and searches using that.

stagnation commented 9 months ago

Nice! Works well for local targets for me :) and handles @ for the root, did not get it to go to external repositories, or the main repo with its full name. But that sounds out-of-scope for this improvement.

cameron-martin commented 9 months ago

That's strange. It works for going to external repositories for me, just not when in a file in an external repository.

stagnation commented 9 months ago

Good! My bad, I had the runfiles library as the abbreviated package-only label. With runfiles:runfiles it does work!

cameron-martin commented 9 months ago

With #101 I will be able to fix this problem

ndmitchell commented 8 months ago

Any reason not to undraft this?

cameron-martin commented 8 months ago

Any reason not to undraft this?

Yep I was waiting for the label parser to go in so I could use it here. I'll update this soon and undraft it.

cameron-martin commented 8 months ago

@ndmitchell This should be now good to go!

facebook-github-bot commented 8 months ago

@ndmitchell has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot commented 8 months ago

@ndmitchell merged this pull request in facebookexperimental/starlark-rust@1f2fe806ed389ffed8827e9e51f65c6113eab1c9.