diff --git a/lua/luau-lsp/init.lua b/lua/luau-lsp/init.lua index 521d7ab..edd3fc4 100644 --- a/lua/luau-lsp/init.lua +++ b/lua/luau-lsp/init.lua @@ -27,14 +27,14 @@ function M.aliases(paths) return end - local ok, contents = pcall(json.decode, luaurc:read "a") + local ok, content = pcall(json.decode, luaurc:read "a") if not ok then - log.error("Failed to read '.luaurc': %s", contents) + log.error("Failed to read '.luaurc': %s", content) return end local aliases = vim.empty_dict() - for alias, value in pairs(contents.aliases or {}) do + for alias, value in pairs(content.aliases or {}) do aliases["@" .. alias] = value end return aliases diff --git a/lua/luau-lsp/roblox/init.lua b/lua/luau-lsp/roblox/init.lua index 7f28a18..71f737b 100644 --- a/lua/luau-lsp/roblox/init.lua +++ b/lua/luau-lsp/roblox/init.lua @@ -37,14 +37,12 @@ local download_api = async.wrap(function(callback) output = global_types_file(), callback = on_success, on_error = on_error, - compressed = false, }) curl.get(API_DOCS_URL, { output = api_docs_file(), callback = on_success, on_error = on_error, - compressed = false, }) end, 1) diff --git a/lua/luau-lsp/server.lua b/lua/luau-lsp/server.lua index 6b9d9d1..9f665b1 100644 --- a/lua/luau-lsp/server.lua +++ b/lua/luau-lsp/server.lua @@ -16,9 +16,7 @@ local fetch_fflags = async.wrap(function(callback) callback {} end - curl.get { - url = CURRENT_FFLAGS_URL, - accept = "application/json", + curl.get(CURRENT_FFLAGS_URL, { callback = function(result) local ok, content = pcall(vim.json.decode, result.body) if ok then @@ -28,10 +26,9 @@ local fetch_fflags = async.wrap(function(callback) end end, on_error = function(result) - on_error(result.stderr) + on_error(table.concat(result.stderr, "\n")) end, - compressed = false, - } + }) end, 1) ---@async diff --git a/spec/json_spec.lua b/spec/json_spec.lua index 168167e..bb28bf7 100644 --- a/spec/json_spec.lua +++ b/spec/json_spec.lua @@ -2,7 +2,7 @@ local json = require "luau-lsp.json" describe("json5 decoder", function() it("should decode with comments", function() - local ok, contents = pcall( + local ok, content = pcall( json.decode, [[ // .luaurc @@ -18,11 +18,11 @@ describe("json5 decoder", function() assert.same({ foo = "foo", bar = "bar", - }, contents) + }, content) end) it("should decode with trailing commas", function() - local ok, contents = pcall( + local ok, content = pcall( json.decode, [[ { @@ -36,11 +36,11 @@ describe("json5 decoder", function() assert.same({ foo = "foo", bar = "bar", - }, contents) + }, content) end) it("should decode nesting fields", function() - local ok, contents = pcall( + local ok, content = pcall( json.decode, [[ { @@ -57,6 +57,6 @@ describe("json5 decoder", function() foo = { bar = "baz", }, - }, contents) + }, content) end) end)