diff --git a/docs/HACKING_QUICKSTART.md b/docs/HACKING_QUICKSTART.md index 4f0027f93ea..a47d8774a42 100644 --- a/docs/HACKING_QUICKSTART.md +++ b/docs/HACKING_QUICKSTART.md @@ -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: