Skip to content

Commit

Permalink
Fix highlighting of boolean set followed by inline comment
Browse files Browse the repository at this point in the history
  • Loading branch information
laniakea64 committed Aug 4, 2024
1 parent 2b41347 commit b6952c8
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion syntax/just.vim
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ syn keyword justSetKeywords
\ allow-duplicate-recipes allow-duplicate-variables dotenv-load dotenv-filename dotenv-path dotenv-required export fallback ignore-comments positional-arguments quiet script-interpreter shell tempdir unstable windows-shell working-directory
\ contained
syn keyword justSetDeprecatedKeywords windows-powershell contained
syn match justBooleanSet "\v^set%(\s|\\\n)+%(allow-duplicate-%(recip|variabl)es|dotenv-%(loa|require)d|export|fallback|ignore-comments|positional-arguments|quiet|unstable|windows-powershell)%(%(\s|\\\n)*:\=%(\s|\\\n)*%(true|false))?$"
syn match justBooleanSet "\v^set%(\s|\\\n)+%(allow-duplicate-%(recip|variabl)es|dotenv-%(loa|require)d|export|fallback|ignore-comments|positional-arguments|quiet|unstable|windows-powershell)%(%(\s|\\\n)*:\=%(\s|\\\n)*%(true|false))?%(\s|\\\n)*%($|#@=)"
\ contains=justSet,justSetKeywords,justSetDeprecatedKeywords,justAssignmentOperator,justBoolean
\ transparent

Expand Down
15 changes: 15 additions & 0 deletions tests/cases/set.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,21 @@
<span class="Statement">set</span> <span class="Keyword">fallback</span><span class="Operator">:=</span> <span class="Boolean">true</span>
<span class="Statement">set</span> <span class="Keyword">fallback</span> <span class="Operator">:=</span><span class="Boolean">false</span>

<span class="Comment"># the trailing whitespace at the end of the following lines is intentional</span>
<span class="Statement">set</span> <span class="Keyword">fallback</span>
<span class="Statement">set</span> <span class="Keyword">fallback</span> <span class="Operator">:=</span> <span class="Boolean">true</span>
<span class="Statement">set</span> <span class="Keyword">fallback</span> <span class="Operator">:=</span> <span class="Boolean">false</span>

<span class="Statement">set</span> <span class="Keyword">fallback</span> <span class="Comment"># comment</span>
<span class="Statement">set</span> <span class="Keyword">fallback</span> <span class="Operator">:=</span> <span class="Boolean">true</span> <span class="Comment"># comment</span>
<span class="Statement">set</span> <span class="Keyword">fallback</span> <span class="Operator">:=</span> <span class="Boolean">true</span><span class="Comment"># comment</span>

<span class="Statement">set</span> <span class="Keyword">fallback</span> <span class="Operator">:=</span> <span class="Boolean">true</span> <span class="Special">\</span>
<span class="Comment"># comment</span>

<span class="Statement">set</span> <span class="Keyword">fallback</span> <span class="Operator">:=</span> <span class="Boolean">false</span><span class="Special">\</span>
<span class="Comment">#comment</span>

<span class="Statement">set</span> <span class="Keyword">tempdir</span> <span class="Operator">:=</span> <span class="String">'/tmp'</span>
<span class="Statement">set</span> <span class="Keyword">tempdir</span> <span class="Operator">:=</span> <span class="String">"""</span>
<span class="String">/tmp"""</span>
Expand Down
15 changes: 15 additions & 0 deletions tests/cases/set.just
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,21 @@ set fallback:=false
set fallback:= true
set fallback :=false

# the trailing whitespace at the end of the following lines is intentional
set fallback
set fallback := true
set fallback := false

set fallback # comment
set fallback := true # comment
set fallback := true# comment

set fallback := true \
# comment

set fallback := false\
#comment

set tempdir := '/tmp'
set tempdir := """
/tmp"""
Expand Down

0 comments on commit b6952c8

Please sign in to comment.