Skip to content

Commit 437bae5

Browse files
committed
fix
1 parent c4044b6 commit 437bae5

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

script/core/completion/completion.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,8 +474,8 @@ local function checkFieldFromFieldToIndex(state, name, src, parent, word, startP
474474
}
475475
end
476476
else
477-
if config.get(state.uri, 'Lua.runtime.version') == 'lua 5.1'
478-
or config.get(state.uri, 'Lua.runtime.version') == 'luaJIT' then
477+
if config.get(state.uri, 'Lua.runtime.version') == 'Lua 5.1'
478+
or config.get(state.uri, 'Lua.runtime.version') == 'LuaJIT' then
479479
textEdit.newText = '_G' .. textEdit.newText
480480
else
481481
textEdit.newText = '_ENV' .. textEdit.newText

test/completion/common.lua

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,7 @@ t['<??>']
10691069
}
10701070

10711071
TEST [[
1072-
_ENV['z.b.c'] = {}
1072+
_G['z.b.c'] = {}
10731073
10741074
z<??>
10751075
]]
@@ -1085,6 +1085,27 @@ z<??>
10851085
},
10861086
}
10871087

1088+
config.set(nil, 'Lua.runtime.version', 'Lua 5.1')
1089+
1090+
TEST [[
1091+
_G['z.b.c'] = {}
1092+
1093+
z<??>
1094+
]]
1095+
{
1096+
{
1097+
label = 'z.b.c',
1098+
kind = define.CompletionItemKind.Field,
1099+
textEdit = {
1100+
start = 20000,
1101+
finish = 20001,
1102+
newText = '_G["z.b.c"]',
1103+
},
1104+
},
1105+
}
1106+
1107+
config.set(nil, 'Lua.runtime.version', 'Lua 5.4')
1108+
10881109
TEST [[
10891110
io.close(1, <??>)
10901111
]]

0 commit comments

Comments
 (0)