From 8ee748f3d885bcdcbfbd530a570c500adcb04351 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Tue, 17 Nov 2020 10:11:15 +0800 Subject: =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script-beta/core/diagnostics/lowercase-global.lua | 4 ++++ script-beta/core/hover/name.lua | 19 ++++++++----------- script-beta/core/rename.lua | 2 +- 3 files changed, 13 insertions(+), 12 deletions(-) (limited to 'script-beta') diff --git a/script-beta/core/diagnostics/lowercase-global.lua b/script-beta/core/diagnostics/lowercase-global.lua index c7e459cc..d88af685 100644 --- a/script-beta/core/diagnostics/lowercase-global.lua +++ b/script-beta/core/diagnostics/lowercase-global.lua @@ -3,6 +3,7 @@ local guide = require 'parser.guide' local lang = require 'language' local config = require 'config' local library = require 'library' +local vm = require 'vm' local function isDocClass(source) if not source.bindDocs then @@ -47,6 +48,9 @@ return function (uri, callback) if isDocClass(source) then return end + if vm.isGlobalLibraryName(name) then + return + end callback { start = source.start, finish = source.finish, diff --git a/script-beta/core/hover/name.lua b/script-beta/core/hover/name.lua index 9f19d8f3..8394a75b 100644 --- a/script-beta/core/hover/name.lua +++ b/script-beta/core/hover/name.lua @@ -16,18 +16,15 @@ local function asLocal(source) return table.concat(label, ' ') end -local function asMethod(source) +local function asField(source, oop) local class = vm.getClass(source.node, 'deep') local node = class or guide.getName(source.node) or '?' local method = guide.getName(source) - return ('%s:%s'):format(node, method) -end - -local function asField(source) - local class = vm.getClass(source.node, 'deep') - local node = class or guide.getName(source.node) or '?' - local method = guide.getName(source) - return ('%s.%s'):format(node, method) + if oop then + return ('%s:%s'):format(node, method) + else + return ('%s.%s'):format(node, method) + end end local function asTableField(source) @@ -105,11 +102,11 @@ function buildName(source, oop) end if source.type == 'setmethod' or source.type == 'getmethod' then - return asMethod(source) or '' + return asField(source, true) or '' end if source.type == 'setfield' or source.type == 'getfield' then - return asField(source) or '' + return asField(source, oop) or '' end if source.type == 'tablefield' then return asTableField(source) or '' diff --git a/script-beta/core/rename.lua b/script-beta/core/rename.lua index 40104389..89298bdd 100644 --- a/script-beta/core/rename.lua +++ b/script-beta/core/rename.lua @@ -396,7 +396,7 @@ function m.rename(uri, pos, newname) return end mark[uid] = true - if ws.isLibrary(turi) then + if files.isLibrary(turi) then return end results[#results+1] = { -- cgit v1.2.3