switch to lsp-types

This commit is contained in:
Aleksey Kladov 2019-01-14 13:55:56 +03:00
parent e465032daf
commit 7e5ab9b78c
13 changed files with 47 additions and 47 deletions

36
Cargo.lock generated
View file

@ -337,8 +337,8 @@ version = "0.1.0"
dependencies = [
"crossbeam-channel 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"languageserver-types 0.53.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"lsp-types 0.54.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -411,21 +411,6 @@ name = "join_to_string"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "languageserver-types"
version = "0.53.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"num-derive 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
"url_serde 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "lazy_static"
version = "1.2.0"
@ -453,6 +438,21 @@ dependencies = [
"cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "lsp-types"
version = "0.54.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"num-derive 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
"url_serde 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "maplit"
version = "1.0.1"
@ -730,8 +730,8 @@ dependencies = [
"flexi_logger 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)",
"gen_lsp_server 0.1.0",
"im 12.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"languageserver-types 0.53.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"lsp-types 0.54.0 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"ra_arena 0.1.0",
"ra_ide_api 0.1.0",
@ -1526,11 +1526,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5b8467d9c1cebe26feb08c640139247fac215782d35371ade9a2136ed6085358"
"checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b"
"checksum join_to_string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4dc7a5290e8c2606ce2be49f456d50f69173cb96d1541e4f66e34ac8b331a98f"
"checksum languageserver-types 0.53.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7c01845f71b8b3b3557a8179af4434a4b2570829da12371f05272d28183a06ce"
"checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1"
"checksum libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)" = "023a4cd09b2ff695f9734c1934145a315594b7986398496841c7031a5a1bbdbd"
"checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c"
"checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6"
"checksum lsp-types 0.54.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a252cc2be87d9329dd91c505a951996b3263582ba304870960faaae77b642183"
"checksum maplit 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "08cbb6b4fef96b6d77bfc40ec491b1690c779e77b05cd9f07f787ed376fd4c43"
"checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
"checksum memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "db4c41318937f6e76648f42826b1d9ade5c09cafb5aef7e351240a70f39206e9"

View file

@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
description = "Generic LSP server scaffold."
[dependencies]
languageserver-types = "0.53.1"
lsp-types = "0.54.0"
log = "0.4.3"
failure = "0.1.4"
serde_json = "1.0.34"

View file

@ -6,12 +6,12 @@
//!
//! ```no_run
//! extern crate gen_lsp_server;
//! extern crate languageserver_types;
//! extern crate lsp_types;
//! extern crate failure;
//! extern crate crossbeam_channel;
//!
//! use crossbeam_channel::{Sender, Receiver};
//! use languageserver_types::{ServerCapabilities, InitializeParams, request::{GotoDefinition, GotoDefinitionResponse}};
//! use lsp_types::{ServerCapabilities, InitializeParams, request::{GotoDefinition, GotoDefinitionResponse}};
//! use gen_lsp_server::{run_server, stdio_transport, handle_shutdown, RawMessage, RawResponse};
//!
//! fn main() -> Result<(), failure::Error> {
@ -65,7 +65,7 @@ mod msg;
mod stdio;
use crossbeam_channel::{Receiver, Sender};
use languageserver_types::{
use lsp_types::{
notification::{Exit, Initialized},
request::{Initialize, Shutdown},
InitializeParams, InitializeResult, ServerCapabilities,

View file

@ -1,6 +1,6 @@
use std::io::{BufRead, Write};
use languageserver_types::{notification::Notification, request::Request};
use lsp_types::{notification::Notification, request::Request};
use serde::{Deserialize, Serialize};
use serde_json::{from_str, from_value, to_string, to_value, Value};
use failure::{bail, format_err};

View file

@ -17,7 +17,7 @@ crossbeam-channel = "0.3.5"
flexi_logger = "0.10.0"
log = "0.4.3"
url_serde = "0.2.0"
languageserver-types = "0.53.1"
lsp-types = "0.54.0"
walkdir = "2.2.7"
im = "12.0.0"
cargo_metadata = "0.6.0"

View file

@ -1,4 +1,4 @@
use languageserver_types::{
use lsp_types::{
CodeActionProviderCapability, CodeLensOptions, CompletionOptions, DocumentOnTypeFormattingOptions,
ExecuteCommandOptions, FoldingRangeProviderCapability, RenameOptions, RenameProviderCapability,
ServerCapabilities, SignatureHelpOptions, TextDocumentSyncCapability, TextDocumentSyncKind,

View file

@ -1,4 +1,4 @@
use languageserver_types::{
use lsp_types::{
self, CreateFile, DocumentChangeOperation, DocumentChanges, InsertTextFormat, Location, LocationLink,
Position, Range, RenameFile, ResourceOp, SymbolKind, TextDocumentEdit, TextDocumentIdentifier,
TextDocumentItem, TextDocumentPositionParams, Url, VersionedTextDocumentIdentifier,
@ -51,10 +51,10 @@ impl Conv for SyntaxKind {
}
impl Conv for CompletionItemKind {
type Output = ::languageserver_types::CompletionItemKind;
type Output = ::lsp_types::CompletionItemKind;
fn conv(self) -> <Self as Conv>::Output {
use languageserver_types::CompletionItemKind::*;
use lsp_types::CompletionItemKind::*;
match self {
CompletionItemKind::Keyword => Keyword,
CompletionItemKind::Snippet => Snippet,
@ -75,10 +75,10 @@ impl Conv for CompletionItemKind {
}
impl Conv for CompletionItem {
type Output = ::languageserver_types::CompletionItem;
type Output = ::lsp_types::CompletionItem;
fn conv(self) -> <Self as Conv>::Output {
let mut res = ::languageserver_types::CompletionItem {
let mut res = ::lsp_types::CompletionItem {
label: self.label().to_string(),
detail: self.detail().map(|it| it.to_string()),
filter_text: Some(self.lookup().to_string()),
@ -148,9 +148,9 @@ impl ConvWith for Range {
impl ConvWith for TextEdit {
type Ctx = LineIndex;
type Output = Vec<languageserver_types::TextEdit>;
type Output = Vec<lsp_types::TextEdit>;
fn conv_with(self, line_index: &LineIndex) -> Vec<languageserver_types::TextEdit> {
fn conv_with(self, line_index: &LineIndex) -> Vec<lsp_types::TextEdit> {
self.as_atoms()
.into_iter()
.map_conv_with(line_index)
@ -160,10 +160,10 @@ impl ConvWith for TextEdit {
impl<'a> ConvWith for &'a AtomTextEdit {
type Ctx = LineIndex;
type Output = languageserver_types::TextEdit;
type Output = lsp_types::TextEdit;
fn conv_with(self, line_index: &LineIndex) -> languageserver_types::TextEdit {
languageserver_types::TextEdit {
fn conv_with(self, line_index: &LineIndex) -> lsp_types::TextEdit {
lsp_types::TextEdit {
range: self.delete.conv_with(line_index),
new_text: self.insert.clone(),
}
@ -324,7 +324,7 @@ impl TryConvWith for FileSystemEdit {
fn try_conv_with(self, world: &ServerWorld) -> Result<ResourceOp> {
let res = match self {
FileSystemEdit::CreateFile { source_root, path } => {
let uri = world.path_to_uri(source_root, &path)?.to_string();
let uri = world.path_to_uri(source_root, &path)?;
ResourceOp::Create(CreateFile { uri, options: None })
}
FileSystemEdit::MoveFile {
@ -332,8 +332,8 @@ impl TryConvWith for FileSystemEdit {
dst_source_root,
dst_path,
} => {
let old_uri = world.file_id_to_uri(src)?.to_string();
let new_uri = world.path_to_uri(dst_source_root, &dst_path)?.to_string();
let old_uri = world.file_id_to_uri(src)?;
let new_uri = world.path_to_uri(dst_source_root, &dst_path)?;
ResourceOp::Rename(RenameFile {
old_uri,
new_uri,
@ -361,7 +361,7 @@ pub fn to_location_link(
// line index for original range file
line_index: &LineIndex,
) -> Result<LocationLink> {
let url = target.info.file_id().try_conv_with(world)?;
let target_uri = target.info.file_id().try_conv_with(world)?;
let tgt_line_index = world.analysis().file_line_index(target.info.file_id());
let target_range = target.info.full_range().conv_with(&tgt_line_index);
@ -374,7 +374,7 @@ pub fn to_location_link(
let res = LocationLink {
origin_selection_range: Some(target.range.conv_with(line_index)),
target_uri: url.to_string(),
target_uri,
target_range,
target_selection_range: Some(target_selection_range),
};

View file

@ -9,7 +9,7 @@ use failure_derive::Fail;
use gen_lsp_server::{
handle_shutdown, ErrorCode, RawMessage, RawNotification, RawRequest, RawResponse,
};
use languageserver_types::NumberOrString;
use lsp_types::NumberOrString;
use ra_ide_api::{Canceled, FileId, LibraryData};
use ra_vfs::VfsTask;
use rayon;

View file

@ -1,7 +1,7 @@
use std::collections::HashMap;
use gen_lsp_server::ErrorCode;
use languageserver_types::{
use lsp_types::{
CodeActionResponse, CodeLens, Command, Diagnostic, DiagnosticSeverity,
DocumentFormattingParams, DocumentHighlight, DocumentSymbol, Documentation, FoldingRange,
FoldingRangeKind, FoldingRangeParams, Hover, HoverContents, Location, MarkupContent,

View file

@ -1,9 +1,9 @@
use languageserver_types::{Location, Position, Range, TextDocumentIdentifier, Url};
use lsp_types::{Location, Position, Range, TextDocumentIdentifier, Url};
use rustc_hash::FxHashMap;
use serde::{Deserialize, Serialize};
use url_serde;
pub use languageserver_types::{
pub use lsp_types::{
notification::*, request::*, ApplyWorkspaceEditParams, CodeActionParams, CodeLens, CodeLensParams,
CompletionParams, CompletionResponse, DocumentOnTypeFormattingParams, DocumentSymbolParams,
DocumentSymbolResponse, ExecuteCommandParams, Hover, InitializeResult,

View file

@ -3,7 +3,7 @@ use std::{
sync::Arc,
};
use languageserver_types::Url;
use lsp_types::Url;
use ra_ide_api::{
Analysis, AnalysisChange, AnalysisHost, CrateGraph, FileId, LibraryData,
SourceRootId

View file

@ -5,7 +5,7 @@ use std::{
time::Instant,
};
use languageserver_types::{
use lsp_types::{
CodeActionContext, DocumentFormattingParams, FormattingOptions, Position, Range,
};
use ra_lsp_server::req::{

View file

@ -9,7 +9,7 @@ use std::{
use crossbeam_channel::{after, select, Receiver};
use flexi_logger::Logger;
use gen_lsp_server::{RawMessage, RawNotification, RawRequest};
use languageserver_types::{
use lsp_types::{
notification::DidOpenTextDocument,
request::{Request, Shutdown},
DidOpenTextDocumentParams, TextDocumentIdentifier, TextDocumentItem, Url,