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