mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
Grand refactoring
This commit is contained in:
parent
2007ccfcfe
commit
8abf536343
14 changed files with 591 additions and 484 deletions
|
@ -15,6 +15,7 @@ pub use languageserver_types::{
|
|||
TextEdit,
|
||||
CompletionParams, CompletionResponse,
|
||||
DocumentOnTypeFormattingParams,
|
||||
TextDocumentEdit,
|
||||
};
|
||||
|
||||
|
||||
|
@ -115,14 +116,6 @@ pub struct Decoration {
|
|||
pub tag: &'static str
|
||||
}
|
||||
|
||||
pub enum MoveCursor {}
|
||||
|
||||
impl Request for MoveCursor {
|
||||
type Params = Position;
|
||||
type Result = ();
|
||||
const METHOD: &'static str = "m/moveCursor";
|
||||
}
|
||||
|
||||
pub enum ParentModule {}
|
||||
|
||||
impl Request for ParentModule {
|
||||
|
@ -135,7 +128,7 @@ pub enum JoinLines {}
|
|||
|
||||
impl Request for JoinLines {
|
||||
type Params = JoinLinesParams;
|
||||
type Result = Vec<TextEdit>;
|
||||
type Result = SourceChange;
|
||||
const METHOD: &'static str = "m/joinLines";
|
||||
}
|
||||
|
||||
|
@ -170,3 +163,27 @@ pub struct Runnable {
|
|||
pub args: Vec<String>,
|
||||
pub env: HashMap<String, String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Debug)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct SourceChange {
|
||||
pub label: String,
|
||||
pub source_file_edits: Vec<TextDocumentEdit>,
|
||||
pub file_system_edits: Vec<FileSystemEdit>,
|
||||
pub cursor_position: Option<TextDocumentPositionParams>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Debug)]
|
||||
#[serde(tag = "type", rename_all = "camelCase")]
|
||||
pub enum FileSystemEdit {
|
||||
CreateFile {
|
||||
#[serde(with = "url_serde")]
|
||||
uri: Url
|
||||
},
|
||||
MoveFile {
|
||||
#[serde(with = "url_serde")]
|
||||
src: Url,
|
||||
#[serde(with = "url_serde")]
|
||||
dst: Url,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue