-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
fix(swayconfig): floating_modifier #14827
Conversation
The root cause is a change in To make them work both properly, I'd suggest leaving the " 4.7 Floating modifier
- syn keyword i3ConfigKeyword floating_modifier contained skipwhite nextgroup=i3ConfigVariable,i3ConfigBindModkey
+ syn match i3ConfigKeyword /floating_modifier [$a-zA-Z0-9+]\+$/ contained contains=i3ConfigVariable,i3ConfigBindModkey I prefer this because it sticks to the general file structure - every keyword is under the Also, I understand that the 3 separate matches are more correct, but is such preciseness really necessary for such a simple case that gets a single use at most in the entire config? I was thinking about something simpler like syn keyword swayConfigFloatingModifierOpts normal inverse none contained
syn match i3ConfigKeyword /floating_modifier \(none\|[$a-zA-Z0-9+]\+ \(normal\|inverse\)\)$/ contained contains=i3ConfigVariable,i3ConfigBindModkey,swayConfigFloatingModifierOpts |
53cde3f
to
c6e0dde
Compare
Thanks! I've reverted the i3 change that caused the issue @hiqua. For the precise matches, I think its more consistent to be precise since other syntax elements are precisely matched, but you have a point that its not going to be used more than once and vim needn't act as a sway linter. I'll go with the simpler option for now but will keep trying to see if there's another way to get that precision. For a start I did notice two of the errors are recognized if there are any leading spaces: |
- fix floating_modifier $mod normal|inverse was being hightlighted as error reverting the floating_modifier change from dd83b63 - will currently allow invalid syntax after floating_modifier Co-authored-by: JosefLitos <litosjos@fit.cvut.cz>
af34e45
to
6c9fb8d
Compare
Thanks. So is this good to be included? Or are you still working on it? @JosefLitos can you please ACK as well please? |
Yes its good to go. |
…ifier none; revert broken highlighting - fix floating_modifier $mod normal|inverse was being hightlighted as error reverting the floating_modifier change from dd83b63 - will currently allow invalid syntax after floating_modifier fixes: vim/vim#14826 closes: vim/vim#14827 vim/vim@22ac941 Co-authored-by: James Eapen <james.eapen@vai.org> Co-authored-by: JosefLitos <litosjos@fit.cvut.cz>
…ifier none; revert broken highlighting - fix floating_modifier $mod normal|inverse was being hightlighted as error reverting the floating_modifier change from dd83b63 - will currently allow invalid syntax after floating_modifier fixes: vim/vim#14826 closes: vim/vim#14827 vim/vim@22ac941 Co-authored-by: James Eapen <james.eapen@vai.org> Co-authored-by: JosefLitos <litosjos@fit.cvut.cz>
@@ -67,7 +67,7 @@ syn keyword i3ConfigBindKeyword bindsym bindcode contained skipwhite nextgroup=i | |||
syn region i3ConfigModeBlock matchgroup=i3ConfigKeyword start=/mode\ze\( --pango_markup\)\? \([^'" {]\+\|'[^']\+'\|".\+"\)\s\+{$/ end=/^}\zs$/ contained contains=i3ConfigShParam,@i3ConfigStrVar,i3ConfigBindKeyword,i3ConfigComment,i3ConfigParen fold keepend extend | |||
|
|||
" 4.7 Floating modifier | |||
syn keyword i3ConfigKeyword floating_modifier contained skipwhite nextgroup=i3ConfigVariable,i3ConfigBindModkey | |||
syn match i3ConfigKeyword /^floating_modifier [$0-9A-Za-z]*$/ contains=i3ConfigVariable,i3ConfigBindModkey |
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.
I may have miscommunicated the changes in i3. The reverted changes in i3 introduce back the issue for which they were made - leading spaces.
We didn't need to put back the start-of-line anchor, but we should have kept in the contained
keyword. I wrote the exact changes in the original comment, but a revert was probably not the best way to describe them.
Sorry for the late review.
The reason leading spaces play a role is the inclusion of i3config: syn match i3ConfigKeyword /floating_modifier [$A-Z][0-9A-Za-z]*$/ contained contains=i3ConfigVariable,i3ConfigBindModkey swayconfig: syn match i3ConfigKeyword /floating_modifier \(none\|[$A-Z][a-zA-Z0-9+]\+ \(normal\|inverse\)\)$/ contained contains=i3ConfigVariable,i3ConfigBindModkey,swayConfigFloatingModifierOpts (added |
Ah I did focus more on the revert and the sway suggestion than the i3 diff. Thanks @JosefLitos, and apologies @chrisbra the new pull request should supersede this one. |
…ifier none; revert broken highlighting - fix floating_modifier $mod normal|inverse was being hightlighted as error reverting the floating_modifier change from dd83b63 - will currently allow invalid syntax after floating_modifier fixes: vim/vim#14826 closes: vim/vim#14827 vim/vim@22ac941 Co-authored-by: James Eapen <james.eapen@vai.org> Co-authored-by: JosefLitos <litosjos@fit.cvut.cz>
Restores correct highlighting of swayconfig's
floating_modifier
with thenormal
andinverse
options. Both i3 and sway have this keyword, but i3 does not have thenormal|inverse
. When this match was set ascontained
in 679f5ab, it prevented the sway options from being recognized.Added the
none
option which was not supported but is a valid option in sway config.Ideally
floating_modifier
would be a keyword as it is ini3config.vim
, but I'm still working that out.Fixes #14826