Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Label completion is not context aware #48

Open
rcorre opened this issue Sep 3, 2024 · 2 comments
Open

Label completion is not context aware #48

rcorre opened this issue Sep 3, 2024 · 2 comments

Comments

@rcorre
Copy link

rcorre commented Sep 3, 2024

I build bazel-lsp 0.6.1 from source and I'm using it as a LSP in helix. GoToDefinition on labels works, but completion doesn't seem very accurate or context aware. Here's a few examples:

  1. I'd expect @crat to complete to @crates//
   11  rust_library_group(
   12      name = "tonic_runtime",
   13      deps = [
   14 ▔        "@crates//:tonic",
●  15 ▍        "@crat
   16      ],        java_package_configuration    function
   17  )             constraint_setting            function
   18                constraint_value              function
   19  rust_prost_to package_relative_label        function
   20      name = "p starlark_doc_extract          function

I'd expect @crates//:pr to complete to @crates//:prost

   11  rust_library_group(
   12      name = "tonic_runtime",
   13      deps = [
   14 ▔        "@crates//:tonic",
●  15 ▍        "@crates//:pr
   16      ],                propeller_optimize            function ▐
   17  )                     proto_lang_toolchain          function ▐
   18                        proto_library                 function ▐
   19  rust_prost_toolchain( print                         function ▐
   20      name = "prost_too rust_prost_toolchain          method   ▐
   21      prost_plugin = "@ cc_proto_library              function ▐st",
   22      prost_runtime = " fdo_prefetch_hints            function ▐
   23      prost_types = "@c fdo_profile                   function ▐
   24      proto_compiler =  java_lite_proto_library       function ▐
   25      tonic_plugin = "@ java_proto_library            function ▐ic",

I'd expect //src/b to complete to //src/builtin:

   11  rust_library_group(
   12      name = "tonic_runtime",
   13      deps = [
   14 ▔        "@crates//:tonic",
●  15 ▍        "//src/bu
   16      ],          rust_library_group            method
   17  )
@cameron-martin
Copy link
Owner

It seems the autocomplete suggestions aren't that robust when the string literal is unterminated. It seems to work with repository names, however, if autocompleting after a "@.

I'll have to look further into this.

@cameron-martin
Copy link
Owner

cameron-martin commented Sep 7, 2024

Related: facebook/starlark-rust#89. I think the parser in starlark-rust needs to support error recovery.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants