Skip to content

Commit a102b97

Browse files
committed
Mute Overture unused variable warnings
1 parent 17879ee commit a102b97

2 files changed

Lines changed: 38 additions & 1 deletion

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "overture-vscode",
3-
"version": "1.6.0",
3+
"version": "1.6.1",
44
"repository": {
55
"type": "git",
66
"url": "https://github.com/devSparkle/overture-vscode.git"

src/luau-lsp-plugin.luau

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ return {
136136
local Libraries = {}
137137
local Parent = GetParentDirectory(Context.filePath)
138138

139+
local OvertureCalls = 0
140+
local MuteOverture = false
141+
139142
for Index, Library in GetLibraries() do
140143
if string.find(Library, "^@game") then
141144
Libraries[Index] = Library
@@ -150,6 +153,11 @@ return {
150153
LineStart = (Index + 1)
151154
end
152155

156+
if string.find(Source, "^Overture[:.]", Index) then
157+
OvertureCalls += 1
158+
MuteOverture = true
159+
end
160+
153161
local Match = string.match(Source, "^Overture:LoadLibrary%b()", Index)
154162

155163
if Match then
@@ -207,6 +215,35 @@ return {
207215
newText = `require("{Libraries[Library]}")`,
208216
})
209217
end
218+
219+
OvertureCalls -= 1
220+
end
221+
end
222+
223+
lsp.client.sendLogMessage("log", `{OvertureCalls} Overture calls remaining in {Context.filePath}`)
224+
225+
if MuteOverture and OvertureCalls == 0 then
226+
Line, LineStart = 1, 1
227+
228+
for Index = 1, #Source do
229+
if string.sub(Source, Index, Index) == "\n" then
230+
Line += 1
231+
LineStart = (Index + 1)
232+
end
233+
234+
local Column = (Index - LineStart + 1)
235+
236+
if string.find(Source, "^Overture ?=", Index) then
237+
table.insert(Changes, {
238+
startLine = Line,
239+
startColumn = Column,
240+
endLine = Line,
241+
endColumn = Column,
242+
newText = "_",
243+
})
244+
245+
break
246+
end
210247
end
211248
end
212249

0 commit comments

Comments
 (0)