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

Add (basic) autocompletion support #3

Open
tbroyer opened this issue Dec 8, 2016 · 1 comment
Open

Add (basic) autocompletion support #3

tbroyer opened this issue Dec 8, 2016 · 1 comment

Comments

@tbroyer
Copy link

tbroyer commented Dec 8, 2016

I know autocompletion would be quite hard, having to possibly parse .bzl files too (I don't think there's any API or command to list arguments given a rule or function, even less so a skylark rule or macro –there's Skydoc but it only generates documentation, though its code could probably be reused–), but at a minimum completing:

  • rule and macro names (from the predefined list and the load() arguments in the file)
  • target labels from the workspace (if there's a WORKSPACE file, aggregate all names from all BUILD files, or run a bazel query to gather them)

would be huge!

I understand that, as of now, this extension is “only” leveraging the Python syntax highlighting rules, tweaked for Bazel, and adding anything else would probably be a big effort, so only suggesting the improvement here.

@damienpontifex
Copy link
Contributor

Looking into this, the approach would be to implement a language server for bazel. See Code completion guidelines on the bazel project wiki. It would seem the AST that could be handy is already implemented and could be used for parsing and evaluation.

The next bit would be to actually have a language server that a client built into this extension could call into, see https://microsoft.github.io/language-server-protocol/

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

No branches or pull requests

3 participants