mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
HACKING_QUICKSTART: update vscode guide
This commit is contained in:
parent
d00a78a1c7
commit
7fe42ec8e9
1 changed files with 25 additions and 22 deletions
|
@ -138,23 +138,29 @@ For more details about overriding dependencies, see [Cargo's documentation](http
|
|||
|
||||
### Visual Studio Code
|
||||
|
||||
Running plain `cargo` will cause problems! This is because the rustflags (flags passed to the rust compiler) that
|
||||
standard `cargo` provides are different to what `./mach` uses, and so every time Servo is built using `cargo` it will
|
||||
undo all the work done by `./mach` (and vice versa).
|
||||
Running plain `cargo` will cause problems! For example, you might get rust-analyzer extension errors
|
||||
about build scripts like
|
||||
|
||||
* The style crate requires enabling one of its 'servo' or 'gecko' feature flags and, in the 'servo'
|
||||
case, one of 'servo-layout-2013' or 'servo-layout-2020'.
|
||||
|
||||
* (if you are on NixOS) thread 'main' panicked at 'called \`Result::unwrap()\` on an \`Err\` value:
|
||||
"Could not run \`PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=\\"1\\" PKG_CONFIG_ALLOW_SYSTEM_LIBS=\\"1\\"
|
||||
\\"pkg-config\\" \\"--libs\\" \\"--cflags\\" \\"fontconfig\\"\`
|
||||
|
||||
This is because the rustflags (flags passed to the rust compiler) that standard `cargo` provides are
|
||||
different to what `./mach` uses, and so every time Servo is built using `cargo` it will undo all the
|
||||
work done by `./mach` (and vice versa).
|
||||
|
||||
You can override this in a `.vscode/settings.json` file:
|
||||
|
||||
```
|
||||
{
|
||||
"rust-analyzer.checkOnSave.overrideCommand": [
|
||||
"./mach",
|
||||
"check",
|
||||
"--message-format=json",
|
||||
],
|
||||
"rust-analyzer.rustfmt.overrideCommand": [
|
||||
"./mach",
|
||||
"fmt"
|
||||
],
|
||||
"rust-analyzer.check.overrideCommand": [
|
||||
"./mach", "check", "--message-format=json" ],
|
||||
"rust-analyzer.cargo.buildScripts.overrideCommand": [
|
||||
"./mach", "check", "--message-format=json" ],
|
||||
"rust-analyzer.rustfmt.overrideCommand": [ "./mach", "fmt" ],
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -164,19 +170,16 @@ the amount of disc space used).
|
|||
```
|
||||
{
|
||||
"rust-analyzer.checkOnSave.overrideCommand": [
|
||||
"./mach",
|
||||
"check",
|
||||
"--message-format=json",
|
||||
"--target-dir",
|
||||
"target/lsp"
|
||||
],
|
||||
"rust-analyzer.rustfmt.overrideCommand": [
|
||||
"./mach",
|
||||
"fmt"
|
||||
],
|
||||
"./mach", "check", "--message-format=json", "--target-dir", "target/lsp" ],
|
||||
"rust-analyzer.cargo.buildScripts.overrideCommand": [
|
||||
"./mach", "check", "--message-format=json", "--target-dir", "target/lsp" ],
|
||||
"rust-analyzer.rustfmt.overrideCommand": [ "./mach", "fmt" ],
|
||||
}
|
||||
```
|
||||
|
||||
If you are on NixOS, these settings should be enough to not need to run `code .` from within a
|
||||
`nix-shell etc/shell.nix`, but it wouldn’t hurt to try that if you still have problems.
|
||||
|
||||
## Debugging
|
||||
|
||||
### Logging:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue