aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src/conv.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_lsp_server/src/conv.rs')
-rw-r--r--crates/ra_lsp_server/src/conv.rs30
1 files changed, 15 insertions, 15 deletions
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 };