Commit Graph

24 Commits

Author SHA1 Message Date
Christian Clason
53d7118483 refactor(lua): fix some luals warnings 2025-05-12 18:43:40 +02:00
Christian Clason
12e0246e4f fix(formatter): increase match limit
Problem: Some very long patterns were not formatted correctly.

Solution: Increase the match limit when iterating to 1024.
2025-05-12 18:43:40 +02:00
Phạm Huy Hoàng
039fe9095d fix(format): update scripts to support nightly (#6126)
No need for assert as the use is contained within the script only
2025-05-12 18:43:40 +02:00
Christian Clason
692b051b09 feat!: drop modules, general refactor and cleanup 2025-05-12 18:43:40 +02:00
Riley Bruins
53a6b3993f feat(formatter): support formatting missing nodes
This commit makes missing nodes take formatting identical to that of
regular named nodes, with the only exception being that a newline will
not be prepended to a node name. E.g. this pattern:

```query
(MISSING identifier)
```

will *not* be changed to:

```query
(MISSING
  (identifier))
```
2025-02-04 09:56:51 +01:00
Riley Bruins
7194ff9511 fix(formatter): prefer #-prefixed predicates
This prevents the formatter for appending a space after the "." in a
predicate prefix, and changes it to a "#" to match all other occurrences
in the codebase.
2025-02-04 09:56:39 +01:00
Riley Bruins
a069bb62a8 fix: formatter idempotency for nested groupings (#7345)
Currently, for something like `(((((node))))) @cap`, the formatter will
produce `((node)) @cap`, and then after another pass it will produce
`(node) @cap`. This commit makes it so that all extraneous parentheses
are removed on the first pass.
2024-11-11 11:59:21 +09:00
Riley Bruins
674100c1fc fix(formatter): simplify code, remove odd line break 2024-10-26 10:07:30 +02:00
Riley Bruins
58030e6d6f fix(formatter): adapt formatter for nightly
After Neovim pull #30193, the formatter was broken due to changes in the
way node data is passed to predicates.
2024-09-07 17:31:18 +02:00
再生花
929e4739cc fix(format): field_def inside grouping 2024-08-01 08:40:23 +02:00
Christian Clason
a80fe081b4 feat(predicates)!: rename has-type to kind-eq to align with Helix
No point in having a different name for the same predicate.
2024-06-02 12:07:58 +02:00
Amaan Qureshi
488e39a8f1 feat(query): adapt to upstream changes 2024-05-26 00:24:03 +02:00
Phạm Huy Hoàng
722617e672 refactor(format): drop extra indentation for field 2024-03-21 15:51:26 +01:00
Phạm Huy Hoàng
62b0bb4f24 feat(format): extra newline after modeline 2024-02-29 23:05:30 +09:00
再生花
31641d72a4 feat(format-scripts): linewrap predicates
"format-ignore".kick()
2024-02-23 10:42:01 +02:00
Phạm Huy Hoàng
917d696592 fix(scripts): add missing \n for nested grouping 2024-02-20 10:36:49 +09:00
Christian Clason
4b27f87fef fix(scripts): format-queries defaults to cwd 2024-02-20 09:59:02 +09:00
dundargoc
9bc21966f2 fix: typos 2024-02-19 17:45:54 +01:00
Phạm Huy Hoàng
fef26b5eee fix(format): fix nested grouping indentation (#6128) 2024-02-18 23:13:39 +09:00
Phạm Huy Hoàng
5f950cdcb8 fix(format): handle list with 300 nodes 2024-01-30 22:59:27 +07:00
Christian Clason
e9602f4119 fix(format): improve error message 2024-01-30 09:57:54 +01:00
Phạm Huy Hoàng
76ca66db38 fix(format-scripts): remove parens if possible 2024-01-21 23:55:02 +09:00
Phạm Huy Hoàng
d198a75e2c Fixup format (#5934)
* fix(format): newline between top-level field defs

* fixup: newline between node and comment

* fixup: optimize pattern
2024-01-20 18:47:56 +09:00
Pham Huy Hoang
15de22a2e1 feat: query formatting script
Usage:
- nvim -l scripts/format-queries.lua /path/to/file.scm
- nvim -l scripts/format-queries.lua /path/to/dir

fixup: add `format-ignore` directive to query/highlights.scm
2024-01-19 16:58:37 +01:00