mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
switch to lsp-types
This commit is contained in:
parent
e465032daf
commit
7e5ab9b78c
13 changed files with 47 additions and 47 deletions
|
@ -1,4 +1,4 @@
|
|||
use languageserver_types::{
|
||||
use lsp_types::{
|
||||
CodeActionProviderCapability, CodeLensOptions, CompletionOptions, DocumentOnTypeFormattingOptions,
|
||||
ExecuteCommandOptions, FoldingRangeProviderCapability, RenameOptions, RenameProviderCapability,
|
||||
ServerCapabilities, SignatureHelpOptions, TextDocumentSyncCapability, TextDocumentSyncKind,
|
||||
|
|
|
@ -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),
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue