mirror of
https://github.com/SilasMarvin/lsp-ai.git
synced 2024-09-11 04:15:26 +03:00
Patched EOF error when chatting
This commit is contained in:
parent
600fb6f533
commit
b180ab9d58
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -1566,7 +1566,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lsp-ai"
|
||||
version = "0.4.1"
|
||||
version = "0.5.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"assert_cmd",
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "lsp-ai"
|
||||
version = "0.5.0"
|
||||
version = "0.5.1"
|
||||
|
||||
description.workspace = true
|
||||
repository.workspace = true
|
||||
|
@ -421,8 +421,12 @@ async fn do_code_action_resolve(
|
||||
)))?;
|
||||
let file_text = rx.await?;
|
||||
|
||||
let (messages_text, text_edit_line) = if chat.trigger == "" {
|
||||
(file_text.as_str(), file_text.lines().count() + 1)
|
||||
let (messages_text, text_edit_line, text_edit_char) = if chat.trigger == "" {
|
||||
(
|
||||
file_text.as_str(),
|
||||
file_text.lines().count(),
|
||||
file_text.lines().last().unwrap_or("").chars().count(),
|
||||
)
|
||||
} else {
|
||||
let mut split = file_text.split(&chat.trigger);
|
||||
let text_edit_line = split
|
||||
@ -435,7 +439,8 @@ async fn do_code_action_resolve(
|
||||
.context("trigger not found when resolving chat code action")?;
|
||||
(
|
||||
messages_text,
|
||||
text_edit_line + messages_text.lines().count() + 1,
|
||||
text_edit_line + messages_text.lines().count(),
|
||||
messages_text.lines().last().unwrap_or("").chars().count(),
|
||||
)
|
||||
};
|
||||
|
||||
@ -515,8 +520,8 @@ async fn do_code_action_resolve(
|
||||
|
||||
let edit = TextEdit::new(
|
||||
Range::new(
|
||||
Position::new(text_edit_line as u32, 0),
|
||||
Position::new(text_edit_line as u32, 0),
|
||||
Position::new(text_edit_line as u32, text_edit_char as u32),
|
||||
Position::new(text_edit_line as u32, text_edit_char as u32),
|
||||
),
|
||||
response.insert_text.clone(),
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user