summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--meta/template/table.lua1
-rw-r--r--meta/template/utf8.lua3
-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
-rw-r--r--test-beta/diagnostics/init.lua2
-rw-r--r--test-beta/hover/init.lua10
7 files changed, 20 insertions, 21 deletions
diff --git a/meta/template/table.lua b/meta/template/table.lua
index c7621455..1cb2de96 100644
--- a/meta/template/table.lua
+++ b/meta/template/table.lua
@@ -1,6 +1,5 @@
---@meta
----@class table
table = {}
---@param list table
diff --git a/meta/template/utf8.lua b/meta/template/utf8.lua
index 4bcbed59..52bea1cc 100644
--- a/meta/template/utf8.lua
+++ b/meta/template/utf8.lua
@@ -1,6 +1,7 @@
---@meta
---@class utf8
+---@field charpattern string
utf8 = {}
---@param code integer
@@ -8,8 +9,6 @@ utf8 = {}
---@return string
function utf8.char(code, ...) end
-utf8.charpattern = '[\0-\x7F\xC2-\xF4][\x80-\xBF]*'
-
---@param s string
---@param lax boolean?
---@return fun():integer, integer
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] = {
diff --git a/test-beta/diagnostics/init.lua b/test-beta/diagnostics/init.lua
index 8b4ba219..5d29c1e5 100644
--- a/test-beta/diagnostics/init.lua
+++ b/test-beta/diagnostics/init.lua
@@ -466,7 +466,7 @@ f(1, 2, 3)
]]
TEST [[
-<!unpack!>(1)
+unpack(1)
]]
TEST [[
diff --git a/test-beta/hover/init.lua b/test-beta/hover/init.lua
index 664cb0c0..55596074 100644
--- a/test-beta/hover/init.lua
+++ b/test-beta/hover/init.lua
@@ -232,14 +232,14 @@ TEST [[
string.<?sub?>()
]]
[[
-function string.sub(string, i: integer [, j: integer])
+function string.sub(s: string, i: integer, j: integer?)
-> string
]]
TEST[[
('xx'):<?sub?>()
]]
-[[function string:sub(i: integer [, j: integer])
+[[function string:sub(i: integer, j: integer?)
-> string]]
TEST [[
@@ -258,7 +258,7 @@ TEST [[
<?load?>()
]]
[=[
-function load(chunk: string|function [, chunkname: string [, mode: string [, env: table]]])
+function load(chunk: string|function, chunkname: string?, mode: "b"|"t"|"bt"?, env: table?)
-> function
2. error_message: string
]=]
@@ -267,7 +267,7 @@ TEST [[
string.<?lower?>()
]]
[[
-function string.lower(string)
+function string.lower(s: string)
-> string
]]
@@ -512,7 +512,7 @@ TEST [[
print(io.<?stderr?>)
]]
[[
-global io.stderr: FILE* {
+global io.stderr: file {
close: function,
flush: function,
lines: function,