mirror of
https://github.com/nvim-treesitter/nvim-treesitter
synced 2024-09-16 14:34:05 +02:00
feat(format): extra newline after modeline
This commit is contained in:
parent
84daea50b1
commit
62b0bb4f24
54 changed files with 69 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
|||
; inherits: html_tags
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
(pipe_operator) @operator
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: soql
|
||||
|
||||
; Apex + SOQL
|
||||
[
|
||||
"["
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: cpp
|
||||
|
||||
((identifier) @function.builtin
|
||||
(#any-of? @function.builtin
|
||||
; Digital I/O
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: html
|
||||
|
||||
"---" @punctuation.delimiter
|
||||
|
||||
[
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: html_tags
|
||||
|
||||
(frontmatter
|
||||
(raw_text) @injection.content
|
||||
(#set! injection.language "typescript"))
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: c
|
||||
|
||||
[
|
||||
(for_range_loop)
|
||||
(class_specifier)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: c
|
||||
|
||||
((identifier) @variable.member
|
||||
(#lua-match? @variable.member "^m_.*$"))
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: c
|
||||
|
||||
(condition_clause) @indent.begin
|
||||
|
||||
((field_initializer_list) @indent.begin
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: c
|
||||
|
||||
; Parameters
|
||||
(variadic_parameter_declaration
|
||||
declarator:
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
; inherits: tsv
|
||||
|
||||
"," @punctuation.delimiter
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: cpp
|
||||
|
||||
[
|
||||
"<<<"
|
||||
">>>"
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: c
|
||||
|
||||
[
|
||||
"in"
|
||||
"out"
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
; inherits: json
|
||||
|
||||
(comment) @indent.ignore
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: cpp
|
||||
|
||||
[
|
||||
"in"
|
||||
"out"
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: html_tags
|
||||
|
||||
(doctype) @constant
|
||||
|
||||
"<!" @tag.delimiter
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: c
|
||||
|
||||
[
|
||||
(foreach_statement)
|
||||
(foreach_instance_statement)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: c
|
||||
|
||||
[
|
||||
"soa"
|
||||
"task"
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: c
|
||||
|
||||
((foreach_statement
|
||||
body: (_) @_body) @indent.begin
|
||||
(#not-has-type? @_body compound_statement))
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: c
|
||||
|
||||
(reference_declarator
|
||||
(identifier) @local.definition.var)
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: ecma,jsx
|
||||
|
||||
; Parameters
|
||||
(formal_parameters
|
||||
(identifier) @variable.parameter)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: ecma,jsx
|
||||
|
||||
; Both properties are matched here.
|
||||
;
|
||||
; class Foo {
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
; inherits: json
|
||||
|
||||
(comment) @comment @spell
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
; inherits: json
|
||||
|
||||
(comment) @indent.ignore
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
; inherits: lua
|
||||
|
||||
(object_type) @fold
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
; inherits: lua
|
||||
|
||||
(object_type) @indent.begin
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: c
|
||||
|
||||
[
|
||||
"task"
|
||||
"sub"
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: c
|
||||
|
||||
[
|
||||
(class_declaration)
|
||||
(class_interface)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: c
|
||||
|
||||
; Preprocs
|
||||
(preproc_undef
|
||||
name: (_) @constant) @keyword.directive
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: c
|
||||
|
||||
; TODO(amaanq): uncomment/add when I add asm support
|
||||
; (ms_asm_block "{" _ @asm "}")
|
||||
;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: php_only
|
||||
|
||||
((text) @injection.content
|
||||
(#set! injection.language "html")
|
||||
(#set! injection.combined))
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
; inherits: tsv
|
||||
|
||||
"|" @punctuation.delimiter
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: css
|
||||
|
||||
[
|
||||
"@at-root"
|
||||
"@debug"
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: css
|
||||
|
||||
[
|
||||
(mixin_statement)
|
||||
(while_statement)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: hlsl
|
||||
|
||||
[
|
||||
(interface_specifier)
|
||||
(extension_specifier)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: hlsl
|
||||
|
||||
[
|
||||
"var"
|
||||
"let"
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: hlsl
|
||||
|
||||
[
|
||||
(interface_specifier)
|
||||
(extension_specifier)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: python
|
||||
|
||||
[
|
||||
(rule_definition)
|
||||
(module_definition)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: python
|
||||
|
||||
; Compound directives
|
||||
[
|
||||
"rule"
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: python
|
||||
|
||||
(wildcard
|
||||
(constraint) @injection.content
|
||||
(#set! injection.language "regex"))
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: html
|
||||
|
||||
[
|
||||
(if_statement)
|
||||
(else_if_block)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: html
|
||||
|
||||
(raw_text) @none
|
||||
|
||||
[
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: html
|
||||
|
||||
[
|
||||
(if_statement)
|
||||
(each_statement)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: html_tags
|
||||
|
||||
((style_element
|
||||
(start_tag
|
||||
(attribute
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: go
|
||||
|
||||
(component_declaration
|
||||
name: (component_identifier) @function)
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: go
|
||||
|
||||
((element_comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: hcl
|
||||
|
||||
; Terraform specific references
|
||||
;
|
||||
;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: ecma
|
||||
|
||||
[
|
||||
(interface_declaration)
|
||||
(internal_module)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: ecma
|
||||
|
||||
"require" @keyword.import
|
||||
|
||||
(import_require_clause
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: ecma
|
||||
|
||||
[
|
||||
(enum_declaration)
|
||||
(interface_declaration)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: ecma
|
||||
|
||||
(required_parameter
|
||||
(identifier) @local.definition)
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: html_tags
|
||||
|
||||
[
|
||||
(directive_dynamic_argument)
|
||||
(directive_dynamic_argument_value)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: html_tags
|
||||
|
||||
(template_element) @indent.begin
|
||||
|
||||
(template_element
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; inherits: dtd
|
||||
|
||||
; XML declaration
|
||||
(XMLDecl
|
||||
"standalone" @tag.attribute)
|
||||
|
|
|
@ -61,6 +61,19 @@ local format_queries = [[
|
|||
(comment) @format.prepend-newline
|
||||
(#not-is-start-of-line? @_comment)
|
||||
(#is-start-of-line? @format.prepend-newline))
|
||||
; Extra newline for modelines
|
||||
(program
|
||||
(comment) @_modeline
|
||||
.
|
||||
(_) @format.prepend-newline
|
||||
(#is-start-of-line? @_modeline)
|
||||
(#contains? @_modeline "^;+%s*inherits:"))
|
||||
(program
|
||||
(comment) @_modeline
|
||||
.
|
||||
(_) @format.prepend-newline
|
||||
(#is-start-of-line? @_modeline)
|
||||
(#contains? @_modeline "^;+%s*extends%s*$"))
|
||||
;; }}}
|
||||
;; Making sure all top-level patterns are separated
|
||||
(program
|
||||
|
@ -88,7 +101,9 @@ local format_queries = [[
|
|||
(field_definition)
|
||||
(comment)
|
||||
] @format.cancel-prepend
|
||||
(#is-start-of-line? @_comment))
|
||||
(#is-start-of-line? @_comment)
|
||||
(#not-lua-match? @_comment "^;+%s*inherits:")
|
||||
(#not-lua-match? @_comment "^;+%s*extends%s*$"))
|
||||
;; }}}
|
||||
|
||||
;; delims
|
||||
|
|
Loading…
Reference in a new issue