feat(format): extra newline after modeline

This commit is contained in:
Phạm Huy Hoàng 2024-02-19 00:00:07 +09:00 committed by 再生花
parent 84daea50b1
commit 62b0bb4f24
54 changed files with 69 additions and 1 deletions

View file

@ -1,4 +1,5 @@
; inherits: html_tags
(identifier) @variable
(pipe_operator) @operator

View file

@ -1,4 +1,5 @@
; inherits: soql
; Apex + SOQL
[
"["

View file

@ -1,4 +1,5 @@
; inherits: cpp
((identifier) @function.builtin
(#any-of? @function.builtin
; Digital I/O

View file

@ -1,4 +1,5 @@
; inherits: html
"---" @punctuation.delimiter
[

View file

@ -1,4 +1,5 @@
; inherits: html_tags
(frontmatter
(raw_text) @injection.content
(#set! injection.language "typescript"))

View file

@ -1,4 +1,5 @@
; inherits: c
[
(for_range_loop)
(class_specifier)

View file

@ -1,4 +1,5 @@
; inherits: c
((identifier) @variable.member
(#lua-match? @variable.member "^m_.*$"))

View file

@ -1,4 +1,5 @@
; inherits: c
(condition_clause) @indent.begin
((field_initializer_list) @indent.begin

View file

@ -1,4 +1,5 @@
; inherits: c
; Parameters
(variadic_parameter_declaration
declarator:

View file

@ -1,2 +1,3 @@
; inherits: tsv
"," @punctuation.delimiter

View file

@ -1,4 +1,5 @@
; inherits: cpp
[
"<<<"
">>>"

View file

@ -1,4 +1,5 @@
; inherits: c
[
"in"
"out"

View file

@ -1,2 +1,3 @@
; inherits: json
(comment) @indent.ignore

View file

@ -1,4 +1,5 @@
; inherits: cpp
[
"in"
"out"

View file

@ -1,4 +1,5 @@
; inherits: html_tags
(doctype) @constant
"<!" @tag.delimiter

View file

@ -1,4 +1,5 @@
; inherits: c
[
(foreach_statement)
(foreach_instance_statement)

View file

@ -1,4 +1,5 @@
; inherits: c
[
"soa"
"task"

View file

@ -1,4 +1,5 @@
; inherits: c
((foreach_statement
body: (_) @_body) @indent.begin
(#not-has-type? @_body compound_statement))

View file

@ -1,4 +1,5 @@
; inherits: c
(reference_declarator
(identifier) @local.definition.var)

View file

@ -1,4 +1,5 @@
; inherits: ecma,jsx
; Parameters
(formal_parameters
(identifier) @variable.parameter)

View file

@ -1,4 +1,5 @@
; inherits: ecma,jsx
; Both properties are matched here.
;
; class Foo {

View file

@ -1,2 +1,3 @@
; inherits: json
(comment) @comment @spell

View file

@ -1,2 +1,3 @@
; inherits: json
(comment) @indent.ignore

View file

@ -1,2 +1,3 @@
; inherits: lua
(object_type) @fold

View file

@ -1,2 +1,3 @@
; inherits: lua
(object_type) @indent.begin

View file

@ -1,4 +1,5 @@
; inherits: c
[
"task"
"sub"

View file

@ -1,4 +1,5 @@
; inherits: c
[
(class_declaration)
(class_interface)

View file

@ -1,4 +1,5 @@
; inherits: c
; Preprocs
(preproc_undef
name: (_) @constant) @keyword.directive

View file

@ -1,4 +1,5 @@
; inherits: c
; TODO(amaanq): uncomment/add when I add asm support
; (ms_asm_block "{" _ @asm "}")
;

View file

@ -1,4 +1,5 @@
; inherits: php_only
((text) @injection.content
(#set! injection.language "html")
(#set! injection.combined))

View file

@ -1,2 +1,3 @@
; inherits: tsv
"|" @punctuation.delimiter

View file

@ -1,4 +1,5 @@
; inherits: css
[
"@at-root"
"@debug"

View file

@ -1,4 +1,5 @@
; inherits: css
[
(mixin_statement)
(while_statement)

View file

@ -1,4 +1,5 @@
; inherits: hlsl
[
(interface_specifier)
(extension_specifier)

View file

@ -1,4 +1,5 @@
; inherits: hlsl
[
"var"
"let"

View file

@ -1,4 +1,5 @@
; inherits: hlsl
[
(interface_specifier)
(extension_specifier)

View file

@ -1,4 +1,5 @@
; inherits: python
[
(rule_definition)
(module_definition)

View file

@ -1,4 +1,5 @@
; inherits: python
; Compound directives
[
"rule"

View file

@ -1,4 +1,5 @@
; inherits: python
(wildcard
(constraint) @injection.content
(#set! injection.language "regex"))

View file

@ -1,4 +1,5 @@
; inherits: html
[
(if_statement)
(else_if_block)

View file

@ -1,4 +1,5 @@
; inherits: html
(raw_text) @none
[

View file

@ -1,4 +1,5 @@
; inherits: html
[
(if_statement)
(each_statement)

View file

@ -1,4 +1,5 @@
; inherits: html_tags
((style_element
(start_tag
(attribute

View file

@ -1,4 +1,5 @@
; inherits: go
(component_declaration
name: (component_identifier) @function)

View file

@ -1,4 +1,5 @@
; inherits: go
((element_comment) @injection.content
(#set! injection.language "comment"))

View file

@ -1,4 +1,5 @@
; inherits: hcl
; Terraform specific references
;
;

View file

@ -1,4 +1,5 @@
; inherits: ecma
[
(interface_declaration)
(internal_module)

View file

@ -1,4 +1,5 @@
; inherits: ecma
"require" @keyword.import
(import_require_clause

View file

@ -1,4 +1,5 @@
; inherits: ecma
[
(enum_declaration)
(interface_declaration)

View file

@ -1,4 +1,5 @@
; inherits: ecma
(required_parameter
(identifier) @local.definition)

View file

@ -1,4 +1,5 @@
; inherits: html_tags
[
(directive_dynamic_argument)
(directive_dynamic_argument_value)

View file

@ -1,4 +1,5 @@
; inherits: html_tags
(template_element) @indent.begin
(template_element

View file

@ -1,4 +1,5 @@
; inherits: dtd
; XML declaration
(XMLDecl
"standalone" @tag.attribute)

View file

@ -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