diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2024-08-19 10:59:22 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2024-08-19 10:59:22 +0800 |
commit | 3a34b724f138ccd545cd9354d5e090d2c76789c2 (patch) | |
tree | 93dbb1f08411a44a30ff6d93d0c5b2fc2af996a1 | |
parent | d702a55715df19a219e963da496e6fb76db0aacd (diff) | |
download | lua-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.md | 1 | ||||
-rw-r--r-- | script/provider/provider.lua | 2 |
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, |