devoncarew / bazel-code

A Bazel plugin for VSCode.
https://marketplace.visualstudio.com/items?itemName=DevonDCarew.bazel-code
BSD 3-Clause "New" or "Revised" License
14 stars 8 forks source link

Add (basic) autocompletion support #3

Open tbroyer opened 7 years ago

tbroyer commented 7 years ago

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:

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 commented 6 years ago

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/