diff options
author | Daniil Rozanov <daniilrozzanov@gmail.com> | 2024-05-03 01:24:29 +0300 |
---|---|---|
committer | Daniil Rozanov <daniilrozzanov@gmail.com> | 2024-05-03 01:24:29 +0300 |
commit | 1caad46f40e1965e4bf0cc68d98f341bc4310d8c (patch) | |
tree | 622cab831bb5354cbb7be72ab213617652199818 /lua/cmake/config.lua | |
parent | bbe3a27633002d9eb37c98603e34a00e9ea9d962 (diff) |
docs: lua documentation for most used tables and functions
Diffstat (limited to 'lua/cmake/config.lua')
-rw-r--r-- | lua/cmake/config.lua | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/lua/cmake/config.lua b/lua/cmake/config.lua index 0cc95ca..0392319 100644 --- a/lua/cmake/config.lua +++ b/lua/cmake/config.lua @@ -1,3 +1,52 @@ +---@class CMakeConfig +---@field cmake CMakeConfigCMake Configuration for `cmake` command itself +---@field save_before_build boolean Save all unsaved files before running `cmake` +---@field generate_after_save boolean Generate after saving `CMakeLists.txt` file +---@field cmake_terminal CMakeConfigCMakeTerminal Settings for terminal where cmake will be executed +---@field target_terminal CMakeConfigTargetTerminal Settings for terminal where executable targets will be executed +---@field disabled_commands string[] List of commands that will not be initialized + +---@class CMakeConfigCMake +---@field cmake_path string Path to `cmake` executable +---@field ctest_path string Path to `ctest` executable +---@field cpack_path string Path to `cpack` executable +---@field build_args string[] An array of additional arguments to pass to `cmake --build` +---@field build_tool_args string[] An array of additional arguments to pass to the underlying build tool +---@field generator? string Set to a string to override CMake Tools’ preferred generator logic. If this is set, CMake will unconditionally use it as the -G CMake generator command line argument +---@field parallel_jobs? number By specifying a number, you can define how many jobs are run in parallel during the build +---@field variants {[string]:CMakeVariant} Default variants. Parameters defined in variants have more priority than defined in `cmake = {...}` ones + +---@class CMakeVariant +---@field default string Default choice +---@field description string Description for variant option +---@field choices {[string]:CMakeVariantChoice} Choices for variant option + +---@class CMakeVariantChoice +---@field short string Short description for choice +---@field long? string Short description for choice +---@field buildType? string Value for `CMAKE_BUILD_TYPE` variable. +---@field generator? string Set to a string to override CMake Tools’ preferred generator logic. If this is set, CMake will unconditionally use it as the -G CMake generator command line argument +---@field buildArgs? string[] An array of additional arguments to pass to `cmake --build` +---@field buildToolArgs? string[] An array of additional arguments to pass to the underlying build tool +---@field settings? {[string]:string} Table of parameters which will be passed as `-Dkey=value` to `cmake` command +---@field env? {[string]:string} Table of parameters which will be passed as environment variables to `cmake` +---@field linkage? "static"|"shared" Linkage type + +---@class CMakeConfigCMakeTerminal +---@field split "left"|"right"|"below"|"above" Split direction +---@field size number Terminal's size in lines +---@field close_on_exit "success"|"failure"|boolean When to close termilal. `"success"` - after success, `"failure"` - after failure, `true` - always, `false` - never +---@field open_on_start boolean Open terminal when `cmake` starts +---@field clear_env boolean Do not pass shell environment to cmake process +---@field enter boolean Focus on opened terminal window + +---@class CMakeConfigTargetTerminal +---@field split "left"|"right"|"below"|"above" Split direction +---@field size number Terminal's size in lines +---@field enter boolean Focus on opened terminal window +---@field immediately boolean Run command immediately. If false, command will just be pasted to terminal so you can modify it + +---@type CMakeConfig local default_config = { cmake = { cmake_path = "cmake", @@ -37,8 +86,8 @@ local default_config = { target_terminal = { split = "below", size = 15, - clear_env = false, enter = true, + immediately = true, }, notification = { after = "success", @@ -48,10 +97,13 @@ local default_config = { long = { sep = " ❄ ", show = false }, }, keybinds = {}, + disable_commands = {}, } local M = vim.deepcopy(default_config) +---Setup configs +---@param opts CMakeConfig M.setup = function(opts) local newconf = vim.tbl_deep_extend("force", default_config, opts or {}) |