Skip to content
This repository was archived by the owner on Dec 28, 2024. It is now read-only.

Commit d414688

Browse files
committed
fix some minor lsp warnings
1 parent ef54a20 commit d414688

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2323
### Fixed
2424

2525
- Fixed `package.searchpath` not being used in Lua 5.2+ (instead falling back to our implementation)
26+
- Fixed some minor LSP warnings
2627

2728
## [v0.4.3] - 2022-10-29
2829

luapack.yue

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,22 +87,22 @@ export default_plugins = {n: 0}
8787

8888
fast_push default_plugins,
8989
name: "lua"
90-
searchpath: (packer, name) -> searchpath_compat name, package.path
90+
searchpath: (_, name) -> searchpath_compat name, package.path
9191

9292
if "table" == type yue
9393
fast_push default_plugins,
9494
name: "yuescript"
95-
searchpath: (packer, name) -> searchpath_compat name, package_path_with_different_extension "yue"
96-
loader: (packer, name, filename, content) ->
95+
searchpath: (_, name) -> searchpath_compat name, package_path_with_different_extension "yue"
96+
loader: (_, _, filename, content) ->
9797
return false unless check_file_extension filename, ".yue"
9898
lua = yue.to_lua content, reserve_line_number: false
9999
lua, replace_file_extension filename, ".yue", ".lua"
100100

101101
if "table" == type moon
102102
fast_push default_plugins,
103103
name: "moonscript"
104-
searchpath: (packer, name) -> searchpath_compat name, package_path_with_different_extension "moon"
105-
loader: (packer, name, filename, content) ->
104+
searchpath: (_, name) -> searchpath_compat name, package_path_with_different_extension "moon"
105+
loader: (_, _, filename, content) ->
106106
return false unless check_file_extension filename, ".moon"
107107
lua = moon.to_lua content
108108
lua, replace_file_extension filename, ".moon", ".lua"
@@ -293,9 +293,12 @@ cli = (arguments) ->
293293

294294
if options.standalone
295295
local content
296-
with io.open filename, "r"
297-
content = ::read "*a"
298-
::close!
296+
do
297+
fd = io.open filename, "r"
298+
error "file not found: #{filename}" unless fd?
299+
with fd
300+
content = ::read "*a"
301+
::close!
299302
packer::include name for name in content::gmatch "[^\n]+"
300303
else
301304
packer::pack filename
@@ -304,9 +307,12 @@ cli = (arguments) ->
304307
outfile = options.outfile or filename::gsub "%.(%a+)$", ".packed.lua"
305308
print "Packed into #{outfile}"
306309
break if filename == outfile
307-
with io.open outfile, "w"
308-
::write packed
309-
::close!
310+
do
311+
fd = io.open outfile, "w"
312+
error "could not open file" unless fd?
313+
with fd
314+
::write packed
315+
::close!
310316

311317

312318
check_cli = =>

0 commit comments

Comments
 (0)