diff options
author | Aleksey Kladov <[email protected]> | 2020-02-18 11:25:26 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-02-18 11:25:26 +0000 |
commit | 4d307ff8024c8d2d533bc3ab7aac1d63ca5c5977 (patch) | |
tree | 08e5d3f64f545d402b1a9f4fe65330ca56e1d741 /crates/ra_lsp_server/src | |
parent | 1f142d79ed251db58570a5863b06c8826221f9c9 (diff) |
Fully document ra_lsp_server
Diffstat (limited to 'crates/ra_lsp_server/src')
-rw-r--r-- | crates/ra_lsp_server/src/cargo_target_spec.rs | 6 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/conv.rs | 3 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/diagnostics.rs | 4 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/main_loop.rs | 4 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/main_loop/handlers.rs | 5 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/main_loop/pending_requests.rs | 2 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/main_loop/subscriptions.rs | 3 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/world.rs | 4 |
8 files changed, 20 insertions, 11 deletions
diff --git a/crates/ra_lsp_server/src/cargo_target_spec.rs b/crates/ra_lsp_server/src/cargo_target_spec.rs index d0a52670a..53751aafb 100644 --- a/crates/ra_lsp_server/src/cargo_target_spec.rs +++ b/crates/ra_lsp_server/src/cargo_target_spec.rs | |||
@@ -1,10 +1,14 @@ | |||
1 | //! FIXME: write short doc here | 1 | //! See `CargoTargetSpec` |
2 | 2 | ||
3 | use ra_ide::{FileId, RunnableKind, TestId}; | 3 | use ra_ide::{FileId, RunnableKind, TestId}; |
4 | use ra_project_model::{self, ProjectWorkspace, TargetKind}; | 4 | use ra_project_model::{self, ProjectWorkspace, TargetKind}; |
5 | 5 | ||
6 | use crate::{world::WorldSnapshot, Result}; | 6 | use crate::{world::WorldSnapshot, Result}; |
7 | 7 | ||
8 | /// Abstract representation of Cargo target. | ||
9 | /// | ||
10 | /// We use it to cook up the set of cli args we need to pass to Cargo to | ||
11 | /// build/test/run the target. | ||
8 | pub(crate) struct CargoTargetSpec { | 12 | pub(crate) struct CargoTargetSpec { |
9 | pub(crate) package: String, | 13 | pub(crate) package: String, |
10 | pub(crate) target: String, | 14 | pub(crate) target: String, |
diff --git a/crates/ra_lsp_server/src/conv.rs b/crates/ra_lsp_server/src/conv.rs index 8af74b211..90ef74056 100644 --- a/crates/ra_lsp_server/src/conv.rs +++ b/crates/ra_lsp_server/src/conv.rs | |||
@@ -1,4 +1,5 @@ | |||
1 | //! Convenience module responsible for translating between rust-analyzer's types and LSP types. | 1 | //! Convenience module responsible for translating between rust-analyzer's types |
2 | //! and LSP types. | ||
2 | 3 | ||
3 | use lsp_types::{ | 4 | use lsp_types::{ |
4 | self, CreateFile, DiagnosticSeverity, DocumentChangeOperation, DocumentChanges, Documentation, | 5 | self, CreateFile, DiagnosticSeverity, DocumentChangeOperation, DocumentChanges, Documentation, |
diff --git a/crates/ra_lsp_server/src/diagnostics.rs b/crates/ra_lsp_server/src/diagnostics.rs index ea08bce24..e7924f0a3 100644 --- a/crates/ra_lsp_server/src/diagnostics.rs +++ b/crates/ra_lsp_server/src/diagnostics.rs | |||
@@ -1,7 +1,9 @@ | |||
1 | //! Book keeping for keeping diagnostics easily in sync with the client. | 1 | //! Book keeping for keeping diagnostics easily in sync with the client. |
2 | |||
3 | use std::{collections::HashMap, sync::Arc}; | ||
4 | |||
2 | use lsp_types::{CodeActionOrCommand, Diagnostic, Range}; | 5 | use lsp_types::{CodeActionOrCommand, Diagnostic, Range}; |
3 | use ra_ide::FileId; | 6 | use ra_ide::FileId; |
4 | use std::{collections::HashMap, sync::Arc}; | ||
5 | 7 | ||
6 | pub type CheckFixes = Arc<HashMap<FileId, Vec<Fix>>>; | 8 | pub type CheckFixes = Arc<HashMap<FileId, Vec<Fix>>>; |
7 | 9 | ||
diff --git a/crates/ra_lsp_server/src/main_loop.rs b/crates/ra_lsp_server/src/main_loop.rs index 944074118..67d8a5f6f 100644 --- a/crates/ra_lsp_server/src/main_loop.rs +++ b/crates/ra_lsp_server/src/main_loop.rs | |||
@@ -1,5 +1,5 @@ | |||
1 | //! The main loop of `ra_lsp_server` responsible for dispatching LSP requests/replies and | 1 | //! The main loop of `ra_lsp_server` responsible for dispatching LSP |
2 | //! notifications back to the client. | 2 | //! requests/replies and notifications back to the client. |
3 | 3 | ||
4 | mod handlers; | 4 | mod handlers; |
5 | mod subscriptions; | 5 | mod subscriptions; |
diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs index 92f219e28..bb7bab372 100644 --- a/crates/ra_lsp_server/src/main_loop/handlers.rs +++ b/crates/ra_lsp_server/src/main_loop/handlers.rs | |||
@@ -1,5 +1,6 @@ | |||
1 | //! This module is responsible for implementing handlers for Lanuage Server Protocol. | 1 | //! This module is responsible for implementing handlers for Language Server |
2 | //! The majority of requests are fulfilled by calling into the `ra_ide` crate. | 2 | //! Protocol. The majority of requests are fulfilled by calling into the |
3 | //! `ra_ide` crate. | ||
3 | 4 | ||
4 | use std::{ | 5 | use std::{ |
5 | collections::hash_map::Entry, | 6 | collections::hash_map::Entry, |
diff --git a/crates/ra_lsp_server/src/main_loop/pending_requests.rs b/crates/ra_lsp_server/src/main_loop/pending_requests.rs index 2d2213464..73b33e419 100644 --- a/crates/ra_lsp_server/src/main_loop/pending_requests.rs +++ b/crates/ra_lsp_server/src/main_loop/pending_requests.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | //! Datastructures that keep track of inflight requests. | 1 | //! Data structures that keep track of inflight requests. |
2 | 2 | ||
3 | use std::time::{Duration, Instant}; | 3 | use std::time::{Duration, Instant}; |
4 | 4 | ||
diff --git a/crates/ra_lsp_server/src/main_loop/subscriptions.rs b/crates/ra_lsp_server/src/main_loop/subscriptions.rs index b0bae90f5..bee6437cf 100644 --- a/crates/ra_lsp_server/src/main_loop/subscriptions.rs +++ b/crates/ra_lsp_server/src/main_loop/subscriptions.rs | |||
@@ -1,4 +1,5 @@ | |||
1 | //! Keeps track of file subscriptions. | 1 | //! Keeps track of file subscriptions -- the set of currently opened files for |
2 | //! which we want to publish diagnostics, syntax highlighting, etc. | ||
2 | 3 | ||
3 | use ra_ide::FileId; | 4 | use ra_ide::FileId; |
4 | use rustc_hash::FxHashSet; | 5 | use rustc_hash::FxHashSet; |
diff --git a/crates/ra_lsp_server/src/world.rs b/crates/ra_lsp_server/src/world.rs index 71c95d4af..96efab844 100644 --- a/crates/ra_lsp_server/src/world.rs +++ b/crates/ra_lsp_server/src/world.rs | |||
@@ -1,5 +1,5 @@ | |||
1 | //! The context or environment in which the language server functions. | 1 | //! The context or environment in which the language server functions. In our |
2 | //! In our server implementation this is know as the `WorldState`. | 2 | //! server implementation this is know as the `WorldState`. |
3 | //! | 3 | //! |
4 | //! Each tick provides an immutable snapshot of the state as `WorldSnapshot`. | 4 | //! Each tick provides an immutable snapshot of the state as `WorldSnapshot`. |
5 | 5 | ||