Skip to content

Commit

Permalink
Better strip trailing newlines
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross35 committed Mar 11, 2024
1 parent 242de51 commit dcebdc7
Show file tree
Hide file tree
Showing 11 changed files with 116 additions and 115 deletions.
1 change: 1 addition & 0 deletions build-flavored-queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@ def main():

# Remove trailing whitespace and duplicate newlines
contents = re.sub(r"[\s;]+$", "", contents)
contents = "\n".join((line.rstrip() for line in contents.splitlines()))
contents = re.sub(r"((?:\r?\n){2,})(?:\r?\n)+", r"\1", contents)

if not contents.endswith("\n"):
Expand Down
10 changes: 5 additions & 5 deletions queries-flavored/helix/injections.scm
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@
(command_body) @injection.content))))
])

; ================ Recipe language specified - Helix only ================
; Set highlighting for recipes that specify a language using builtin shebang matching
(recipe_body
(shebang) @injection.shebang
; ================ Recipe language specified - Helix only ================

; Set highlighting for recipes that specify a language using builtin shebang matching
(recipe_body
(shebang) @injection.shebang
(#set! injection.include-children)) @injection.content
4 changes: 2 additions & 2 deletions queries-flavored/helix/textobjects.scm
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

; Specify how to navigate around logical blocks in code

(recipe
(recipe
(recipe_body) @function.inside) @function.around

(parameters
(parameters
((_) @parameter.inside . ","? @parameter.around)) @parameter.around

(dependency_expression
Expand Down
50 changes: 25 additions & 25 deletions queries-flavored/lapce/injections.scm
Original file line number Diff line number Diff line change
Expand Up @@ -74,29 +74,29 @@
(command_body) @injection.content))))
])

