summaryrefslogtreecommitdiff
path: root/script-beta
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-11-17 10:11:15 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-11-17 10:11:15 +0800
commit8ee748f3d885bcdcbfbd530a570c500adcb04351 (patch)
treec11ed402033ad6f8e044e4d20d090517836b43e2 /script-beta
parent04e29e9d527beef498ee2ceedfedfa5111862942 (diff)
downloadlua-language-server-8ee748f3d885bcdcbfbd530a570c500adcb04351.zip
更新
Diffstat (limited to 'script-beta')
-rw-r--r--script-beta/core/diagnostics/lowercase-global.lua4
-rw-r--r--script-beta/core/hover/name.lua19
-rw-r--r--script-beta/core/rename.lua2
3 files changed, 13 insertions, 12 deletions
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] = {