diff options
Diffstat (limited to 'docs/dev')
-rw-r--r-- | docs/dev/architecture.md | 8 | ||||
-rw-r--r-- | docs/dev/lsp-extensions.md | 18 |
2 files changed, 20 insertions, 6 deletions
diff --git a/docs/dev/architecture.md b/docs/dev/architecture.md index 39edf9e19..3de1b99a5 100644 --- a/docs/dev/architecture.md +++ b/docs/dev/architecture.md | |||
@@ -146,6 +146,8 @@ Reading the docs of the `base_db::input` module should be useful: everything els | |||
146 | 146 | ||
147 | **Architecture Invariant:** particularities of the build system are *not* the part of the ground state. | 147 | **Architecture Invariant:** particularities of the build system are *not* the part of the ground state. |
148 | In particular, `base_db` knows nothing about cargo. | 148 | In particular, `base_db` knows nothing about cargo. |
149 | For example, `cfg` flags are a part of `base_db`, but `feature`s are not. | ||
150 | A `foo` feature is a Cargo-level concept, which is lowered by Cargo to `--cfg feature=foo` argument on the command line. | ||
149 | The `CrateGraph` structure is used to represent the dependencies between the crates abstractly. | 151 | The `CrateGraph` structure is used to represent the dependencies between the crates abstractly. |
150 | 152 | ||
151 | **Architecture Invariant:** `base_db` doesn't know about file system and file paths. | 153 | **Architecture Invariant:** `base_db` doesn't know about file system and file paths. |
@@ -447,3 +449,9 @@ This is cheap enough to enable in production. | |||
447 | 449 | ||
448 | Similarly, we save live object counting (`RA_COUNT=1`). | 450 | Similarly, we save live object counting (`RA_COUNT=1`). |
449 | It is not cheap enough to enable in prod, and this is a bug which should be fixed. | 451 | It is not cheap enough to enable in prod, and this is a bug which should be fixed. |
452 | |||
453 | ### Configurability | ||
454 | |||
455 | rust-analyzer strives to be as configurable as possible while offering reasonable defaults where no configuration exists yet. | ||
456 | There will always be features that some people find more annoying than helpful, so giving the users the ability to tweak or disable these is a big part of offering a good user experience. | ||
457 | Mind the code--architecture gap: at the moment, we are using fewer feature flags than we really should. | ||
diff --git a/docs/dev/lsp-extensions.md b/docs/dev/lsp-extensions.md index fbe2ce1c9..11a3dd04e 100644 --- a/docs/dev/lsp-extensions.md +++ b/docs/dev/lsp-extensions.md | |||
@@ -25,15 +25,21 @@ rust-analyzer supports clangd's extension for opting into UTF-8 as the coordinat | |||
25 | 25 | ||
26 | https://clangd.llvm.org/extensions.html#utf-8-offsets | 26 | https://clangd.llvm.org/extensions.html#utf-8-offsets |
27 | 27 | ||
28 | ## `initializationOptions` | 28 | ## Configuration in `initializationOptions` |
29 | |||
30 | **Issue:** https://github.com/microsoft/language-server-protocol/issues/567 | ||
31 | |||
32 | The `initializationOptions` filed of the `InitializeParams` of the initialization request should contain `"rust-analyzer"` section of the configuration. | ||
33 | |||
34 | `rust-analyzer` normally sends a `"workspace/configuration"` request with `{ "items": ["rust-analyzer"] }` payload. | ||
35 | However, the server can't do this during initialization. | ||
36 | At the same time some essential configuration parameters are needed early on, before servicing requests. | ||
37 | For this reason, we ask that `initializationOptions` contains the configuration, as if the server did make a `"workspace/configuration"` request. | ||
29 | 38 | ||
30 | For `initializationOptions`, `rust-analyzer` expects `"rust-analyzer"` section of the configuration. | ||
31 | That is, `rust-analyzer` usually sends `"workspace/configuration"` request with `{ "items": ["rust-analyzer"] }` payload. | ||
32 | `initializationOptions` should contain the same data that would be in the first item of the result. | ||
33 | If a language client does not know about `rust-analyzer`'s configuration options it can get sensible defaults by doing any of the following: | 39 | If a language client does not know about `rust-analyzer`'s configuration options it can get sensible defaults by doing any of the following: |
34 | * Not sending `initializationOptions` | 40 | * Not sending `initializationOptions` |
35 | * Send `"initializationOptions": null` | 41 | * Sending `"initializationOptions": null` |
36 | * Send `"initializationOptions": {}` | 42 | * Sending `"initializationOptions": {}` |
37 | 43 | ||
38 | ## Snippet `TextEdit` | 44 | ## Snippet `TextEdit` |
39 | 45 | ||