Skip to content

Commit

Permalink
Make config/opts params optional and nullable (#57)
Browse files Browse the repository at this point in the history
* Make config params optional

* Make it also nullable
  • Loading branch information
AlexBeauchemin authored Aug 14, 2024
1 parent 5484100 commit 82c37eb
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions lua/tsc/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ if success then
end

--- @class Opts
--- @field auto_open_qflist boolean - (false) When true the quick fix list will automatically open when errors are found
--- @field auto_close_qflist boolean - (false) When true the quick fix list will automatically close when no errors are found
--- @field auto_focus_qflist boolean - (false) When true the quick fix list will automatically focus when errors are found
--- @field auto_start_watch_mode boolean - (false) When true the `tsc` process will be started in watch mode when a typescript buffer is opened
--- @field use_trouble_qflist boolean - (false) When true the quick fix list will be opened in Trouble if it is installed
--- @field use_diagnostics boolean - (false) When true the errors will be set as diagnostics
--- @field run_as_monorepo boolean - (false) When true the `tsc` process will be started mode for each tsconfig in the current working directory
--- @field bin_path string - Path to the tsc binary if it is not in the projects node_modules or globally
--- @field enable_progress_notifications boolean - (true) When false progress notifications will not be shown
--- @field enable_error_notifications boolean - (true) When false error notifications will not be shown
--- @field hide_progress_notifications_from_history boolean - (true) When true progress notifications will be hidden from history
--- @field spinner string[] - ({"", "", "", "", "", "", "", ""}) - The spinner characters to use
--- @field pretty_errors boolean - (true) When true errors will be formatted with `pretty`
--- @field flags { [string]: boolean }
--- @field auto_open_qflist? boolean - (false) When true the quick fix list will automatically open when errors are found
--- @field auto_close_qflist? boolean - (false) When true the quick fix list will automatically close when no errors are found
--- @field auto_focus_qflist? boolean - (false) When true the quick fix list will automatically focus when errors are found
--- @field auto_start_watch_mode? boolean - (false) When true the `tsc` process will be started in watch mode when a typescript buffer is opened
--- @field use_trouble_qflist? boolean - (false) When true the quick fix list will be opened in Trouble if it is installed
--- @field use_diagnostics? boolean - (false) When true the errors will be set as diagnostics
--- @field run_as_monorepo? boolean - (false) When true the `tsc` process will be started mode for each tsconfig in the current working directory
--- @field bin_path? string - Path to the tsc binary if it is not in the projects node_modules or globally
--- @field enable_progress_notifications? boolean - (true) When false progress notifications will not be shown
--- @field enable_error_notifications? boolean - (true) When false error notifications will not be shown
--- @field hide_progress_notifications_from_history? boolean - (true) When true progress notifications will be hidden from history
--- @field spinner? string[] - ({"", "", "", "", "", "", "", ""}) - The spinner characters to use
--- @field pretty_errors? boolean - (true) When true errors will be formatted with `pretty`
--- @field flags? { [string]: boolean }

local DEFAULT_CONFIG = {
auto_open_qflist = true,
Expand Down Expand Up @@ -317,7 +317,7 @@ M.stop = function()
end
end

--- @param opts Opts
--- @param opts Opts | nil
function M.setup(opts)
config = vim.tbl_deep_extend("force", config, DEFAULT_CONFIG, opts or {})

Expand Down

0 comments on commit 82c37eb

Please sign in to comment.