From 945bc95601f190d86655933a9a5350e14dbcb74c Mon Sep 17 00:00:00 2001 From: Andreas Date: Mon, 10 Feb 2025 18:11:26 +0100 Subject: [PATCH 1/2] fix: reimplement section luals.config in doc.json Section luals.config was implemented in #2562, but got lost after a major refactoring in #2821. This commit reimplements it. See discussion #2963. --- changelog.md | 1 + script/cli/doc/export.lua | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/changelog.md b/changelog.md index 454301b2e..7c43c8b9e 100644 --- a/changelog.md +++ b/changelog.md @@ -3,6 +3,7 @@ ## Unreleased * `FIX` incorrect argument skip pattern for `--check_out_path=`, which incorrectly skips the next argument +* `FIX` reimplement section `luals.config` in file doc.json ## 3.13.6 `2025-2-6` diff --git a/script/cli/doc/export.lua b/script/cli/doc/export.lua index 8d9b7d6f6..45c3d3ebd 100644 --- a/script/cli/doc/export.lua +++ b/script/cli/doc/export.lua @@ -8,6 +8,8 @@ local getLabel = require 'core.hover.label' local jsonb = require 'json-beautify' local util = require 'utility' local markdown = require 'provider.markdown' +local fs = require 'bee.filesystem' +local furi = require 'file-uri' ---@alias doctype ---| 'doc.alias' @@ -214,10 +216,6 @@ export.makeDocObject['local'] = function(source, obj, has_seen) obj.name = source[1] end -export.makeDocObject['luals.config'] = function(source, obj, has_seen) - -end - export.makeDocObject['self'] = export.makeDocObject['local'] export.makeDocObject['setfield'] = export.makeDocObject['doc.class'] @@ -284,17 +282,25 @@ end ---@param callback fun(i, max) function export.makeDocs(globals, callback) local docs = {} - for i, global in ipairs(globals) do table.insert(docs, export.documentObject(global)) callback(i, #globals) end - + docs[#docs+1] = export.getLualsConfig() table.sort(docs, export.sortDoc) - return docs end +function export.getLualsConfig() + return { + name = 'LuaLS', + type = 'luals.config', + DOC = fs.absolute(fs.path(DOC)):string(), + defines = {}, + fields = {} + } +end + ---takes the table from `makeDocs`, serializes it, and exports it ---@async ---@param docs table From ed12d72c4d753b0c7b4c6e7741aed200e4933ed8 Mon Sep 17 00:00:00 2001 From: Andreas Matthias Date: Thu, 13 Feb 2025 12:45:31 +0100 Subject: [PATCH 2/2] fix: use fs.canonical() instead of fs.absolute() --- script/cli/doc/export.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/cli/doc/export.lua b/script/cli/doc/export.lua index 45c3d3ebd..31f865326 100644 --- a/script/cli/doc/export.lua +++ b/script/cli/doc/export.lua @@ -295,7 +295,7 @@ function export.getLualsConfig() return { name = 'LuaLS', type = 'luals.config', - DOC = fs.absolute(fs.path(DOC)):string(), + DOC = fs.canonical(fs.path(DOC)):string(), defines = {}, fields = {} }