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

Code Navigation settings for Starlark files #414

Open
arquer opened this issue Sep 26, 2024 · 7 comments
Open

Code Navigation settings for Starlark files #414

arquer opened this issue Sep 26, 2024 · 7 comments

Comments

@arquer
Copy link

arquer commented Sep 26, 2024

Probably not an actual issue but more like a question/feature request.

While browsing BUILD files, is there any way that I can configure where the extension will search for rules so that I can easily navigate them (Ctrl Click)?

I ask because I have projects where my checked out directory structure might not match the one assumed by the rules in BUILD, and even when doing that I often find code navigation taking be to BUILD files located in my bazel cache or in a temporary "bazel-bin" or similar.

In other words, is there a way I can configure this extension so that Ctrl Click on a dependency that points to another repo (@repo/path/to:rule) actually takes me to a cloned version of that repo I have?

Thanks!

@vogelsgesang
Copy link
Collaborator

This functionality should be available if you configure a language server (see the README). Currently, that functionality is still experimental, also see #1 for a lot more context on the current state of language server support

@arquer
Copy link
Author

arquer commented Sep 28, 2024

Oh I see, thanks, I didn't know a language server had anything to do with this so I hadn't looked into that, definitely will now.

@arquer arquer closed this as completed Sep 28, 2024
@arquer
Copy link
Author

arquer commented Sep 28, 2024

Hi @vogelsgesang , I went ahead and installed the language server (bazel-lsp) but have seen no difference in the behaviors I was explaining above.
Code navigation often still takes me to bazel's cache instead of the starlark BUILD sources, even when I add bazel's cache to the list of directories to ignore.

Is there some way of debugging this you would recommend? I am pretty new to starlark/bazel and really all I want is code navigation so I can navigate a huge source code base easily.

@vogelsgesang
Copy link
Collaborator

I am a bit confused.

Which language are you trying to use code navigation on? Starlark? C ? Python? some other language?

@arquer
Copy link
Author

arquer commented Sep 30, 2024

Starlark! basically I wanna be able to ctrl click on some dependencie of a bazel rule and be taken to that rule's definition

@vogelsgesang
Copy link
Collaborator

👍 ok, then I understood your initial post correctly.

I am not sure how the code navigation for Starlark should work. My best bet would have been that this should work with the Starlark-LSPs. @cameron-martin and @withered-magic might be able to provide more context on what works / doesn't work regarding Starlark code navigation, yet

@vogelsgesang vogelsgesang reopened this Sep 30, 2024
@vogelsgesang vogelsgesang changed the title Code Navigation Settings Code Navigation settings for Starlark files Sep 30, 2024
@cameron-martin
Copy link
Collaborator

It sounds like the ask here is for code navigation to resolve symlinks, like clangd does from memory. This may have unintended consequences on further code navigation when naively implemented, since it'll lose the context on what the bazel workspace is.

Do you mind opening an issue on bazel-lsp and starpls?

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

3 participants