-
-
Notifications
You must be signed in to change notification settings - Fork 780
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: reformat lua code #2273
docs: reformat lua code #2273
Conversation
Thanks for this! Seeing what it changes, I hope we can configure some of the opinions of sylua. A number of the choices in the docs and the set of modules and types in wezterm were carefully selected to work with lua's syntax to make things reasonably expressive without excessive punctuation. The things that stand out to me as undesirable in the styling on my first pass through are:
Aside from controlling the styling, for this to stick I think we'd need to fold this tool into the doc build and CI:
|
I reformated the docs using Gelatyx v0.1.4 with this command and configuration. $ gelatyx lua --file docs/**/*.md --language-config config.toml config.toml column_width = 120
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferDouble"
call_parentheses = "NoSingleString" Config reference: https://github.com/JohnnyMorganz/StyLua#options |
docs/config/files.md
Outdated
return { | ||
font = wezterm.font("JetBrains Mono"), | ||
font = wezterm.font "JetBrains Mono", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the risk of sounding mercurial, this is one case where I would lean towards having parens
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like no. I think I'd rather this didn't have parens if it means that is what is needed for the pane:split
and wezterm.action
stuff to not have parens
docs/config/key-tables.md
Outdated
{ | ||
key = "a", | ||
mods = "LEADER", | ||
action = act.ActivateKeyTable({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and these act
cases don't need parens. What are the chances that we can control the formatting to be this specific?
docs/config/lua/MuxPane.md
Outdated
@@ -16,7 +16,7 @@ Splits `pane` and spawns a program into the split, returning the | |||
`MuxPane` object associated with it: | |||
|
|||
```lua | |||
local new_pane = pane:split{} | |||
local new_pane = pane:split({}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps it is a stylua bug; this seems like the no-single-parens config should have applied?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I think this looks better, but it's still not quite how I like.
Can we try:
call_parentheses = "None"
and column_width = 78
?
Can we also set |
Should I override the current commit with new config, or is it better to create a new commit? |
I think it's fine to force-push here so we can see the diff. In terms of merging this, I was thinking that I don't trust the GH UI to let me see everything in a large diff, and what I'd like to see is a new separate PR that adds the style config and call to |
I have updated the ci and added the config. |
I split the docs changes out from your change to the build scripts, then did some work to address the errors in the doc pages; that was a bit frustrating because the error output is lacking in context, and formatting seems non-deterministic. I filed two issues for that:
I've pushed the end result of the formatting in e0ea0f4 Thanks for working on this! |
Thank you so much for merging this PR. Very glad to be part of wezterm contributor. I will keep maintaining Gelatyx. Yes, I have replied to both of your issue. |
I build an app called Gelatyx for this purpose. It worked well. However, StyLua find some invalid code such;
It says the code is missing function name:
wezterm/docs/config/lua/ExecDomain.md
Line 37 in 2b17a64
Here is the full list of files that has invalid code:
result.txt
Usage;
fixes: #2253