diff --git a/sway-lsp/src/capabilities/rename.rs b/sway-lsp/src/capabilities/rename.rs index 0b105e5baaa..611ca44bc2e 100644 --- a/sway-lsp/src/capabilities/rename.rs +++ b/sway-lsp/src/capabilities/rename.rs @@ -4,10 +4,7 @@ use tower_lsp::lsp_types::{ PrepareRenameResponse, RenameParams, TextDocumentPositionParams, TextEdit, WorkspaceEdit, }; -use crate::{ - core::{session::Session, token::Token, token_type::TokenType}, - utils::lsp_helpers::make_range_end_inclusive, -}; +use crate::core::{session::Session, token::Token, token_type::TokenType}; pub fn rename(session: Arc, params: RenameParams) -> Option { let new_name = params.new_name; @@ -62,6 +59,6 @@ pub fn prepare_rename( fn prepare_token_rename(tokens: &[&Token], new_name: String) -> Vec { tokens .iter() - .map(|token| TextEdit::new(make_range_end_inclusive(token.range), new_name.clone())) + .map(|token| TextEdit::new(token.range, new_name.clone())) .collect() } diff --git a/sway-lsp/src/core/token.rs b/sway-lsp/src/core/token.rs index c580ecea91e..c6cb27d2761 100644 --- a/sway-lsp/src/core/token.rs +++ b/sway-lsp/src/core/token.rs @@ -25,7 +25,7 @@ impl Token { name, token_type, line_start: range.start.line, - length: range.end.character - range.start.character + 1, + length: range.end.character - range.start.character, } } diff --git a/sway-lsp/src/utils/lsp_helpers.rs b/sway-lsp/src/utils/lsp_helpers.rs deleted file mode 100644 index 56d92098352..00000000000 --- a/sway-lsp/src/utils/lsp_helpers.rs +++ /dev/null @@ -1,11 +0,0 @@ -use tower_lsp::lsp_types::{Position, Range}; - -pub(crate) fn make_range_end_inclusive(range: Range) -> Range { - Range { - start: range.start, - end: Position { - line: range.end.line, - character: range.end.character + 1, - }, - } -} diff --git a/sway-lsp/src/utils/mod.rs b/sway-lsp/src/utils/mod.rs index 3a822edd076..d07d6ffecff 100644 --- a/sway-lsp/src/utils/mod.rs +++ b/sway-lsp/src/utils/mod.rs @@ -1,3 +1,2 @@ pub(crate) mod common; pub(crate) mod function; -pub(crate) mod lsp_helpers;