File tree Expand file tree Collapse file tree 3 files changed +56
-0
lines changed
Expand file tree Collapse file tree 3 files changed +56
-0
lines changed Original file line number Diff line number Diff line change @@ -162,3 +162,6 @@ x509.genkey
162162
163163# Documentation toolchain
164164sphinx_ * /
165+
166+ # Rust analyzer configuration
167+ /rust-project.json
Original file line number Diff line number Diff line change @@ -145,6 +145,24 @@ the component manually::
145145The standalone installers also come with ``rustdoc ``.
146146
147147
148+ rust-analyzer
149+ *************
150+
151+ The `rust-analyzer <https://rust-analyzer.github.io/ >`_ language server can
152+ be used with many editors to enable syntax highlighting, completion, go to
153+ definition, and other features.
154+
155+ ``rust-analyzer `` will need to be
156+ `configured <https://rust-analyzer.github.io/manual.html#non-cargo-based-projects >`_
157+ to work with the kernel by adding a ``rust-project.json `` file in the root folder.
158+ The example ``Documentation/rust/rust-project.json `` can
159+ be used after updating ``sysroot_src `` and including the relevant modules.
160+ The path to ``sysroot_src `` is given by::
161+
162+ $(rustc --print sysroot)/lib/rustlib/src/rust/library
163+
164+
165+
148166Configuration
149167-------------
150168
Original file line number Diff line number Diff line change 1+ {
2+ "sysroot_src" : <path-to-sysroot-source>,
3+ "crates" : [
4+ {
5+ "root_module" : " rust/module.rs" ,
6+ "edition" : " 2018" ,
7+ "deps" : []
8+ },
9+ {
10+ "root_module" : " rust/kernel/lib.rs" ,
11+ "edition" : " 2018" ,
12+ "deps" : [
13+ {
14+ "crate" : 0 ,
15+ "name" : " module"
16+ }
17+ ]
18+ },
19+ {
20+ "root_module" : <path-to-module>,
21+ "edition" : " 2018" ,
22+ "deps" : [
23+ {
24+ "crate" : 0 ,
25+ "name" : " module"
26+ },
27+ {
28+ "crate" : 1 ,
29+ "name" : " kernel"
30+ }
31+ ]
32+ },
33+ <...entries for other modules...>
34+ ]
35+ }
You can’t perform that action at this time.
0 commit comments