summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2024-08-19 10:59:22 +0800
committer最萌小汐 <sumneko@hotmail.com>2024-08-19 10:59:22 +0800
commit3a34b724f138ccd545cd9354d5e090d2c76789c2 (patch)
tree93dbb1f08411a44a30ff6d93d0c5b2fc2af996a1
parentd702a55715df19a219e963da496e6fb76db0aacd (diff)
downloadlua-language-server-3a34b724f138ccd545cd9354d5e090d2c76789c2.zip
fix renaming files in the directory leads to the auto-correction in "require" adding extra characters
fix #2810
-rw-r--r--changelog.md1
-rw-r--r--script/provider/provider.lua2
2 files changed, 2 insertions, 1 deletions
diff --git a/changelog.md b/changelog.md
index 65624ff8..fcc471ce 100644
--- a/changelog.md
+++ b/changelog.md
@@ -2,6 +2,7 @@
## Unreleased
<!-- Add all new changes here. They will be moved under a version at release -->
+* `FIX` Renaming files in the directory leads to the auto-correction in "require" adding extra characters.
## 3.10.4
`2024-8-16`
diff --git a/script/provider/provider.lua b/script/provider/provider.lua
index 6a4b2406..3d1c5d52 100644
--- a/script/provider/provider.lua
+++ b/script/provider/provider.lua
@@ -222,7 +222,7 @@ m.register 'workspace/didRenameFiles' {
for _, uri in ipairs(childs) do
if files.exists(uri) then
local ouri = uri
- local tail = ouri:sub(#oldUri)
+ local tail = ouri:sub(#oldUri + 1)
local nuri = file.newUri .. tail
renames[#renames+1] = {
oldUri = ouri,