Skip to content

Commit cd54310

Browse files
CopilotCppCXY
andcommitted
Fix version check to use config system in readonly for-loop diagnostic
Co-authored-by: CppCXY <[email protected]>
1 parent aa06ff5 commit cd54310

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

script/core/diagnostics/readonly-for-loop-vars.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ local files = require 'files'
22
local guide = require 'parser.guide'
33
local lang = require 'language'
44
local await = require 'await'
5+
local config = require 'config'
56

67
---@param source parser.object
78
---@return boolean
@@ -41,7 +42,8 @@ return function (uri, callback)
4142
end
4243

4344
-- Only check for Lua 5.5
44-
if state.version ~= 'Lua 5.5' then
45+
local version = config.get(uri, 'Lua.runtime.version')
46+
if version ~= 'Lua 5.5' then
4547
return
4648
end
4749

0 commit comments

Comments
 (0)