diff options
Diffstat (limited to 'crates/ra_lsp_server/src')
-rw-r--r-- | crates/ra_lsp_server/src/caps.rs | 7 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/cargo_target_spec.rs | 2 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/conv.rs | 14 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/lib.rs | 5 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/main.rs | 4 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/main_loop.rs | 9 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/main_loop/handlers.rs | 21 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/project_model.rs | 2 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/req.rs | 11 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/vfs_filter.rs | 4 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/world.rs | 10 |
11 files changed, 44 insertions, 45 deletions
diff --git a/crates/ra_lsp_server/src/caps.rs b/crates/ra_lsp_server/src/caps.rs index 9095bee89..3851aadf2 100644 --- a/crates/ra_lsp_server/src/caps.rs +++ b/crates/ra_lsp_server/src/caps.rs | |||
@@ -1,8 +1,9 @@ | |||
1 | use lsp_types::{ | 1 | use lsp_types::{ |
2 | CodeActionProviderCapability, CodeLensOptions, CompletionOptions, DocumentOnTypeFormattingOptions, | 2 | CodeActionProviderCapability, CodeLensOptions, CompletionOptions, |
3 | ExecuteCommandOptions, FoldingRangeProviderCapability, RenameOptions, RenameProviderCapability, | 3 | DocumentOnTypeFormattingOptions, ExecuteCommandOptions, FoldingRangeProviderCapability, |
4 | GenericCapability, ImplementationProviderCapability, RenameOptions, RenameProviderCapability, | ||
4 | ServerCapabilities, SignatureHelpOptions, TextDocumentSyncCapability, TextDocumentSyncKind, | 5 | ServerCapabilities, SignatureHelpOptions, TextDocumentSyncCapability, TextDocumentSyncKind, |
5 | TextDocumentSyncOptions, ImplementationProviderCapability, GenericCapability, TypeDefinitionProviderCapability | 6 | TextDocumentSyncOptions, TypeDefinitionProviderCapability, |
6 | }; | 7 | }; |
7 | 8 | ||
8 | pub fn server_capabilities() -> ServerCapabilities { | 9 | pub fn server_capabilities() -> ServerCapabilities { |
diff --git a/crates/ra_lsp_server/src/cargo_target_spec.rs b/crates/ra_lsp_server/src/cargo_target_spec.rs index 082ac8609..050c5fd95 100644 --- a/crates/ra_lsp_server/src/cargo_target_spec.rs +++ b/crates/ra_lsp_server/src/cargo_target_spec.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | use crate::{ | 1 | use crate::{ |
2 | project_model::{self, TargetKind}, | 2 | project_model::{self, TargetKind}, |
3 | world::WorldSnapshot, | 3 | world::WorldSnapshot, |
4 | Result | 4 | Result, |
5 | }; | 5 | }; |
6 | 6 | ||
7 | use ra_ide_api::{FileId, RunnableKind}; | 7 | use ra_ide_api::{FileId, RunnableKind}; |
diff --git a/crates/ra_lsp_server/src/conv.rs b/crates/ra_lsp_server/src/conv.rs index 257492589..c8128f55b 100644 --- a/crates/ra_lsp_server/src/conv.rs +++ b/crates/ra_lsp_server/src/conv.rs | |||
@@ -1,13 +1,13 @@ | |||
1 | use lsp_types::{ | 1 | use lsp_types::{ |
2 | self, CreateFile, Documentation, DocumentChangeOperation, DocumentChanges, Location, LocationLink, | 2 | self, CreateFile, DocumentChangeOperation, DocumentChanges, Documentation, Location, |
3 | MarkupContent, MarkupKind, Position, Range, RenameFile, ResourceOp, SymbolKind, TextDocumentEdit, TextDocumentIdentifier, | 3 | LocationLink, MarkupContent, MarkupKind, Position, Range, RenameFile, ResourceOp, SymbolKind, |
4 | TextDocumentItem, TextDocumentPositionParams, Url, VersionedTextDocumentIdentifier, | 4 | TextDocumentEdit, TextDocumentIdentifier, TextDocumentItem, TextDocumentPositionParams, Url, |
5 | WorkspaceEdit, | 5 | VersionedTextDocumentIdentifier, WorkspaceEdit, |
6 | }; | 6 | }; |
7 | use ra_ide_api::{ | 7 | use ra_ide_api::{ |
8 | CompletionItem, CompletionItemKind, FileId, FilePosition, FileRange, FileSystemEdit, | 8 | translate_offset_with_edit, CompletionItem, CompletionItemKind, FileId, FilePosition, |
9 | NavigationTarget, SourceChange, SourceFileEdit, RangeInfo, | 9 | FileRange, FileSystemEdit, InsertTextFormat, LineCol, LineIndex, NavigationTarget, RangeInfo, |
10 | LineCol, LineIndex, translate_offset_with_edit, InsertTextFormat | 10 | SourceChange, SourceFileEdit, |
11 | }; | 11 | }; |
12 | use ra_syntax::{SyntaxKind, TextRange, TextUnit}; | 12 | use ra_syntax::{SyntaxKind, TextRange, TextUnit}; |
13 | use ra_text_edit::{AtomTextEdit, TextEdit}; | 13 | use ra_text_edit::{AtomTextEdit, TextEdit}; |
diff --git a/crates/ra_lsp_server/src/lib.rs b/crates/ra_lsp_server/src/lib.rs index 14cfa401f..56a263aa5 100644 --- a/crates/ra_lsp_server/src/lib.rs +++ b/crates/ra_lsp_server/src/lib.rs | |||
@@ -10,4 +10,7 @@ pub mod init; | |||
10 | mod world; | 10 | mod world; |
11 | 11 | ||
12 | pub type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync>>; | 12 | pub type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync>>; |
13 | pub use crate::{caps::server_capabilities, main_loop::main_loop, main_loop::LspError, init::InitializationOptions}; | 13 | pub use crate::{ |
14 | caps::server_capabilities, init::InitializationOptions, main_loop::main_loop, | ||
15 | main_loop::LspError, | ||
16 | }; | ||
diff --git a/crates/ra_lsp_server/src/main.rs b/crates/ra_lsp_server/src/main.rs index 4aadb5ea8..6aa6dd49f 100644 --- a/crates/ra_lsp_server/src/main.rs +++ b/crates/ra_lsp_server/src/main.rs | |||
@@ -1,8 +1,8 @@ | |||
1 | use serde::Deserialize; | ||
2 | use flexi_logger::{Duplicate, Logger}; | 1 | use flexi_logger::{Duplicate, Logger}; |
3 | use gen_lsp_server::{run_server, stdio_transport}; | 2 | use gen_lsp_server::{run_server, stdio_transport}; |
3 | use serde::Deserialize; | ||
4 | 4 | ||
5 | use ra_lsp_server::{Result, InitializationOptions}; | 5 | use ra_lsp_server::{InitializationOptions, Result}; |
6 | use ra_prof; | 6 | use ra_prof; |
7 | 7 | ||
8 | fn main() -> Result<()> { | 8 | fn main() -> Result<()> { |
diff --git a/crates/ra_lsp_server/src/main_loop.rs b/crates/ra_lsp_server/src/main_loop.rs index aeb8a2299..cb73e6586 100644 --- a/crates/ra_lsp_server/src/main_loop.rs +++ b/crates/ra_lsp_server/src/main_loop.rs | |||
@@ -2,7 +2,7 @@ mod handlers; | |||
2 | mod subscriptions; | 2 | mod subscriptions; |
3 | pub(crate) mod pending_requests; | 3 | pub(crate) mod pending_requests; |
4 | 4 | ||
5 | use std::{fmt, path::PathBuf, sync::Arc, time::Instant, error::Error}; | 5 | use std::{error::Error, fmt, path::PathBuf, sync::Arc, time::Instant}; |
6 | 6 | ||
7 | use crossbeam_channel::{select, unbounded, Receiver, RecvError, Sender}; | 7 | use crossbeam_channel::{select, unbounded, Receiver, RecvError, Sender}; |
8 | use gen_lsp_server::{ | 8 | use gen_lsp_server::{ |
@@ -10,21 +10,20 @@ use gen_lsp_server::{ | |||
10 | }; | 10 | }; |
11 | use lsp_types::NumberOrString; | 11 | use lsp_types::NumberOrString; |
12 | use ra_ide_api::{Canceled, FileId, LibraryData}; | 12 | use ra_ide_api::{Canceled, FileId, LibraryData}; |
13 | use ra_prof::profile; | ||
13 | use ra_vfs::VfsTask; | 14 | use ra_vfs::VfsTask; |
14 | use serde::{de::DeserializeOwned, Serialize}; | 15 | use serde::{de::DeserializeOwned, Serialize}; |
15 | use threadpool::ThreadPool; | 16 | use threadpool::ThreadPool; |
16 | use ra_prof::profile; | ||
17 | 17 | ||
18 | use crate::{ | 18 | use crate::{ |
19 | main_loop::{ | 19 | main_loop::{ |
20 | pending_requests::{PendingRequest, PendingRequests}, | ||
20 | subscriptions::Subscriptions, | 21 | subscriptions::Subscriptions, |
21 | pending_requests::{PendingRequests, PendingRequest}, | ||
22 | }, | 22 | }, |
23 | project_model::workspace_loader, | 23 | project_model::workspace_loader, |
24 | req, | 24 | req, |
25 | world::{WorldSnapshot, WorldState}, | 25 | world::{WorldSnapshot, WorldState}, |
26 | Result, | 26 | InitializationOptions, Result, |
27 | InitializationOptions, | ||
28 | }; | 27 | }; |
29 | 28 | ||
30 | const THREADPOOL_SIZE: usize = 8; | 29 | const THREADPOOL_SIZE: usize = 8; |
diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs index 47222cd0a..bbbc93b1c 100644 --- a/crates/ra_lsp_server/src/main_loop/handlers.rs +++ b/crates/ra_lsp_server/src/main_loop/handlers.rs | |||
@@ -1,22 +1,21 @@ | |||
1 | use std::{io::Write as _, fmt::Write as _}; | 1 | use std::{fmt::Write as _, io::Write as _}; |
2 | 2 | ||
3 | use gen_lsp_server::ErrorCode; | 3 | use gen_lsp_server::ErrorCode; |
4 | use lsp_types::{ | 4 | use lsp_types::{ |
5 | CodeActionResponse, CodeLens, Command, Diagnostic, DiagnosticSeverity, CodeAction, | 5 | CodeAction, CodeActionResponse, CodeLens, Command, Diagnostic, DiagnosticSeverity, |
6 | DocumentFormattingParams, DocumentHighlight, DocumentSymbol, FoldingRange, | 6 | DocumentFormattingParams, DocumentHighlight, DocumentSymbol, FoldingRange, FoldingRangeKind, |
7 | FoldingRangeKind, FoldingRangeParams, Hover, HoverContents, Location, MarkupContent, | 7 | FoldingRangeParams, Hover, HoverContents, Location, MarkupContent, MarkupKind, Position, |
8 | MarkupKind, Position, PrepareRenameResponse, Range, | 8 | PrepareRenameResponse, Range, RenameParams, SymbolInformation, TextDocumentIdentifier, |
9 | RenameParams,SymbolInformation, TextDocumentIdentifier, TextEdit, | 9 | TextEdit, WorkspaceEdit, |
10 | WorkspaceEdit, | ||
11 | }; | 10 | }; |
12 | use ra_ide_api::{ | 11 | use ra_ide_api::{ |
13 | FileId, FilePosition, FileRange, FoldKind, Query, RangeInfo, RunnableKind, Severity, Cancelable, | 12 | AssistId, Cancelable, FileId, FilePosition, FileRange, FoldKind, Query, RangeInfo, |
14 | AssistId, | 13 | RunnableKind, Severity, |
15 | }; | 14 | }; |
16 | use ra_syntax::{AstNode, SyntaxKind, TextUnit, TextRange}; | ||
17 | use ra_prof::profile; | 15 | use ra_prof::profile; |
16 | use ra_syntax::{AstNode, SyntaxKind, TextRange, TextUnit}; | ||
18 | use rustc_hash::FxHashMap; | 17 | use rustc_hash::FxHashMap; |
19 | use serde::{Serialize, Deserialize}; | 18 | use serde::{Deserialize, Serialize}; |
20 | use serde_json::to_value; | 19 | use serde_json::to_value; |
21 | use url_serde::Ser; | 20 | use url_serde::Ser; |
22 | 21 | ||
diff --git a/crates/ra_lsp_server/src/project_model.rs b/crates/ra_lsp_server/src/project_model.rs index 7d6440fad..1130d08de 100644 --- a/crates/ra_lsp_server/src/project_model.rs +++ b/crates/ra_lsp_server/src/project_model.rs | |||
@@ -5,7 +5,7 @@ use thread_worker::Worker; | |||
5 | use crate::Result; | 5 | use crate::Result; |
6 | 6 | ||
7 | pub use ra_project_model::{ | 7 | pub use ra_project_model::{ |
8 | ProjectWorkspace, CargoWorkspace, Package, Target, TargetKind, Sysroot, | 8 | CargoWorkspace, Package, ProjectWorkspace, Sysroot, Target, TargetKind, |
9 | }; | 9 | }; |
10 | 10 | ||
11 | pub fn workspace_loader() -> Worker<PathBuf, Result<ProjectWorkspace>> { | 11 | pub fn workspace_loader() -> Worker<PathBuf, Result<ProjectWorkspace>> { |
diff --git a/crates/ra_lsp_server/src/req.rs b/crates/ra_lsp_server/src/req.rs index 992c24eac..27f2deb34 100644 --- a/crates/ra_lsp_server/src/req.rs +++ b/crates/ra_lsp_server/src/req.rs | |||
@@ -4,12 +4,11 @@ use serde::{Deserialize, Serialize}; | |||
4 | use url_serde; | 4 | use url_serde; |
5 | 5 | ||
6 | pub use lsp_types::{ | 6 | pub use lsp_types::{ |
7 | notification::*, request::*, ApplyWorkspaceEditParams, CodeActionParams, CodeLens, CodeLensParams, | 7 | notification::*, request::*, ApplyWorkspaceEditParams, CodeActionParams, CodeLens, |
8 | CompletionParams, CompletionResponse, DocumentOnTypeFormattingParams, DocumentSymbolParams, | 8 | CodeLensParams, CompletionParams, CompletionResponse, DocumentOnTypeFormattingParams, |
9 | DocumentSymbolResponse, ExecuteCommandParams, Hover, InitializeResult, | 9 | DocumentSymbolParams, DocumentSymbolResponse, ExecuteCommandParams, Hover, InitializeResult, |
10 | PublishDiagnosticsParams, ReferenceParams, SignatureHelp, TextDocumentEdit, | 10 | MessageType, PublishDiagnosticsParams, ReferenceParams, ShowMessageParams, SignatureHelp, |
11 | TextDocumentPositionParams, TextEdit, WorkspaceEdit, WorkspaceSymbolParams, | 11 | TextDocumentEdit, TextDocumentPositionParams, TextEdit, WorkspaceEdit, WorkspaceSymbolParams, |
12 | MessageType, ShowMessageParams, | ||
13 | }; | 12 | }; |
14 | 13 | ||
15 | pub enum AnalyzerStatus {} | 14 | pub enum AnalyzerStatus {} |
diff --git a/crates/ra_lsp_server/src/vfs_filter.rs b/crates/ra_lsp_server/src/vfs_filter.rs index dd20c1203..e16a57da5 100644 --- a/crates/ra_lsp_server/src/vfs_filter.rs +++ b/crates/ra_lsp_server/src/vfs_filter.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | use std::path::PathBuf; | ||
2 | use ra_project_model::ProjectRoot; | 1 | use ra_project_model::ProjectRoot; |
3 | use ra_vfs::{RootEntry, Filter, RelativePath}; | 2 | use ra_vfs::{Filter, RelativePath, RootEntry}; |
3 | use std::path::PathBuf; | ||
4 | 4 | ||
5 | /// `IncludeRustFiles` is used to convert | 5 | /// `IncludeRustFiles` is used to convert |
6 | /// from `ProjectRoot` to `RootEntry` for VFS | 6 | /// from `ProjectRoot` to `RootEntry` for VFS |
diff --git a/crates/ra_lsp_server/src/world.rs b/crates/ra_lsp_server/src/world.rs index 7822e1c1c..fdc577622 100644 --- a/crates/ra_lsp_server/src/world.rs +++ b/crates/ra_lsp_server/src/world.rs | |||
@@ -3,22 +3,20 @@ use std::{ | |||
3 | sync::Arc, | 3 | sync::Arc, |
4 | }; | 4 | }; |
5 | 5 | ||
6 | use gen_lsp_server::ErrorCode; | ||
6 | use lsp_types::Url; | 7 | use lsp_types::Url; |
8 | use parking_lot::RwLock; | ||
7 | use ra_ide_api::{ | 9 | use ra_ide_api::{ |
8 | Analysis, AnalysisChange, AnalysisHost, CrateGraph, FileId, LibraryData, | 10 | Analysis, AnalysisChange, AnalysisHost, CrateGraph, FileId, LibraryData, SourceRootId, |
9 | SourceRootId | ||
10 | }; | 11 | }; |
11 | use ra_vfs::{Vfs, VfsChange, VfsFile, VfsRoot}; | 12 | use ra_vfs::{Vfs, VfsChange, VfsFile, VfsRoot}; |
12 | use relative_path::RelativePathBuf; | 13 | use relative_path::RelativePathBuf; |
13 | use parking_lot::RwLock; | ||
14 | use gen_lsp_server::ErrorCode; | ||
15 | 14 | ||
16 | use crate::{ | 15 | use crate::{ |
17 | main_loop::pending_requests::{CompletedRequest, LatestRequests}, | 16 | main_loop::pending_requests::{CompletedRequest, LatestRequests}, |
18 | project_model::ProjectWorkspace, | 17 | project_model::ProjectWorkspace, |
19 | vfs_filter::IncludeRustFiles, | 18 | vfs_filter::IncludeRustFiles, |
20 | Result, | 19 | LspError, Result, |
21 | LspError, | ||
22 | }; | 20 | }; |
23 | 21 | ||
24 | /// `WorldState` is the primary mutable state of the language server | 22 | /// `WorldState` is the primary mutable state of the language server |