@@ -37,14 +37,35 @@ checking time. For example, if you are working on the compiler, you can override
37
37
the command to ` x check compiler --json-output ` to only check the compiler part.
38
38
You can run ` x check --help --verbose ` to see the available parts.
39
39
40
- If you have enough free disk space and you would like to be able to run ` x `
41
- commands while rust-analyzer runs in the background, you can also add
42
- ` --build-dir build-rust-analyzer ` to the ` overrideCommand ` to avoid x locking.
43
-
44
40
Running ` ./x setup editor ` will prompt you to create a project-local LSP config
45
41
file for one of the supported editors. You can also create the config file as a
46
42
step of running ` ./x setup ` .
47
43
44
+ ### Using a separate build directory for rust-analyzer
45
+
46
+ By default, when rust-analyzer runs a check or format command, it will share
47
+ the same build directory as manual command-line builds. This can be inconvenient
48
+ for two reasons:
49
+ - Each build will lock the build directory and force the other to wait, so it
50
+ becomes impossible to run command-line builds while rust-analyzer is running
51
+ commands in the background.
52
+ - There is an increased risk of one of the builds deleting previously-built
53
+ artifacts due to conflicting compiler flags or other settings, forcing
54
+ additional rebuilds in some cases.
55
+
56
+ To avoid these problems:
57
+ - Add ` --build-dir=build-rust-analyzer ` to all of the custom ` x ` commands in
58
+ your editor's rust-analyzer configuration.
59
+ (Feel free to choose a different directory name if desired.)
60
+ - Modify the ` rust-analyzer.procMacro.server ` setting so that it points to the
61
+ copy of ` rust-analyzer-proc-macro-srv ` in that other build directory.
62
+
63
+ Using separate build directories for command-line builds and rust-analyzer
64
+ requires extra disk space, and also means that running ` ./x clean ` on the
65
+ command-line will not clean out the separate build directory. To clean the
66
+ separate build directory, run ` ./x clean --build-dir=build-rust-analyzer `
67
+ instead.
68
+
48
69
### Visual Studio Code
49
70
50
71
Selecting ` vscode ` in ` ./x setup editor ` will prompt you to create a
0 commit comments