Skip to content

Automatically download starpls in VSCode #400

@lalten

Description

@lalten

I originally wanted to post about a problem we're having. I have now found out that this isn't related to starpls at all. I'm still going to post the below in case it's helpful for others 😊. Maybe it could find its way into the docs?

We're pointing the VSCode Bazel extension at starpls like this:

MODULE.bazel

bazel_dep(name = "download_utils", version = "1.0.1")
download_file = use_repo_rule("@download_utils//download/file:defs.bzl", "download_file")
download_file(
    name = "starpls",
    executable = True,
    output = "starpls",
    urls = ["https://github.com/withered-magic/starpls/releases/download/v0.1.14/starpls-linux-amd64"],
)

The settings.json is checked in to git so everyone is using the same.

.vscode/settings.json

  "bazel.lsp.args": [
    "run",
    "@starpls"
  ],
  "bazel.lsp.command": "bazel",

The benefit of this setup is that nobody has to manually install starpls, it's all handled by Bazel.
It will only work on Linux, but likely that could be solved with rules_multitool

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions