Skip to content

Commit

Permalink
Merge pull request #209 from adamrk/rust-analyzer-docs
Browse files Browse the repository at this point in the history
Add rust-analyzer notes to quick-start.rst
  • Loading branch information
ojeda authored Apr 21, 2021
2 parents 944106f + 5d3f834 commit 3b8575d
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,6 @@ x509.genkey

# Documentation toolchain
sphinx_*/

# Rust analyzer configuration
/rust-project.json
17 changes: 17 additions & 0 deletions Documentation/rust/quick-start.rst
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,23 @@ the component manually::
The standalone installers also come with ``rustdoc``.


rust-analyzer
*************

The `rust-analyzer <https://rust-analyzer.github.io/>`_ language server can
be used with many editors to enable syntax highlighting, completion, go to
definition, and other features.

``rust-analyzer`` will need to be
`configured <https://rust-analyzer.github.io/manual.html#non-cargo-based-projects>`_
to work with the kernel by adding a ``rust-project.json`` file in the root folder.
The example ``Documentation/rust/rust-project.json`` can
be used after updating ``sysroot_src`` and including the relevant modules.
The path to ``sysroot_src`` is given by::

$(rustc --print sysroot)/lib/rustlib/src/rust/library


Configuration
-------------

Expand Down
35 changes: 35 additions & 0 deletions Documentation/rust/rust-project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"sysroot_src": <path-to-sysroot-source>,
"crates": [
{
"root_module": "rust/module.rs",
"edition": "2018",
"deps": []
},
{
"root_module": "rust/kernel/lib.rs",
"edition": "2018",
"deps": [
{
"crate": 0,
"name": "module"
}
]
},
{
"root_module": <path-to-module>,
"edition": "2018",
"deps": [
{
"crate": 0,
"name": "module"
},
{
"crate": 1,
"name": "kernel"
}
]
},
<...entries for other modules...>
]
}

0 comments on commit 3b8575d

Please sign in to comment.