; ================ Recipe language specified ================
; Set highlighting for recipes that specify a language, using the exact name by default
(recipe_body ;
(shebang ;
(language) @injection.language) ;
(#not-any-of? @injection.language "python3" "nodejs" "node")
(#set! injection.include-children)) @injection.content
; Transform some known executables
; python3 -> python
(recipe_body
(shebang
(language) @_lang)
(#eq? @_lang "python3")
(#set! injection.language "python")
(#set! injection.include-children)) @injection.content
; node/nodejs -> javascript
(recipe_body
(shebang
(language) @_lang)
(#any-of? @_lang "node" "nodejs")
(#set! injection.language "javascript")
; ================ Recipe language specified ================

; Set highlighting for recipes that specify a language, using the exact name by default
(recipe_body ;
(shebang ;
(language) @injection.language) ;
(#not-any-of? @injection.language "python3" "nodejs" "node")
(#set! injection.include-children)) @injection.content

; Transform some known executables

; python3 -> python
(recipe_body
(shebang
(language) @_lang)
(#eq? @_lang "python3")
(#set! injection.language "python")
(#set! injection.include-children)) @injection.content

; node/nodejs -> javascript
(recipe_body
(shebang
(language) @_lang)
(#any-of? @_lang "node" "nodejs")
(#set! injection.language "javascript")
(#set! injection.include-children)) @injection.content
4 changes: 2 additions & 2 deletions queries-flavored/lapce/textobjects.scm
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

; Specify how to navigate around logical blocks in code

(recipe
(recipe
(recipe_body) @function.inside) @function.around

(parameters
(parameters
((_) @parameter.inside . ","? @parameter.around)) @parameter.around

(dependency_expression
Expand Down
50 changes: 25 additions & 25 deletions queries-flavored/nvim-next/injections.scm
Original file line number Diff line number Diff line change
Expand Up @@ -72,29 +72,29 @@
(command_body) @injection.content))))
])

; ================ Recipe language specified ================
; Set highlighting for recipes that specify a language, using the exact name by default
(recipe_body ;
(shebang ;
(language) @injection.language) ;
(#not-any-of? @injection.language "python3" "nodejs" "node")
(#set! injection.include-children)) @injection.content
; Transform some known executables
; python3 -> python
(recipe_body
(shebang
(language) @_lang)
(#eq? @_lang "python3")
(#set! injection.language "python")
(#set! injection.include-children)) @injection.content
; node/nodejs -> javascript
(recipe_body
(shebang
(language) @_lang)
(#any-of? @_lang "node" "nodejs")
(#set! injection.language "javascript")
; ================ Recipe language specified ================

; Set highlighting for recipes that specify a language, using the exact name by default
(recipe_body ;
(shebang ;
(language) @injection.language) ;
(#not-any-of? @injection.language "python3" "nodejs" "node")
(#set! injection.include-children)) @injection.content

; Transform some known executables

; python3 -> python
(recipe_body
(shebang
(language) @_lang)
(#eq? @_lang "python3")
(#set! injection.language "python")
(#set! injection.include-children)) @injection.content

; node/nodejs -> javascript
(recipe_body
(shebang
(language) @_lang)
(#any-of? @_lang "node" "nodejs")
(#set! injection.language "javascript")
(#set! injection.include-children)) @injection.content
4 changes: 2 additions & 2 deletions queries-flavored/nvim-next/textobjects.scm
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

; Specify how to navigate around logical blocks in code

(recipe
(recipe
(recipe_body) @function.inner) @function.outer

(parameters
(parameters
((_) @parameter.inner . ","? @parameter.outer)) @parameter.outer

(dependency_expression
Expand Down
50 changes: 25 additions & 25 deletions queries-flavored/zed/injections.scm
Original file line number Diff line number Diff line change
Expand Up @@ -74,29 +74,29 @@
(command_body) @injection.content))))
])

; ================ Recipe language specified ================
; Set highlighting for recipes that specify a language, using the exact name by default
(recipe_body ;
(shebang ;
(language) @injection.language) ;
(#not-any-of? @injection.language "python3" "nodejs" "node")
(#set! injection.include-children)) @injection.content
; Transform some known executables
; python3 -> python
(recipe_body
(shebang
(language) @_lang)
(#eq? @_lang "python3")
(#set! injection.language "python")
(#set! injection.include-children)) @injection.content
; node/nodejs -> javascript
(recipe_body
(shebang
(language) @_lang)
(#any-of? @_lang "node" "nodejs")
(#set! injection.language "javascript")
; ================ Recipe language specified ================

; Set highlighting for recipes that specify a language, using the exact name by default
(recipe_body ;
(shebang ;
(language) @injection.language) ;
(#not-any-of? @injection.language "python3" "nodejs" "node")
(#set! injection.include-children)) @injection.content

; Transform some known executables

; python3 -> python
(recipe_body
(shebang
(language) @_lang)
(#eq? @_lang "python3")
(#set! injection.language "python")
(#set! injection.include-children)) @injection.content

; node/nodejs -> javascript
(recipe_body
(shebang
(language) @_lang)
(#any-of? @_lang "node" "nodejs")
(#set! injection.language "javascript")
(#set! injection.include-children)) @injection.content
4 changes: 2 additions & 2 deletions queries-flavored/zed/textobjects.scm
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

; Specify how to navigate around logical blocks in code

(recipe
(recipe
(recipe_body) @function.inside) @function.around

(parameters
(parameters
((_) @parameter.inside . ","? @parameter.around)) @parameter.around

(dependency_expression
Expand Down
50 changes: 25 additions & 25 deletions queries/just/injections.scm
Original file line number Diff line number Diff line change
Expand Up @@ -72,29 +72,29 @@
(command_body) @injection.content))))
])

; ================ Recipe language specified ================
; Set highlighting for recipes that specify a language, using the exact name by default
(recipe_body ;
(shebang ;
(language) @injection.language) ;
(#not-any-of? @injection.language "python3" "nodejs" "node")
(#set! injection.include-children)) @injection.content
; Transform some known executables
; python3 -> python
(recipe_body
(shebang
(language) @_lang)
(#eq? @_lang "python3")
(#set! injection.language "python")
(#set! injection.include-children)) @injection.content
; node/nodejs -> javascript
(recipe_body
(shebang
(language) @_lang)
(#any-of? @_lang "node" "nodejs")
(#set! injection.language "javascript")
; ================ Recipe language specified ================

; Set highlighting for recipes that specify a language, using the exact name by default
(recipe_body ;
(shebang ;
(language) @injection.language) ;
(#not-any-of? @injection.language "python3" "nodejs" "node")
(#set! injection.include-children)) @injection.content

; Transform some known executables

; python3 -> python
(recipe_body
(shebang
(language) @_lang)
(#eq? @_lang "python3")
(#set! injection.language "python")
(#set! injection.include-children)) @injection.content

; node/nodejs -> javascript
(recipe_body
(shebang
(language) @_lang)
(#any-of? @_lang "node" "nodejs")
(#set! injection.language "javascript")
(#set! injection.include-children)) @injection.content
4 changes: 2 additions & 2 deletions queries/just/textobjects.scm
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

; Specify how to navigate around logical blocks in code

(recipe
(recipe
(recipe_body) @function.inner) @function.outer

(parameters
(parameters
((_) @parameter.inner . ","? @parameter.outer)) @parameter.outer

(dependency_expression
Expand Down

0 comments on commit dcebdc7

Please sign in to comment.