Skip to content

Commit 1691296

Browse files
authored
[REFACTOR] Moved files, removed a lot of useless types (#33)
* fix: Moved `wezterm.` submodules out of their directories. Signed-off-by: Guennadi Maximov C <g.maxc.fox@protonmail.com> * refactor!: Dropped some aliases that were useless. Signed-off-by: Guennadi Maximov C <g.maxc.fox@protonmail.com> * fix(config): Moved `types/config/init.lua` to `types/config.lua`. Signed-off-by: Guennadi Maximov C <g.maxc.fox@protonmail.com> * chore: Fixed and updated CODEOWNERS lines. Signed-off-by: Guennadi Maximov C <g.maxc.fox@protonmail.com> --------- Signed-off-by: Guennadi Maximov C <g.maxc.fox@protonmail.com>
1 parent 0eb6802 commit 1691296

25 files changed

Lines changed: 192 additions & 266 deletions

.github/CODEOWNERS

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
* @justinsgithub
2-
/lua/types/serde/init.lua @DrKJeff16
3-
/lua/types/plugin/init.lua @DrKJeff16
4-
/lua/types/url/init.lua @DrKJeff16
2+
/lua/types/wezterm/serde.lua @DrKJeff16
3+
/lua/types/wezterm/plugin.lua @DrKJeff16
4+
/lua/types/wezterm/url.lua @DrKJeff16
55
/.github/CODEOWNERS @DrKJeff16
66
/.github/workflows/stylua.yml @DrKJeff16
Lines changed: 111 additions & 112 deletions
Large diffs are not rendered by default.

lua/types/init.lua

Lines changed: 43 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
---@module "types.objects"
77
---@module "types.wezterm"
88

9-
-- Alias to help identify types that should actually be any
10-
---@alias ANY any
11-
129
---@alias FormatItem.UnderlineStyle
1310
---|"None"
1411
---|"Single"
@@ -25,13 +22,10 @@
2522
---@alias FormatItemAttribute
2623
---|{ Underline: FormatItem.UnderlineStyle }
2724
---|{ Intensity: FormatItem.Intensity }
28-
---|{ Italic: bool }
29-
30-
-- Reset all attributes to default
31-
---@alias FormatItemReset "ResetAttributes"
25+
---|{ Italic: boolean }
3226

3327
---@alias FormatItem
34-
---|FormatItemReset
28+
---|"ResetAttributes"
3529
---|{ Attribute: FormatItemAttribute }
3630
---|{ Foreground: ColorSpec }
3731
---|{ Background: ColorSpec }
@@ -66,9 +60,6 @@
6660
---|"LowPower"
6761
---|"HighPerformance"
6862

69-
-- Only Option
70-
---@alias FontRasterizerSelection "FreeType"
71-
7263
---@alias FontShaperSelection
7364
---|"Allsorts" very preliminary support
7465
---|"Harfbuzz" default
@@ -95,47 +86,16 @@
9586
---|"Full"
9687
---|"Unknown"
9788

98-
-- 32-bit floating point number
99-
---@alias f32 number
100-
-- 64-bit floating point number
101-
---@alias f64 number
102-
103-
-- 8-bit unsigned integer
104-
---@alias u8 integer
105-
-- 16-bit unsigned integer
106-
---@alias u16 integer
107-
-- 32-bit unsigned integer
108-
---@alias u32 integer
109-
-- 64-bit unsigned integer
110-
---@alias u64 integer
111-
112-
-- 64-bit signed integer
113-
---@alias i64 integer
114-
115-
---@alias Duration u64
116-
117-
---@alias usize number
118-
119-
---@alias Regex string
120-
121-
---@alias RgbColor string
122-
--
123-
---@alias RgbaColor string
124-
125-
---@alias bool boolean
126-
12789
---@alias BoldBrightening
12890
---|"No"
12991
---|"BrightAndBold"
13092
---|"BrightOnly"
13193

132-
-- TODO: describe
13394
---@alias ExitBehavior
13495
---|"Close"
13596
---|"CloseOnCleanExit"
13697
---|"Hold"
13798

138-
-- TODO: describe
13999
---@alias ExitBehaviorMessaging
140100
---|"Verbose"
141101
---|"Brief"
@@ -205,31 +165,6 @@
205165
---|string
206166
-- Add other valid combinations if needed
207167

208-
-- A value expressed in points, where 72 points == 1 inch
209-
---@alias Points string
210-
211-
-- A value expressed in raw pixels
212-
---@alias Pixels string|number
213-
214-
-- A value expressed in terms of a fraction of the maximum
215-
-- value in the same direction.
216-
-- For example, left padding of 10% depends on
217-
-- the pixel width of that element.
218-
-- The value is 1.0 == 100%.
219-
-- It is possible to express e.g. 2.0 for 200%
220-
---@alias Percent string
221-
222-
-- A value expressed in terms of a fraction of the cell
223-
-- size computed from the configured font size.
224-
-- 1.0 == the cell size
225-
---@alias Cells string
226-
227-
---@alias Dimension
228-
---|Points
229-
---|Pixels
230-
---|Percent
231-
---|Cells
232-
233168
---@alias TabBarIntensity
234169
---|"Normal"
235170
---|"Half"
@@ -296,12 +231,12 @@
296231
-- Specify whether you want the text to be italic for this tab.
297232
--
298233
-- The default is `false`
299-
---@field italic? bool
234+
---@field italic? boolean
300235
-- Specify whether you want the text to be rendered with strikethrough (true)
301236
-- or not for this tab.
302237
--
303238
-- The default is `false`
304-
---@field strikethrough? bool
239+
---@field strikethrough? boolean
305240

306241
---@class TabBarColors
307242
-- The text color to use when the attributes are reset to default
@@ -327,11 +262,7 @@
327262
-- moves over the new tab button
328263
---@field new_tab_hover TabBarColor
329264

330-
---@alias AC "AnsiColor"
331-
332-
---@alias CO "Color"
333-
334-
---@alias ColorSpec table<AC, AnsiColor>|table<CO, string>
265+
---@alias ColorSpec table<"AnsiColor", AnsiColor>|table<"Color", string>
335266

336267
---@class Palette
337268
-- The text color to use when the attributes are reset to default
@@ -529,8 +460,8 @@
529460
---@field stretch? FontStretch
530461
-- Whether the font should be an italic variant
531462
---@field style? FontStyle
532-
---@field is_fallback? bool
533-
---@field is_synthetic? bool
463+
---@field is_fallback? boolean
464+
---@field is_synthetic? boolean
534465
---@field scale? number
535466

536467
-- `FontAttributes`-like class but with font family specified
@@ -544,30 +475,30 @@
544475
-- you can combine the flags like `"NO_HINTING|MONOCHROME"`
545476
-- **(you probably wouldn't want to do this)**
546477
---@field freetype_load_flags? FreeTypeLoadFlags
547-
---@field assume_emoji_presentation? bool
478+
---@field assume_emoji_presentation? boolean
548479

549480
---@class Fonts
550481
---@field fonts FontAttributes[]
551482

552483
---@class WindowFrameConfig
553-
---@field inactive_titlebar_bg? RgbColor
554-
---@field active_titlebar_bg? RgbColor
555-
---@field inactive_titlebar_fg? RgbColor
556-
---@field active_titlebar_fg? RgbColor
557-
---@field inactive_titlebar_border_bottom? RgbColor
558-
---@field active_titlebar_border_bottom? RgbColor
559-
---@field button_fg? RgbColor
560-
---@field button_bg? RgbColor
561-
---@field button_hover_fg? RgbColor
562-
---@field button_hover_bg? RgbColor
563-
---@field border_left_width? Dimension
564-
---@field border_right_width? Dimension
565-
---@field border_top_height? Dimension
566-
---@field border_bottom_height? Dimension
567-
---@field border_left_color? RgbaColor
568-
---@field border_right_color? RgbaColor
569-
---@field border_top_color? RgbaColor
570-
---@field border_bottom_color? RgbaColor
484+
---@field inactive_titlebar_bg? string
485+
---@field active_titlebar_bg? string
486+
---@field inactive_titlebar_fg? string
487+
---@field active_titlebar_fg? string
488+
---@field inactive_titlebar_border_bottom? string
489+
---@field active_titlebar_border_bottom? string
490+
---@field button_fg? string
491+
---@field button_bg? string
492+
---@field button_hover_fg? string
493+
---@field button_hover_bg? string
494+
---@field border_left_width? string|number
495+
---@field border_right_width? string|number
496+
---@field border_top_height? string|number
497+
---@field border_bottom_height? string|number
498+
---@field border_left_color? string
499+
---@field border_right_color? string
500+
---@field border_top_color? string
501+
---@field border_bottom_color? string
571502

572503
---@class TabBarStyle
573504
---@field new_tab? string
@@ -580,9 +511,9 @@
580511
---@field window_close_hover? string
581512

582513
---@class HyperlinkRule
583-
---@field regex? Regex
514+
---@field regex? string
584515
---@field format? string
585-
---@field highlight? usize
516+
---@field highlight? number
586517

587518
---@class SerialDomain
588519
-- The name of this specific domain.
@@ -597,29 +528,29 @@
597528
-- Set the baud rate.
598529
--
599530
-- The default is `9600` baud
600-
---@field baud usize|9600
531+
---@field baud number|9600
601532

602533
---@class GpuInfo
603534
---@field name string
604535
---@field device_type string
605536
---@field backend string
606537
---@field driver string
607538
---@field driver_info string
608-
---@field vendor u32
609-
---@field device u32
539+
---@field vendor integer
540+
---@field device integer
610541

611542
---@class UnixDomain
612543
-- The name of this specific domain.
613544
-- Must be unique amongst all types of domain in the configuration file
614545
---@field name string
615546
-- The path to the socket.
616547
-- If unspecified, a resonable default value will be computed
617-
---@field socket_path PathBuf
548+
---@field socket_path string
618549
-- If `true`, connect to this domain automatically at startup
619-
---@field connect_automatically bool
550+
---@field connect_automatically boolean
620551
-- If `true`, do not attempt to start this server if we try and fail to
621552
-- connect to it.
622-
---@field no_serve_automatically bool
553+
---@field no_serve_automatically boolean
623554
-- If we decide that we need to start the server, the command to run
624555
-- to set that up.
625556
--
@@ -644,20 +575,20 @@
644575
-- This is not recommended on a multi-user system,
645576
-- but is useful, for example, when running the server inside a WSL container
646577
-- but with the socket on the host NTFS volume
647-
---@field skip_permissions_check bool
648-
---@field read_timeout Duration
578+
---@field skip_permissions_check boolean
579+
---@field read_timeout integer
649580
-- Don"t use `default_local_echo_threshold_ms()` here to disable
650581
-- the predictive echo for UNIX domains by default
651-
---@field write_timeout Duration
582+
---@field write_timeout integer
652583
-- Show time since last response when waiting for a response.
653584
--
654585
-- Recommended to look at this:
655586
-- `https://wezfurlong.org/wezterm/config/lua/pane/get_metadata.html#since_last_response_ms`
656-
---@field local_echo_threshold_ms u64
657-
---@field overlay_lag_indicator bool
587+
---@field local_echo_threshold_ms integer
588+
---@field overlay_lag_indicator boolean
658589

659590
---@class LeaderKey: KeyNoAction
660-
---@field timeout_milliseconds? u64
591+
---@field timeout_milliseconds? integer
661592

662593
---@class HyperLinkRule
663594
-- The regular expression to match
@@ -761,7 +692,7 @@
761692
-- Only the first `"format-tab-title"` event will be executed;
762693
-- it doesn't make sense to define multiple instances of the event
763694
-- with `multiple wezterm.on("format-tab-title", ...)` calls
764-
---@alias Event.FormatTabTitle fun(event: FormatTabTitle, callback: fun(tab: MuxTab, tabs: MuxTab[], panes: Pane[], config: Config, hover: bool, max_width: number): string|FormatItem)
695+
---@alias Event.FormatTabTitle fun(event: FormatTabTitle, callback: fun(tab: MuxTab, tabs: MuxTab[], panes: Pane[], config: Config, hover: boolean, max_width: number): string|FormatItem)
765696

766697
-- The parameters to the event are:
767698
--
@@ -1094,8 +1025,8 @@
10941025
---@class MouseBindingBase
10951026
---@field event MouseEvent
10961027
---@field action Action
1097-
---@field mouse_reporting? bool
1098-
---@field alt_screen? bool|"Any"
1028+
---@field mouse_reporting? boolean
1029+
---@field alt_screen? boolean|"Any"
10991030

11001031
---@class MouseBinding: MouseBindingBase
11011032
---@field mods string

lua/types/objects/color.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
---@field square fun(self: Color): a: Color, b: Color, c: Color
7777
-- Returns a tuple of the internal `SRGBA` colors expressed
7878
-- as unsigned 8-bit integers in the range `0-255`
79-
---@field srgb_u8 fun(self: Color): r: u8, g: u8, b: u8, alpha: u8
79+
---@field srgb_u8 fun(self: Color): r: integer, g: integer, b: integer, alpha: integer
8080
-- Returns the other two colors that form a triad.
8181
-- The other colors are at +/- 120 degrees in the `HSL` color wheel
8282
---@field triad fun(self: Color): a: Color, b: Color

lua/types/objects/local-process-info.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@
1717
-- Represents a process running on the local machine
1818
---@class LocalProcessInfo
1919
-- The process identifier (`PID`)
20-
---@field pid u32
20+
---@field pid integer
2121
-- The parent process identifier
22-
---@field ppid u32
22+
---@field ppid integer
2323
-- A short name for the process.
2424
--
2525
-- Due to platform limitations, this may be inaccurate and/or truncated;
2626
-- you should look at the `executable` or `argv` fields instead of this one
2727
---@field name string
2828
-- the full path to the executable image for the process (may be empty)
29-
---@field executable PathBuf|""
29+
---@field executable string|""
3030
-- A table holding the argument array for the process
3131
---@field argv string[]|table
3232
-- The current working directory for the process (may be empty)
@@ -49,4 +49,4 @@
4949
---@field status LocalProcessStatus
5050
-- A table keyed by child process id and whose values are themselves
5151
-- `LocalProcessInfo` objects that describe the child processes
52-
---@field children table<u32, LocalProcessInfo>
52+
---@field children table<integer, LocalProcessInfo>

lua/types/objects/mux-tab.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
-- - Setting the zoom state to `false` un-zooms the pane if it was zoomed
5050
--
5151
-- Returns the prior zoom state
52-
---@field set_zoomed fun(self: MuxTab, state: bool): bool
52+
---@field set_zoomed fun(self: MuxTab, state: boolean): boolean
5353
-- Returns the tab id
5454
---@field tab_id fun(self: MuxTab): number
5555
-- Returns the MuxWindow object that contains this tab

lua/types/objects/mux-window.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
-- The 0-based tab index
55
---@field index integer
66
-- A `boolean` indicating whether this is the active tab within the window
7-
---@field is_active bool
7+
---@field is_active boolean
88
-- The `MuxTab` object
99
---@field tab MuxTab
1010

lua/types/objects/pane-information.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
-- The logical position of the pane within its containing layout
1313
---@field pane_index number
1414
-- is `true` if the pane is the active pane within its containing tab
15-
---@field is_active bool
15+
---@field is_active boolean
1616
-- Is `true` if the pane is in the zoomed state
17-
---@field is_zoomed bool
17+
---@field is_zoomed boolean
1818
-- The cell `x` coordinate of the left edge of the pane
1919
---@field left number
2020
-- The cell `y` coordinate of the top edge of the pane

0 commit comments

Comments
 (0)