aboutsummaryrefslogtreecommitdiff
path: root/lua/cmake/fileapi.lua
diff options
context:
space:
mode:
authorDaniil Rozanov <daniilrozzanov@gmail.com>2024-05-03 01:24:29 +0300
committerDaniil Rozanov <daniilrozzanov@gmail.com>2024-05-03 01:24:29 +0300
commit1caad46f40e1965e4bf0cc68d98f341bc4310d8c (patch)
tree622cab831bb5354cbb7be72ab213617652199818 /lua/cmake/fileapi.lua
parentbbe3a27633002d9eb37c98603e34a00e9ea9d962 (diff)
docs: lua documentation for most used tables and functions
Diffstat (limited to 'lua/cmake/fileapi.lua')
-rw-r--r--lua/cmake/fileapi.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/lua/cmake/fileapi.lua b/lua/cmake/fileapi.lua
index 213fab3..6beffcb 100644
--- a/lua/cmake/fileapi.lua
+++ b/lua/cmake/fileapi.lua
@@ -8,6 +8,16 @@ local reply_dir_suffix = { ".cmake", "api", "v1", "reply" }
local FileApi = {}
+---@class CMakeFileApi
+---@field targets CMakeFileApiTarget[]
+---@field current_executable_target? number Index for current executable target
+---
+---@class CMakeFileApiTarget
+---@field id string Unique tagret id
+---@field name string Target name
+---@field type "EXECUTABLE"|"STATIC_LIBRARY"|"SHARED_LIBRARY"|"MODULE_LIBRARY"|"OBJECT_LIBRARY"|"INTERFACE_LIBRARY"|"UTILITY" Target type
+---@field path string|nil Path to executable associated with target
+
function FileApi.create(path, callback)
local query = vim.fs.joinpath(path, unpack(query_path_suffix))
utils.file_exists(query, function(exists)
@@ -55,10 +65,12 @@ function FileApi.read_reply(path, callback)
Path:new(reply_dir, target.jsonFile):absolute(),
function(target_data)
local target_json = vim.json.decode(target_data)
+ ---@type CMakeTarget
local _target = {
id = target_json.id,
name = target_json.name,
type = target_json.type,
+ path = nil,
}
if target_json.artifacts then
--NOTE: add_library(<name> OBJECT ...) could contain more than ohe object in artifacts