summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
m---------3rd/bee.lua0
m---------3rd/lovr-api0
m---------3rd/luamake0
-rw-r--r--changelog.md6
-rw-r--r--script/core/noder.lua6
-rw-r--r--script/provider/provider.lua5
-rw-r--r--script/service/telemetry.lua11
-rw-r--r--script/vm/getDocs.lua3
-rw-r--r--script/workspace/require-path.lua3
-rw-r--r--script/workspace/workspace.lua1
10 files changed, 27 insertions, 8 deletions
diff --git a/3rd/bee.lua b/3rd/bee.lua
-Subproject 226b4f55938dff7e3424437aac77e1b0932d98c
+Subproject 55c9c6bfd6ae4a576cd8777e232d7be48253b94
diff --git a/3rd/lovr-api b/3rd/lovr-api
-Subproject 460b954143b298a580ef3f7bffff2fc621545f3
+Subproject 6f1dab44936aeec43d5288af8fdfbd80ddcecb4
diff --git a/3rd/luamake b/3rd/luamake
-Subproject 843262572a2765ebe187573e32c4f8f22952c2c
+Subproject 909a3bf9770c61efc8a3050402ecbfa4daf24dd
diff --git a/changelog.md b/changelog.md
index 2902d734..9d4162b6 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,11 @@
# changelog
+## 2.6.6
+`2022-2-21`
+* `NEW` formatter preview, use `--preview` to enable this feature, [read more](https://github.com/sumneko/lua-language-server/issues/960)
+* `FIX` [#958](https://github.com/sumneko/lua-language-server/issues/958)
+* `FIX` runtime errors
+
## 2.6.5
`2022-2-17`
* `FIX` telemetry is not disabled by default (since 2.6.0)
diff --git a/script/core/noder.lua b/script/core/noder.lua
index 0a04a744..fcc6b6f4 100644
--- a/script/core/noder.lua
+++ b/script/core/noder.lua
@@ -186,7 +186,11 @@ local function getFieldEventName(field)
if not secondTypeUnit or secondTypeUnit.type ~= 'doc.type.function' then
return nil
end
- local eventName = firstEnum[1]:match [[^['"](.+)['"]$]]
+ local enmuStr = firstEnum[1]
+ if type(enmuStr) ~= 'string' then
+ return nil
+ end
+ local eventName = enmuStr:match [[^['"](.+)['"]$]]
field._eventName = eventName
return eventName
end
diff --git a/script/provider/provider.lua b/script/provider/provider.lua
index f516e1af..3e8fec24 100644
--- a/script/provider/provider.lua
+++ b/script/provider/provider.lua
@@ -425,10 +425,11 @@ m.register 'textDocument/documentHighlight' {
capability = {
documentHighlightProvider = true,
},
- abortByFileUpdate = true,
+ ---@async
function (params)
local core = require 'core.highlight'
local uri = files.getRealUri(params.textDocument.uri)
+ workspace.awaitReady(uri)
if not files.exists(uri) then
return nil
end
@@ -927,11 +928,11 @@ m.register 'textDocument/foldingRange' {
capability = {
foldingRangeProvider = true,
},
- abortByFileUpdate = true,
---@async
function (params)
local core = require 'core.folding'
local uri = files.getRealUri(params.textDocument.uri)
+ workspace.awaitReady(uri)
if not files.exists(uri) then
return nil
end
diff --git a/script/service/telemetry.lua b/script/service/telemetry.lua
index d1bf7680..2d956ed0 100644
--- a/script/service/telemetry.lua
+++ b/script/service/telemetry.lua
@@ -60,16 +60,17 @@ local function pushVersion(link)
end
local function occlusionPath(str)
- return str:gsub('[^"\r\n]+', function (chunk)
+ return str:gsub('(%s*)([^:"\'\r\n]+)', function (left, chunk)
if not chunk:find '[/\\]' then
return
end
local newStr, count = chunk:gsub('.+([/\\]script[/\\])', '***%1')
if count > 0 then
- return newStr
- elseif chunk:find '^%u:'
- or chunk:sub(1, 1) == '/' then
- return '***'
+ return left .. newStr
+ elseif chunk:sub(1, 1) == '\\'
+ or chunk:sub(1, 1) == '/'
+ or chunk:sub(1, 3) == '...' then
+ return left .. '***'
end
end)
end
diff --git a/script/vm/getDocs.lua b/script/vm/getDocs.lua
index 59651ee9..4aeda446 100644
--- a/script/vm/getDocs.lua
+++ b/script/vm/getDocs.lua
@@ -11,6 +11,9 @@ local noder = require 'core.noder'
---@param name? string
---@return parser.guide.object[]
function vm.getDocDefines(uri, name)
+ if type(name) ~= 'string' then
+ return {}
+ end
local cache = vm.getCache 'getDocDefines'
if cache[name] then
return cache[name]
diff --git a/script/workspace/require-path.lua b/script/workspace/require-path.lua
index f0a75eb1..56c94424 100644
--- a/script/workspace/require-path.lua
+++ b/script/workspace/require-path.lua
@@ -148,6 +148,9 @@ end
local function removeVisiblePath(uri)
local path = furi.decode(uri)
path = workspace.normalize(path)
+ if not path then
+ return
+ end
for _, scp in ipairs(workspace.folders) do
scp:get('visiblePath')[path] = nil
---@type collector
diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua
index cb8bd68b..80df7d9c 100644
--- a/script/workspace/workspace.lua
+++ b/script/workspace/workspace.lua
@@ -234,6 +234,7 @@ end
---@async
function m.awaitLoadFile(uri)
+ m.awaitReady(uri)
local scp = scope.getScope(uri)
local ld <close> = loading.create(scp)
local native = m.getNativeMatcher(scp)