aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-01-14 10:55:56 +0000
committerAleksey Kladov <[email protected]>2019-01-14 11:32:03 +0000
commit7e5ab9b78c313c3936cb7cb33de89e3c3c41f2bc (patch)
treeb7d46e7269b7af51241498be15ece1ef2e6b7ade /crates
parente465032daf0d2594c09ad693b2ae816b96e883b2 (diff)
switch to lsp-types
Diffstat (limited to 'crates')
-rw-r--r--crates/gen_lsp_server/Cargo.toml2
-rw-r--r--crates/gen_lsp_server/src/lib.rs6
-rw-r--r--crates/gen_lsp_server/src/msg.rs2
-rw-r--r--crates/ra_lsp_server/Cargo.toml2
-rw-r--r--crates/ra_lsp_server/src/caps.rs2
-rw-r--r--crates/ra_lsp_server/src/conv.rs30
-rw-r--r--crates/ra_lsp_server/src/main_loop.rs2
-rw-r--r--crates/ra_lsp_server/src/main_loop/handlers.rs2
-rw-r--r--crates/ra_lsp_server/src/req.rs4
-rw-r--r--crates/ra_lsp_server/src/server_world.rs2
-rw-r--r--crates/ra_lsp_server/tests/heavy_tests/main.rs2
-rw-r--r--crates/ra_lsp_server/tests/heavy_tests/support.rs2
12 files changed, 29 insertions, 29 deletions
diff --git a/crates/gen_lsp_server/Cargo.toml b/crates/gen_lsp_server/Cargo.toml
index a421a3e0b..041151741 100644
--- a/crates/gen_lsp_server/Cargo.toml
+++ b/crates/gen_lsp_server/Cargo.toml
@@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
8description = "Generic LSP server scaffold." 8description = "Generic LSP server scaffold."
9 9
10[dependencies] 10[dependencies]
11languageserver-types = "0.53.1" 11lsp-types = "0.54.0"
12log = "0.4.3" 12log = "0.4.3"
13failure = "0.1.4" 13failure = "0.1.4"
14serde_json = "1.0.34" 14serde_json = "1.0.34"
diff --git a/crates/gen_lsp_server/src/lib.rs b/crates/gen_lsp_server/src/lib.rs
index 16ac799ac..edbdda6c8 100644
--- a/crates/gen_lsp_server/src/lib.rs
+++ b/crates/gen_lsp_server/src/lib.rs
@@ -6,12 +6,12 @@
6//! 6//!
7//! ```no_run 7//! ```no_run
8//! extern crate gen_lsp_server; 8//! extern crate gen_lsp_server;
9//! extern crate languageserver_types; 9//! extern crate lsp_types;
10//! extern crate failure; 10//! extern crate failure;
11//! extern crate crossbeam_channel; 11//! extern crate crossbeam_channel;
12//! 12//!
13//! use crossbeam_channel::{Sender, Receiver}; 13//! use crossbeam_channel::{Sender, Receiver};
14//! use languageserver_types::{ServerCapabilities, InitializeParams, request::{GotoDefinition, GotoDefinitionResponse}}; 14//! use lsp_types::{ServerCapabilities, InitializeParams, request::{GotoDefinition, GotoDefinitionResponse}};
15//! use gen_lsp_server::{run_server, stdio_transport, handle_shutdown, RawMessage, RawResponse}; 15//! use gen_lsp_server::{run_server, stdio_transport, handle_shutdown, RawMessage, RawResponse};
16//! 16//!
17//! fn main() -> Result<(), failure::Error> { 17//! fn main() -> Result<(), failure::Error> {
@@ -65,7 +65,7 @@ mod msg;
65mod stdio; 65mod stdio;
66 66
67use crossbeam_channel::{Receiver, Sender}; 67use crossbeam_channel::{Receiver, Sender};
68use languageserver_types::{ 68use lsp_types::{
69 notification::{Exit, Initialized}, 69 notification::{Exit, Initialized},
70 request::{Initialize, Shutdown}, 70 request::{Initialize, Shutdown},
71 InitializeParams, InitializeResult, ServerCapabilities, 71 InitializeParams, InitializeResult, ServerCapabilities,
diff --git a/crates/gen_lsp_server/src/msg.rs b/crates/gen_lsp_server/src/msg.rs
index 94bef374c..818111fe7 100644
--- a/crates/gen_lsp_server/src/msg.rs
+++ b/crates/gen_lsp_server/src/msg.rs
@@ -1,6 +1,6 @@
1use std::io::{BufRead, Write}; 1use std::io::{BufRead, Write};
2 2
3use languageserver_types::{notification::Notification, request::Request}; 3use lsp_types::{notification::Notification, request::Request};
4use serde::{Deserialize, Serialize}; 4use serde::{Deserialize, Serialize};
5use serde_json::{from_str, from_value, to_string, to_value, Value}; 5use serde_json::{from_str, from_value, to_string, to_value, Value};
6use failure::{bail, format_err}; 6use failure::{bail, format_err};
diff --git a/crates/ra_lsp_server/Cargo.toml b/crates/ra_lsp_server/Cargo.toml
index 7e307eb1c..0557897fd 100644
--- a/crates/ra_lsp_server/Cargo.toml
+++ b/crates/ra_lsp_server/Cargo.toml
@@ -17,7 +17,7 @@ crossbeam-channel = "0.3.5"
17flexi_logger = "0.10.0" 17flexi_logger = "0.10.0"
18log = "0.4.3" 18log = "0.4.3"
19url_serde = "0.2.0" 19url_serde = "0.2.0"
20languageserver-types = "0.53.1" 20lsp-types = "0.54.0"
21walkdir = "2.2.7" 21walkdir = "2.2.7"
22im = "12.0.0" 22im = "12.0.0"
23cargo_metadata = "0.6.0" 23cargo_metadata = "0.6.0"
diff --git a/crates/ra_lsp_server/src/caps.rs b/crates/ra_lsp_server/src/caps.rs
index be6a6ead6..bca079d65 100644
--- a/crates/ra_lsp_server/src/caps.rs
+++ b/crates/ra_lsp_server/src/caps.rs
@@ -1,4 +1,4 @@
1use languageserver_types::{ 1use lsp_types::{
2 CodeActionProviderCapability, CodeLensOptions, CompletionOptions, DocumentOnTypeFormattingOptions, 2 CodeActionProviderCapability, CodeLensOptions, CompletionOptions, DocumentOnTypeFormattingOptions,
3 ExecuteCommandOptions, FoldingRangeProviderCapability, RenameOptions, RenameProviderCapability, 3 ExecuteCommandOptions, FoldingRangeProviderCapability, RenameOptions, RenameProviderCapability,
4 ServerCapabilities, SignatureHelpOptions, TextDocumentSyncCapability, TextDocumentSyncKind, 4 ServerCapabilities, SignatureHelpOptions, TextDocumentSyncCapability, TextDocumentSyncKind,
diff --git a/crates/ra_lsp_server/src/conv.rs b/crates/ra_lsp_server/src/conv.rs
index 687663d8a..6e187d49e 100644
--- a/crates/ra_lsp_server/src/conv.rs
+++ b/crates/ra_lsp_server/src/conv.rs
@@ -1,4 +1,4 @@
1use languageserver_types::{ 1use lsp_types::{
2 self, CreateFile, DocumentChangeOperation, DocumentChanges, InsertTextFormat, Location, LocationLink, 2 self, CreateFile, DocumentChangeOperation, DocumentChanges, InsertTextFormat, Location, LocationLink,
3 Position, Range, RenameFile, ResourceOp, SymbolKind, TextDocumentEdit, TextDocumentIdentifier, 3 Position, Range, RenameFile, ResourceOp, SymbolKind, TextDocumentEdit, TextDocumentIdentifier,
4 TextDocumentItem, TextDocumentPositionParams, Url, VersionedTextDocumentIdentifier, 4 TextDocumentItem, TextDocumentPositionParams, Url, VersionedTextDocumentIdentifier,
@@ -51,10 +51,10 @@ impl Conv for SyntaxKind {
51} 51}
52 52
53impl Conv for CompletionItemKind { 53impl Conv for CompletionItemKind {
54 type Output = ::languageserver_types::CompletionItemKind; 54 type Output = ::lsp_types::CompletionItemKind;
55 55
56 fn conv(self) -> <Self as Conv>::Output { 56 fn conv(self) -> <Self as Conv>::Output {
57 use languageserver_types::CompletionItemKind::*; 57 use lsp_types::CompletionItemKind::*;
58 match self { 58 match self {
59 CompletionItemKind::Keyword => Keyword, 59 CompletionItemKind::Keyword => Keyword,
60 CompletionItemKind::Snippet => Snippet, 60 CompletionItemKind::Snippet => Snippet,
@@ -75,10 +75,10 @@ impl Conv for CompletionItemKind {
75} 75}
76 76
77impl Conv for CompletionItem { 77impl Conv for CompletionItem {
78 type Output = ::languageserver_types::CompletionItem; 78 type Output = ::lsp_types::CompletionItem;
79 79
80 fn conv(self) -> <Self as Conv>::Output { 80 fn conv(self) -> <Self as Conv>::Output {
81 let mut res = ::languageserver_types::CompletionItem { 81 let mut res = ::lsp_types::CompletionItem {
82 label: self.label().to_string(), 82 label: self.label().to_string(),
83 detail: self.detail().map(|it| it.to_string()), 83 detail: self.detail().map(|it| it.to_string()),
84 filter_text: Some(self.lookup().to_string()), 84 filter_text: Some(self.lookup().to_string()),
@@ -148,9 +148,9 @@ impl ConvWith for Range {
148 148
149impl ConvWith for TextEdit { 149impl ConvWith for TextEdit {
150 type Ctx = LineIndex; 150 type Ctx = LineIndex;
151 type Output = Vec<languageserver_types::TextEdit>; 151 type Output = Vec<lsp_types::TextEdit>;
152 152
153 fn conv_with(self, line_index: &LineIndex) -> Vec<languageserver_types::TextEdit> { 153 fn conv_with(self, line_index: &LineIndex) -> Vec<lsp_types::TextEdit> {
154 self.as_atoms() 154 self.as_atoms()
155 .into_iter() 155 .into_iter()
156 .map_conv_with(line_index) 156 .map_conv_with(line_index)
@@ -160,10 +160,10 @@ impl ConvWith for TextEdit {
160 160
161impl<'a> ConvWith for &'a AtomTextEdit { 161impl<'a> ConvWith for &'a AtomTextEdit {
162 type Ctx = LineIndex; 162 type Ctx = LineIndex;
163 type Output = languageserver_types::TextEdit; 163 type Output = lsp_types::TextEdit;
164 164
165 fn conv_with(self, line_index: &LineIndex) -> languageserver_types::TextEdit { 165 fn conv_with(self, line_index: &LineIndex) -> lsp_types::TextEdit {
166 languageserver_types::TextEdit { 166 lsp_types::TextEdit {
167 range: self.delete.conv_with(line_index), 167 range: self.delete.conv_with(line_index),
168 new_text: self.insert.clone(), 168 new_text: self.insert.clone(),
169 } 169 }
@@ -324,7 +324,7 @@ impl TryConvWith for FileSystemEdit {
324 fn try_conv_with(self, world: &ServerWorld) -> Result<ResourceOp> { 324 fn try_conv_with(self, world: &ServerWorld) -> Result<ResourceOp> {
325 let res = match self { 325 let res = match self {
326 FileSystemEdit::CreateFile { source_root, path } => { 326 FileSystemEdit::CreateFile { source_root, path } => {
327 let uri = world.path_to_uri(source_root, &path)?.to_string(); 327 let uri = world.path_to_uri(source_root, &path)?;
328 ResourceOp::Create(CreateFile { uri, options: None }) 328 ResourceOp::Create(CreateFile { uri, options: None })
329 } 329 }
330 FileSystemEdit::MoveFile { 330 FileSystemEdit::MoveFile {
@@ -332,8 +332,8 @@ impl TryConvWith for FileSystemEdit {
332 dst_source_root, 332 dst_source_root,
333 dst_path, 333 dst_path,
334 } => { 334 } => {
335 let old_uri = world.file_id_to_uri(src)?.to_string(); 335 let old_uri = world.file_id_to_uri(src)?;
336 let new_uri = world.path_to_uri(dst_source_root, &dst_path)?.to_string(); 336 let new_uri = world.path_to_uri(dst_source_root, &dst_path)?;
337 ResourceOp::Rename(RenameFile { 337 ResourceOp::Rename(RenameFile {
338 old_uri, 338 old_uri,
339 new_uri, 339 new_uri,
@@ -361,7 +361,7 @@ pub fn to_location_link(
361 // line index for original range file 361 // line index for original range file
362 line_index: &LineIndex, 362 line_index: &LineIndex,
363) -> Result<LocationLink> { 363) -> Result<LocationLink> {
364 let url = target.info.file_id().try_conv_with(world)?; 364 let target_uri = target.info.file_id().try_conv_with(world)?;
365 let tgt_line_index = world.analysis().file_line_index(target.info.file_id()); 365 let tgt_line_index = world.analysis().file_line_index(target.info.file_id());
366 366
367 let target_range = target.info.full_range().conv_with(&tgt_line_index); 367 let target_range = target.info.full_range().conv_with(&tgt_line_index);
@@ -374,7 +374,7 @@ pub fn to_location_link(
374 374
375 let res = LocationLink { 375 let res = LocationLink {
376 origin_selection_range: Some(target.range.conv_with(line_index)), 376 origin_selection_range: Some(target.range.conv_with(line_index)),
377 target_uri: url.to_string(), 377 target_uri,
378 target_range, 378 target_range,
379 target_selection_range: Some(target_selection_range), 379 target_selection_range: Some(target_selection_range),
380 }; 380 };
diff --git a/crates/ra_lsp_server/src/main_loop.rs b/crates/ra_lsp_server/src/main_loop.rs
index 03c834dbc..19fd294e0 100644
--- a/crates/ra_lsp_server/src/main_loop.rs
+++ b/crates/ra_lsp_server/src/main_loop.rs
@@ -9,7 +9,7 @@ use failure_derive::Fail;
9use gen_lsp_server::{ 9use gen_lsp_server::{
10 handle_shutdown, ErrorCode, RawMessage, RawNotification, RawRequest, RawResponse, 10 handle_shutdown, ErrorCode, RawMessage, RawNotification, RawRequest, RawResponse,
11}; 11};
12use languageserver_types::NumberOrString; 12use lsp_types::NumberOrString;
13use ra_ide_api::{Canceled, FileId, LibraryData}; 13use ra_ide_api::{Canceled, FileId, LibraryData};
14use ra_vfs::VfsTask; 14use ra_vfs::VfsTask;
15use rayon; 15use rayon;
diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs
index 7326a727d..11a705200 100644
--- a/crates/ra_lsp_server/src/main_loop/handlers.rs
+++ b/crates/ra_lsp_server/src/main_loop/handlers.rs
@@ -1,7 +1,7 @@
1use std::collections::HashMap; 1use std::collections::HashMap;
2 2
3use gen_lsp_server::ErrorCode; 3use gen_lsp_server::ErrorCode;
4use languageserver_types::{ 4use lsp_types::{
5 CodeActionResponse, CodeLens, Command, Diagnostic, DiagnosticSeverity, 5 CodeActionResponse, CodeLens, Command, Diagnostic, DiagnosticSeverity,
6 DocumentFormattingParams, DocumentHighlight, DocumentSymbol, Documentation, FoldingRange, 6 DocumentFormattingParams, DocumentHighlight, DocumentSymbol, Documentation, FoldingRange,
7 FoldingRangeKind, FoldingRangeParams, Hover, HoverContents, Location, MarkupContent, 7 FoldingRangeKind, FoldingRangeParams, Hover, HoverContents, Location, MarkupContent,
diff --git a/crates/ra_lsp_server/src/req.rs b/crates/ra_lsp_server/src/req.rs
index c2b16725b..156cf9641 100644
--- a/crates/ra_lsp_server/src/req.rs
+++ b/crates/ra_lsp_server/src/req.rs
@@ -1,9 +1,9 @@
1use languageserver_types::{Location, Position, Range, TextDocumentIdentifier, Url}; 1use lsp_types::{Location, Position, Range, TextDocumentIdentifier, Url};
2use rustc_hash::FxHashMap; 2use rustc_hash::FxHashMap;
3use serde::{Deserialize, Serialize}; 3use serde::{Deserialize, Serialize};
4use url_serde; 4use url_serde;
5 5
6pub use languageserver_types::{ 6pub use lsp_types::{
7 notification::*, request::*, ApplyWorkspaceEditParams, CodeActionParams, CodeLens, CodeLensParams, 7 notification::*, request::*, ApplyWorkspaceEditParams, CodeActionParams, CodeLens, CodeLensParams,
8 CompletionParams, CompletionResponse, DocumentOnTypeFormattingParams, DocumentSymbolParams, 8 CompletionParams, CompletionResponse, DocumentOnTypeFormattingParams, DocumentSymbolParams,
9 DocumentSymbolResponse, ExecuteCommandParams, Hover, InitializeResult, 9 DocumentSymbolResponse, ExecuteCommandParams, Hover, InitializeResult,
diff --git a/crates/ra_lsp_server/src/server_world.rs b/crates/ra_lsp_server/src/server_world.rs
index d5dbf999f..c24ded9f9 100644
--- a/crates/ra_lsp_server/src/server_world.rs
+++ b/crates/ra_lsp_server/src/server_world.rs
@@ -3,7 +3,7 @@ use std::{
3 sync::Arc, 3 sync::Arc,
4}; 4};
5 5
6use languageserver_types::Url; 6use lsp_types::Url;
7use ra_ide_api::{ 7use ra_ide_api::{
8 Analysis, AnalysisChange, AnalysisHost, CrateGraph, FileId, LibraryData, 8 Analysis, AnalysisChange, AnalysisHost, CrateGraph, FileId, LibraryData,
9 SourceRootId 9 SourceRootId
diff --git a/crates/ra_lsp_server/tests/heavy_tests/main.rs b/crates/ra_lsp_server/tests/heavy_tests/main.rs
index 02d62a259..8b5c43a09 100644
--- a/crates/ra_lsp_server/tests/heavy_tests/main.rs
+++ b/crates/ra_lsp_server/tests/heavy_tests/main.rs
@@ -5,7 +5,7 @@ use std::{
5 time::Instant, 5 time::Instant,
6}; 6};
7 7
8use languageserver_types::{ 8use lsp_types::{
9 CodeActionContext, DocumentFormattingParams, FormattingOptions, Position, Range, 9 CodeActionContext, DocumentFormattingParams, FormattingOptions, Position, Range,
10}; 10};
11use ra_lsp_server::req::{ 11use ra_lsp_server::req::{
diff --git a/crates/ra_lsp_server/tests/heavy_tests/support.rs b/crates/ra_lsp_server/tests/heavy_tests/support.rs
index 46107b6b6..57a8b4f4d 100644
--- a/crates/ra_lsp_server/tests/heavy_tests/support.rs
+++ b/crates/ra_lsp_server/tests/heavy_tests/support.rs
@@ -9,7 +9,7 @@ use std::{
9use crossbeam_channel::{after, select, Receiver}; 9use crossbeam_channel::{after, select, Receiver};
10use flexi_logger::Logger; 10use flexi_logger::Logger;
11use gen_lsp_server::{RawMessage, RawNotification, RawRequest}; 11use gen_lsp_server::{RawMessage, RawNotification, RawRequest};
12use languageserver_types::{ 12use lsp_types::{
13 notification::DidOpenTextDocument, 13 notification::DidOpenTextDocument,
14 request::{Request, Shutdown}, 14 request::{Request, Shutdown},
15 DidOpenTextDocumentParams, TextDocumentIdentifier, TextDocumentItem, Url, 15 DidOpenTextDocumentParams, TextDocumentIdentifier, TextDocumentItem, Url,