diff options
author | Aleksey Kladov <[email protected]> | 2021-02-07 07:49:45 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2021-02-07 07:58:59 +0000 |
commit | cbebb70313a88622a93595e0caa069929cd1554e (patch) | |
tree | f419d64b52905196750a027afb6a13d91a1883b4 /docs/dev | |
parent | a423a5196c5881623154af519454b1d03c8c7ee5 (diff) |
Add a section on entry points
Diffstat (limited to 'docs/dev')
-rw-r--r-- | docs/dev/architecture.md | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/docs/dev/architecture.md b/docs/dev/architecture.md index de8427c4b..7a88ebc0f 100644 --- a/docs/dev/architecture.md +++ b/docs/dev/architecture.md | |||
@@ -39,6 +39,14 @@ The client can submit a small delta of input data (typically, a change to a sing | |||
39 | 39 | ||
40 | The underlying engine makes sure that model is computed lazily (on-demand) and can be quickly updated for small modifications. | 40 | The underlying engine makes sure that model is computed lazily (on-demand) and can be quickly updated for small modifications. |
41 | 41 | ||
42 | ## Entry Points | ||
43 | |||
44 | `crates/rust-analyzer/src/bin/main.rs` contains the main function which spawns LSP. | ||
45 | This is *the* entry point, but it front-loads a lot of complexity, so its fine to just skim through it. | ||
46 | |||
47 | `crates/rust-analyzer/src/handlers.rs` implements all LSP requests and is a great place to start if you are already familiar with LSP. | ||
48 | |||
49 | `Analysis` and `AnalysisHost` types define the main API. | ||
42 | 50 | ||
43 | ## Code Map | 51 | ## Code Map |
44 | 52 | ||
@@ -265,7 +273,7 @@ And the client (`proc_macro_api`) provides an interface to talk to that server s | |||
265 | And then token trees are passed from client, and the server will load the corresponding dynamic library (which built by `cargo`). | 273 | And then token trees are passed from client, and the server will load the corresponding dynamic library (which built by `cargo`). |
266 | And due to the fact the api for getting result from proc macro are always unstable in `rustc`, | 274 | And due to the fact the api for getting result from proc macro are always unstable in `rustc`, |
267 | we maintain our own copy (and paste) of that part of code to allow us to build the whole thing in stable rust. | 275 | we maintain our own copy (and paste) of that part of code to allow us to build the whole thing in stable rust. |
268 | 276 | ||
269 | **Architecture Invariant:** | 277 | **Architecture Invariant:** |
270 | Bad proc macros may panic or segfault accidentally. So we run it in another process and recover it from fatal error. | 278 | Bad proc macros may panic or segfault accidentally. So we run it in another process and recover it from fatal error. |
271 | And they may be non-deterministic which conflict how `salsa` works, so special attention is required. | 279 | And they may be non-deterministic which conflict how `salsa` works, so special attention is required. |