aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-07-04 21:05:17 +0100
committerAleksey Kladov <[email protected]>2019-07-04 21:09:09 +0100
commit1834bae5b86c54ed9dece26e82436919d59e6cb7 (patch)
tree92c8b984e874b67fa1831613464bbe356c1af3dd /crates/ra_lsp_server/src
parent2b2cd829b0f95aef338227deb05ec7503dae9b6c (diff)
allow rustfmt to reorder imports
This wasn't a right decision in the first place, the feature flag was broken in the last rustfmt release, and syntax highlighting of imports is more important anyway
Diffstat (limited to 'crates/ra_lsp_server/src')
-rw-r--r--crates/ra_lsp_server/src/caps.rs7
-rw-r--r--crates/ra_lsp_server/src/cargo_target_spec.rs2
-rw-r--r--crates/ra_lsp_server/src/conv.rs14
-rw-r--r--crates/ra_lsp_server/src/lib.rs5
-rw-r--r--crates/ra_lsp_server/src/main.rs4
-rw-r--r--crates/ra_lsp_server/src/main_loop.rs9
-rw-r--r--crates/ra_lsp_server/src/main_loop/handlers.rs21
-rw-r--r--crates/ra_lsp_server/src/project_model.rs2
-rw-r--r--crates/ra_lsp_server/src/req.rs11
-rw-r--r--crates/ra_lsp_server/src/vfs_filter.rs4
-rw-r--r--crates/ra_lsp_server/src/world.rs10
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 @@
1use lsp_types::{ 1use 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
8pub fn server_capabilities() -> ServerCapabilities { 9pub 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 @@
1use crate::{ 1use 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
7use ra_ide_api::{FileId, RunnableKind}; 7use 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 @@
1use lsp_types::{ 1use 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};
7use ra_ide_api::{ 7use 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};
12use ra_syntax::{SyntaxKind, TextRange, TextUnit}; 12use ra_syntax::{SyntaxKind, TextRange, TextUnit};
13use ra_text_edit::{AtomTextEdit, TextEdit}; 13use 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;
10mod world; 10mod world;
11 11
12pub type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync>>; 12pub type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync>>;
13pub use crate::{caps::server_capabilities, main_loop::main_loop, main_loop::LspError, init::InitializationOptions}; 13pub 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 @@
1use serde::Deserialize;
2use flexi_logger::{Duplicate, Logger}; 1use flexi_logger::{Duplicate, Logger};
3use gen_lsp_server::{run_server, stdio_transport}; 2use gen_lsp_server::{run_server, stdio_transport};
3use serde::Deserialize;
4 4
5use ra_lsp_server::{Result, InitializationOptions}; 5use ra_lsp_server::{InitializationOptions, Result};
6use ra_prof; 6use ra_prof;
7 7
8fn main() -> Result<()> { 8fn 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;
2mod subscriptions; 2mod subscriptions;
3pub(crate) mod pending_requests; 3pub(crate) mod pending_requests;
4 4
5use std::{fmt, path::PathBuf, sync::Arc, time::Instant, error::Error}; 5use std::{error::Error, fmt, path::PathBuf, sync::Arc, time::Instant};
6 6
7use crossbeam_channel::{select, unbounded, Receiver, RecvError, Sender}; 7use crossbeam_channel::{select, unbounded, Receiver, RecvError, Sender};
8use gen_lsp_server::{ 8use gen_lsp_server::{
@@ -10,21 +10,20 @@ use gen_lsp_server::{
10}; 10};
11use lsp_types::NumberOrString; 11use lsp_types::NumberOrString;
12use ra_ide_api::{Canceled, FileId, LibraryData}; 12use ra_ide_api::{Canceled, FileId, LibraryData};
13use ra_prof::profile;
13use ra_vfs::VfsTask; 14use ra_vfs::VfsTask;
14use serde::{de::DeserializeOwned, Serialize}; 15use serde::{de::DeserializeOwned, Serialize};
15use threadpool::ThreadPool; 16use threadpool::ThreadPool;
16use ra_prof::profile;
17 17
18use crate::{ 18use 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
30const THREADPOOL_SIZE: usize = 8; 29const 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 @@
1use std::{io::Write as _, fmt::Write as _}; 1use std::{fmt::Write as _, io::Write as _};
2 2
3use gen_lsp_server::ErrorCode; 3use gen_lsp_server::ErrorCode;
4use lsp_types::{ 4use 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};
12use ra_ide_api::{ 11use 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};
16use ra_syntax::{AstNode, SyntaxKind, TextUnit, TextRange};
17use ra_prof::profile; 15use ra_prof::profile;
16use ra_syntax::{AstNode, SyntaxKind, TextRange, TextUnit};
18use rustc_hash::FxHashMap; 17use rustc_hash::FxHashMap;
19use serde::{Serialize, Deserialize}; 18use serde::{Deserialize, Serialize};
20use serde_json::to_value; 19use serde_json::to_value;
21use url_serde::Ser; 20use 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;
5use crate::Result; 5use crate::Result;
6 6
7pub use ra_project_model::{ 7pub use ra_project_model::{
8 ProjectWorkspace, CargoWorkspace, Package, Target, TargetKind, Sysroot, 8 CargoWorkspace, Package, ProjectWorkspace, Sysroot, Target, TargetKind,
9}; 9};
10 10
11pub fn workspace_loader() -> Worker<PathBuf, Result<ProjectWorkspace>> { 11pub 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};
4use url_serde; 4use url_serde;
5 5
6pub use lsp_types::{ 6pub 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
15pub enum AnalyzerStatus {} 14pub 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 @@
1use std::path::PathBuf;
2use ra_project_model::ProjectRoot; 1use ra_project_model::ProjectRoot;
3use ra_vfs::{RootEntry, Filter, RelativePath}; 2use ra_vfs::{Filter, RelativePath, RootEntry};
3use 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
6use gen_lsp_server::ErrorCode;
6use lsp_types::Url; 7use lsp_types::Url;
8use parking_lot::RwLock;
7use ra_ide_api::{ 9use ra_ide_api::{
8 Analysis, AnalysisChange, AnalysisHost, CrateGraph, FileId, LibraryData, 10 Analysis, AnalysisChange, AnalysisHost, CrateGraph, FileId, LibraryData, SourceRootId,
9 SourceRootId
10}; 11};
11use ra_vfs::{Vfs, VfsChange, VfsFile, VfsRoot}; 12use ra_vfs::{Vfs, VfsChange, VfsFile, VfsRoot};
12use relative_path::RelativePathBuf; 13use relative_path::RelativePathBuf;
13use parking_lot::RwLock;
14use gen_lsp_server::ErrorCode;
15 14
16use crate::{ 15use 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