Skip to content

Commit c920f96

Browse files
committed
2 parents aa13aba + d57c21e commit c920f96

File tree

10 files changed

+30
-11
lines changed

10 files changed

+30
-11
lines changed

3rd/luamake

Submodule luamake updated 1 file

changelog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# changelog
22

3+
## 2.6.6
4+
`2022-2-21`
5+
* `NEW` formatter preview, use `--preview` to enable this feature, [read more](https://github.com/sumneko/lua-language-server/issues/960)
6+
* `FIX` [#958](https://github.com/sumneko/lua-language-server/issues/958)
7+
* `FIX` runtime errors
8+
39
## 2.6.5
410
`2022-2-17`
511
* `FIX` telemetry is not disabled by default (since 2.6.0)

script/core/noder.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,11 @@ local function getFieldEventName(field)
186186
if not secondTypeUnit or secondTypeUnit.type ~= 'doc.type.function' then
187187
return nil
188188
end
189-
local eventName = firstEnum[1]:match [[^['"](.+)['"]$]]
189+
local enmuStr = firstEnum[1]
190+
if type(enmuStr) ~= 'string' then
191+
return nil
192+
end
193+
local eventName = enmuStr:match [[^['"](.+)['"]$]]
190194
field._eventName = eventName
191195
return eventName
192196
end

script/provider/provider.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,10 +425,11 @@ m.register 'textDocument/documentHighlight' {
425425
capability = {
426426
documentHighlightProvider = true,
427427
},
428-
abortByFileUpdate = true,
428+
---@async
429429
function (params)
430430
local core = require 'core.highlight'
431431
local uri = files.getRealUri(params.textDocument.uri)
432+
workspace.awaitReady(uri)
432433
if not files.exists(uri) then
433434
return nil
434435
end
@@ -927,11 +928,11 @@ m.register 'textDocument/foldingRange' {
927928
capability = {
928929
foldingRangeProvider = true,
929930
},
930-
abortByFileUpdate = true,
931931
---@async
932932
function (params)
933933
local core = require 'core.folding'
934934
local uri = files.getRealUri(params.textDocument.uri)
935+
workspace.awaitReady(uri)
935936
if not files.exists(uri) then
936937
return nil
937938
end

script/service/telemetry.lua

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,17 @@ local function pushVersion(link)
6060
end
6161

6262
local function occlusionPath(str)
63-
return str:gsub('[^"\r\n]+', function (chunk)
63+
return str:gsub('(%s*)([^:"\'\r\n]+)', function (left, chunk)
6464
if not chunk:find '[/\\]' then
6565
return
6666
end
6767
local newStr, count = chunk:gsub('.+([/\\]script[/\\])', '***%1')
6868
if count > 0 then
69-
return newStr
70-
elseif chunk:find '^%u:'
71-
or chunk:sub(1, 1) == '/' then
72-
return '***'
69+
return left .. newStr
70+
elseif chunk:sub(1, 1) == '\\'
71+
or chunk:sub(1, 1) == '/'
72+
or chunk:sub(1, 3) == '...' then
73+
return left .. '***'
7374
end
7475
end)
7576
end

script/vm/getDocs.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ local noder = require 'core.noder'
1111
---@param name? string
1212
---@return parser.guide.object[]
1313
function vm.getDocDefines(uri, name)
14+
if type(name) ~= 'string' then
15+
return {}
16+
end
1417
local cache = vm.getCache 'getDocDefines'
1518
if cache[name] then
1619
return cache[name]

script/workspace/require-path.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,9 @@ end
148148
local function removeVisiblePath(uri)
149149
local path = furi.decode(uri)
150150
path = workspace.normalize(path)
151+
if not path then
152+
return
153+
end
151154
for _, scp in ipairs(workspace.folders) do
152155
scp:get('visiblePath')[path] = nil
153156
---@type collector

script/workspace/workspace.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ end
234234

235235
---@async
236236
function m.awaitLoadFile(uri)
237+
m.awaitReady(uri)
237238
local scp = scope.getScope(uri)
238239
local ld <close> = loading.create(scp)
239240
local native = m.getNativeMatcher(scp)

0 commit comments

Comments
 (0)