Commit graph

31 commits

Author SHA1 Message Date
Phạm Huy Hoàng
722617e672 refactor(format): drop extra indentation for field 2024-03-21 15:51:26 +01:00
Pham Huy Hoang
57a8acf0c4 chore: query formatting 2024-01-19 16:58:37 +01:00
Pham Huy Hoang
edee83272e refactor: manual pre-cleanup
Moving comments, adding `format-ignore` to lines that will be better
with it
2024-01-19 16:58:37 +01:00
Christian Clason
1ae9b0e455 feat!: align standard captures with upstream
Problem: Sharing highlight queries with upstream tree-sitter and
Helix is difficult.

Solution: Where reasonable, use capture names in tree-sitter's standard
list or Helix's Atom-style hierarchy.

Specifically:

* tree-sitter "standard capture names"
  (3f44b89685/highlight/src/lib.rs (L20-L72)):

  - `@parameter` -> `@variable.parameter`
  - `@field` -> `@variable.member`
  - `@namespace` -> `@module`
  - `@float` -> `@number.float`
  - `@symbol` -> `@string.special.symbol`
  - `@string.regex` -> `@string.regexp`
  - `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below)
  - `@text.title` -> `@markup.heading`
  - `@text.literal` -> `@markup.raw`
  - `@text.reference` -> `@markup.link`
  - `@text.uri` -> `@markup.link.url` (in markup links)
  - `@string.special` -> `@markup.link.label` (non-url links)
  - `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`)

* Helix captures
  (https://docs.helix-editor.com/master/themes.html#syntax-highlighting):

  - `@method` -> `@function.method`
  - `@method.call` -> `@function.method.call`
  - `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}`
  - `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}`
  - `@text.uri` -> `@string.special.url` (outside markup)
  - `@preproc` -> `@keyword.directive`
  - `@define` -> `@keyword.directive`(`.define`?)
  - `@storageclass` -> `@keyword.storage`
  - `@conditional` -> `@keyword.conditional`
  - `@debug` -> `@keyword.debug`
  - `@exception` -> `@keyword.exception`
  - `@include` -> `@keyword.import`
  - `@repeat` -> `@keyword.repeat`

* cleanup

  - remove some redundant `@conceal` (but still allow it for conceal-only patterns)
  - remove obsolete `@error` (syntax linting is out of scope for this repo)
  - sort, cleanup capture list in `CONTRIBUTING.md`
2024-01-19 16:58:37 +01:00
Pham Huy Hoang
107e61afb7 refactor: Remove all (ERROR) @error captures
As discussed in PR#5421, capturing `@error` is inconsistent, requiring
deep nesting (or priority) in order to correctly have red backgrounds to
it.

Some queries has this capture, some don't. For consistency purposes,
removing all of them is more preferable.

For re-enabling error, either add `(ERROR) @error` or `(ERROR _ @error)`
to your custom queries.
2023-10-25 18:18:50 +02:00
Pham Huy Hoang
78b54eb7f6 chore(injections)!: update injection syntax to 0.9
Since 0.9, @lang syntax is still available as fallback but will soon be deprecated.
Because of that, new syntax should be adopted once 0.9 becomes the
baseline requirements for nvim-treesitter

- update health check
- update doc
2023-08-12 17:34:15 +02:00
George Harker
cb568af539 use indent.X syntax for captures and properties of set directives
update CONTRIBUTING.md

adjust indents for bass

fix doc capture comment
2023-03-24 13:07:53 -04:00
Byron Kim
cac4ea0a08 updated comment to reflect highlight change 2023-02-14 10:09:09 -08:00
Byron Kim
3d5384ac46 update identifier 2023-02-14 10:09:09 -08:00
Michael Hoffmann
ee3e9f4dc0 feat(hcl,terraform): split terraform from hcl, add specialized queries for tf
This enables us to have different queries for
terraform and general hcl. It solve the situation
where other dialects of hcl (nomad, packer, etc)
might use a terraform keyword and get highlighted
out of place.
2022-12-29 22:18:41 +01:00
Luke Swithenbank
596fd673f5 Add Spelling to hcl comments 2022-11-20 11:14:12 +01:00
Roberto Pommella Alegro
599fd416c8 remove accidental text 2022-07-08 21:58:42 +02:00
Roberto Pommella Alegro
aac4f027c5 Add heredoc language injection for HCL
Add a heredoc language injection similar to Ruby for HCL. This allows terraform resources like this to be properly highlighted

```hcl
resource "aws_iam_role" "sample" {
  name               = "sample"
  assume_role_policy = <<JSON
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Action": "sts:AssumeRole",
      "Principal": {
        "AWS": "*"
      },
      "Effect": "Allow",
      "Sid": ""
    }
  ]
}
JSON
}
```
2022-07-08 21:58:42 +02:00
Michael Hoffmann
82e43748cf indent(hcl): fix function calls 2022-04-25 23:36:36 +02:00
Michael Hoffmann
b1e8b61a94 indents(hcl): fix indentation queries
This commit adds tests for hcl indentation and fixes various bugs
2022-04-24 18:57:30 +02:00
mhoffm
09ad32c91b update hcl parser, update queries 2021-09-20 22:39:32 +02:00
Matthew Wynn
649a7e6fe6 indents(hcl): add more indentation rules for HCL 2021-09-16 22:26:48 +02:00
Ronnie Magatti
016c757d11 Address highlight comments about cwd, path, module 2021-09-14 21:36:55 +02:00
Ronnie Magatti
dcf20b8a23 Better differentiate 'keywords' 2021-09-14 21:36:55 +02:00
Mark Ellis
3a9aa6fe88 added very basic HCL indentation support 2021-07-22 19:48:07 +02:00
David Hotham
9bcf658ca4
fold HCL objects (#1479) 2021-07-03 16:00:20 -05:00
mhoffm
8eb29ef93e highlight template interpolation enclosures as punctuation.bracket; cleanup 2021-07-02 19:48:19 +02:00
mhoffm
e607de4e1e update lockfile to point to v0.4.0; update highlight queries 2021-07-02 19:48:19 +02:00
Michael Hoffmann
bd00e4064f Update queries/hcl/highlights.scm
Co-authored-by: Santos Gallegos <stsewd@protonmail.com>
2021-07-02 01:56:25 +02:00
mhoffm
a40bce5e36 work on queries; fix macos build 2021-07-02 01:56:25 +02:00
mhoffm
1914317ae7 work on queries 2021-07-02 01:56:25 +02:00
mhoffm
2ea75bf3aa add basic injections 2021-07-02 01:56:25 +02:00
mhoffm
590898bbb7 fix highlights.scm 2021-07-02 01:56:25 +02:00
mhoffm
d6758b2673 improve queries 2021-07-02 01:56:25 +02:00
mhoffm
4a29ccba9b improve queries 2021-07-02 01:56:25 +02:00
mhoffm
9275a15aad add hcl parser 2021-07-02 01:56:25 +02:00