diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-11-16 09:56:55 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-11-16 09:56:55 +0800 |
commit | 87085809fa155c87b48d42d9304b75d97dd6c22d (patch) | |
tree | 52723ef429f321211cd05604a1a49c332a3a8627 /script-beta/core | |
parent | ccb4713315893ccb6e98e391ffaa08269258fd20 (diff) | |
download | lua-language-server-87085809fa155c87b48d42d9304b75d97dd6c22d.zip |
rename 不能修改库中的内容
Diffstat (limited to 'script-beta/core')
-rw-r--r-- | script-beta/core/rename.lua | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/script-beta/core/rename.lua b/script-beta/core/rename.lua index 8410c04f..40104389 100644 --- a/script-beta/core/rename.lua +++ b/script-beta/core/rename.lua @@ -5,6 +5,7 @@ local proto = require 'proto' local define = require 'proto.define' local util = require 'utility' local findSource = require 'core.find-source' +local ws = require 'workspace' local Forcing @@ -389,15 +390,20 @@ function m.rename(uri, pos, newname) local mark = {} rename(source, newname, function (target, start, finish, text) - if mark[start] then + local turi = files.getOriginUri(guide.getUri(target)) + local uid = turi .. start + if mark[uid] then + return + end + mark[uid] = true + if ws.isLibrary(turi) then return end - mark[start] = true results[#results+1] = { start = start, finish = finish, text = text, - uri = files.getOriginUri(guide.getUri(target)), + uri = turi, } end) |