Unnamed repository; edit this file 'description' to name the repository.
| -rw-r--r-- | helix-core/src/transaction.rs | 1 | ||||
| -rw-r--r-- | helix-lsp-types/src/semantic_tokens.rs | 8 | ||||
| -rw-r--r-- | helix-lsp/src/client.rs | 1 | ||||
| -rw-r--r-- | helix-lsp/src/lib.rs | 99 |
4 files changed, 105 insertions, 4 deletions
diff --git a/helix-core/src/transaction.rs b/helix-core/src/transaction.rs index 41faf8f7..37be2e2e 100644 --- a/helix-core/src/transaction.rs +++ b/helix-core/src/transaction.rs @@ -361,6 +361,7 @@ impl ChangeSet { pos += s.chars().count(); } } + println!("=>\n{text}"); } true } diff --git a/helix-lsp-types/src/semantic_tokens.rs b/helix-lsp-types/src/semantic_tokens.rs index 842558ba..b4448aa7 100644 --- a/helix-lsp-types/src/semantic_tokens.rs +++ b/helix-lsp-types/src/semantic_tokens.rs @@ -153,7 +153,7 @@ pub struct SemanticToken { } impl SemanticToken { - fn deserialize_tokens<'de, D>(deserializer: D) -> Result<Vec<SemanticToken>, D::Error> + pub fn deserialize_tokens<'de, D>(deserializer: D) -> Result<Vec<SemanticToken>, D::Error> where D: serde::Deserializer<'de>, { @@ -177,7 +177,7 @@ impl SemanticToken { ) } - fn serialize_tokens<S>(tokens: &[SemanticToken], serializer: S) -> Result<S::Ok, S::Error> + pub fn serialize_tokens<S>(tokens: &[SemanticToken], serializer: S) -> Result<S::Ok, S::Error> where S: serde::Serializer, { @@ -192,7 +192,7 @@ impl SemanticToken { seq.end() } - fn deserialize_tokens_opt<'de, D>( + pub fn deserialize_tokens_opt<'de, D>( deserializer: D, ) -> Result<Option<Vec<SemanticToken>>, D::Error> where @@ -208,7 +208,7 @@ impl SemanticToken { Ok(Option::<Wrapper>::deserialize(deserializer)?.map(|wrapper| wrapper.tokens)) } - fn serialize_tokens_opt<S>( + pub fn serialize_tokens_opt<S>( data: &Option<Vec<SemanticToken>>, serializer: S, ) -> Result<S::Ok, S::Error> diff --git a/helix-lsp/src/client.rs b/helix-lsp/src/client.rs index ebc619e2..22a8dd89 100644 --- a/helix-lsp/src/client.rs +++ b/helix-lsp/src/client.rs @@ -1503,6 +1503,7 @@ impl Client { query, work_done_progress_params: lsp::WorkDoneProgressParams::default(), partial_result_params: lsp::PartialResultParams::default(), + ..Default::default() }; Some(self.call::<lsp::request::WorkspaceSymbolRequest>(params)) diff --git a/helix-lsp/src/lib.rs b/helix-lsp/src/lib.rs index d01cd399..259980dd 100644 --- a/helix-lsp/src/lib.rs +++ b/helix-lsp/src/lib.rs @@ -1082,4 +1082,103 @@ mod tests { assert!(transaction.apply(&mut source)); assert_eq!(source, "[\n \"πΊπΈ\",\n \"π\",\n]"); } + #[test] + fn rahh() { + use helix_lsp_types::*; + let th = [ + TextEdit { + range: Range { + start: Position { + line: 1, + character: 0, + }, + end: Position { + line: 1, + character: 4, + }, + }, + new_text: "".into(), + }, + TextEdit { + range: Range { + start: Position { + line: 2, + character: 0, + }, + end: Position { + line: 3, + character: 1, + }, + }, + new_text: "".into(), + }, + TextEdit { + range: Range { + start: Position { + line: 3, + character: 9, + }, + end: Position { + line: 3, + character: 9, + }, + }, + new_text: "let new =\n".into(), + }, + TextEdit { + range: Range { + start: Position { + line: 3, + character: 20, + }, + end: Position { + line: 3, + character: 29, + }, + }, + new_text: "".into(), + }, + TextEdit { + range: Range { + start: Position { + line: 3, + character: 56, + }, + end: Position { + line: 4, + character: 24, + }, + }, + new_text: "".into(), + }, + TextEdit { + range: Range { + start: Position { + line: 6, + character: 1, + }, + end: Position { + line: 6, + character: 1, + }, + }, + new_text: "\n".into(), + }, + ]; + let mut source = Rope::from_str( + "impl Editor { // 0 + pub fn open(f: &Path) { // 1 +// 2 + let new = std::fs::read_to_string(f) // 3 + .map_err(anyhow::Error::from)?; // 4 + } +}", + ); + println!("{}", source); + + let transaction = + generate_transaction_from_edits(&source, th.to_vec(), OffsetEncoding::Utf8); + assert!(transaction.apply(&mut source)); + println!("{}", source); + } } |