about summary refs log tree commit diff
path: root/editors/code/package.json
diff options
context:
space:
mode:
authorDavid Barsky <me@davidbarsky.com>2023-03-09 15:06:26 -0500
committerDavid Barsky <me@davidbarsky.com>2023-03-13 13:30:18 -0400
commit8af3d6367ecead0abf80e697176f697d97c25215 (patch)
tree54a28c70aadc17ddc93991fb4344a516ae6cba29 /editors/code/package.json
parent95497533524537b1cc7a2870ce94b0b14503be8b (diff)
downloadrust-8af3d6367ecead0abf80e697176f697d97c25215.tar.gz
rust-8af3d6367ecead0abf80e697176f697d97c25215.zip
This commit add Cargo-style project discovery for Buck and Bazel users.
This feature requires the user to add a command that generates a
`rust-project.json` from a set of files. Project discovery can be invoked
in two ways:

1. At extension activation time, which includes the generated
   `rust-project.json` as part of the linkedProjects argument in
    InitializeParams
2. Through a new command titled "Add current file to workspace", which
   makes use of a new, rust-analyzer specific LSP request that adds
   the workspace without erasing any existing workspaces.

I think that the command-running functionality _could_ merit being
placed into its own extension (and expose it via extension contribution
points), if only provide build-system idiomatic progress reporting and
status handling, but I haven't (yet) made an extension that does this.
Diffstat (limited to 'editors/code/package.json')
-rw-r--r--editors/code/package.json18
1 files changed, 17 insertions, 1 deletions
diff --git a/editors/code/package.json b/editors/code/package.json
index a3b1a3107d0..e79ab33726d 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -200,6 +200,11 @@
                 "category": "rust-analyzer"
             },
             {
+                "command": "rust-analyzer.addProject",
+                "title": "Add current file to workspace",
+                "category": "rust-analyzer"
+            },
+            {
                 "command": "rust-analyzer.reload",
                 "title": "Restart server",
                 "category": "rust-analyzer"
@@ -447,6 +452,17 @@
                         "Fill missing expressions with reasonable defaults, `new` or `default` constructors."
                     ]
                 },
+                "rust-analyzer.discoverProjectCommand": {
+                    "markdownDescription": "Sets the command that rust-analyzer uses to generate `rust-project.json` files. This command is\n only suggested if a build system like Buck or Bazel is used. The command must accept files as arguements and return \n a rust-project.json over stdout.",
+                    "default": null,
+                    "type": [
+                        "null",
+                        "array"
+                    ],
+                    "items": {
+                        "type": "string"
+                    }
+                },
                 "rust-analyzer.cachePriming.enable": {
                     "markdownDescription": "Warm up caches on project load.",
                     "default": true,
@@ -1904,4 +1920,4 @@
             }
         ]
     }
-}
+}
\ No newline at end of file