Commit graph

82 commits

Author SHA1 Message Date
Fredrik Ekre
acada1a685 fix(julia): fix incorrect documentation query
This patch fixes an inprecise `@string.documentation` query introduced
in https://github.com/nvim-treesitter/nvim-treesitter/pull/7391. The
pattern `(string_literal) . (call_expression)` matches also for example
`"hello"` in `foo("hello", bar())`. Similarly to
https://github.com/nvim-treesitter/nvim-treesitter/pull/7436, this patch
limits the pattern to top-level statements.
2024-12-05 15:04:15 +01:00
Fredrik Ekre
b0fc560c75 fix(julia): fix incorrect documentation query
This patch fixes an inprecise `@string.documentation` query introduced
in https://github.com/nvim-treesitter/nvim-treesitter/pull/7391.
Specifically, the pattern `(string_literal) . (identifier)` matches also
for example `"hello"` in

```julia
foo("hello", world)
@info "hello" world
```

To fix this, this patch limits the pattern to top-level statements.
2024-12-04 11:59:55 +01:00
Fredrik Ekre
60b4c15e7c feat(julia): highlight interpolation operator
This patch adds `$` to the `@punctuation.special` capture group within
`(string_interpolation)` (e.g. `"hello $name"`) and
`(interpolation_expression)` (e.g. `:(hello $name)`) nodes.
2024-11-29 08:12:56 +01:00
Fredrik Ekre
3f377c0739 fix(julia): treat :: as operator in type contexts
This patch captures `::` as `@operator` within
`(unary_typed_expression)` and `(typed_expression)`. These should be the
only two cases that the parser can emit when encountering `::` in the
source, but as a fallback it is still captured as `@punctuation` in all
other cases.

The reasons for capturing `::` as an operator are i) the close relation
with the other type-operators `<:` and `>:` and ii) the fact that it is
treated as an operator by the Julia parser, just like `<:` and `>:`.
2024-11-23 11:10:05 +01:00
Fredrik Ekre
e05c280659 fix(julia): misc fixes to type highlighting
This patch fixes two issues related to `@type` capturing (split out from
https://github.com/nvim-treesitter/nvim-treesitter/pull/7392):

 - Capture the RHS of `<:` and `>:` as `@type` in `(unary_expression)`s
   similarly to what is already done for `(binary_expression)`s with
   these operators.
 - Capture children of `(curly_expression)`s inside of
   `(where_expression)`s as `@type` similarly how they are handled in
   `(parametrized_type_expression)`.
2024-11-23 10:40:13 +01:00
Fredrik Ekre
28a5dc06a8 fix(julia): fix macro identifier highlight query
This fixes the macro identifier highlight query after the breaking
changes in https://github.com/tree-sitter/tree-sitter-julia/pull/153.
See also
https://github.com/tree-sitter/tree-sitter-julia/pull/158/commits/9f2fb3b9a8c73ef0d2ec005c97f91274b492d48d.
2024-11-22 23:48:19 +01:00
Fredrik Ekre
fcd2a5fea9 fix(julia): capture docstrings in more cases
This patch enables `@string.documentation` capturing, and markdown
injection, for strings attached to `(call_expression)` and
`(identifier)` nodes. For example

```julia
"docs"
foo(::Int, ::Float64)

"docs"
bar
```
2024-11-22 14:07:51 +01:00
Fredrik Ekre
2d816bb49e fix(julia): fix injection queries
This patch fixes the julia `(string_literal)` injection queries after
the breaking changes in
https://github.com/tree-sitter/tree-sitter-julia/pull/153. The queries
are simplified by the fact that string content is now directly available
as a separate `(content)` child node.
2024-11-22 13:33:54 +01:00
Christian Clason
d105f2cb7b feat(julia): update parser and queries 2024-11-11 08:40:34 +01:00
Sergio Alejandro Vargas
9e66d5c72d fix(julia): macro definition docstrings
Inject markdown in macro definition docstrings.
2024-08-07 00:34:56 +02:00
Dheepak Krishnamurthy
a0732ca9f0 feat(julia): Add syntax highlighting for markdown and bash prefixed_string_literals 2024-07-24 09:14:14 +02:00
Riley Bruins
f58cae6c22 feat: more @keyword.type captures 2024-05-01 09:59:50 +02:00
Sergio A. Vargas
3e10cffbb2
Julia outer keyword (#6461) 2024-04-17 20:59:37 +02:00
Sergio A. Vargas
d2f4c78303
fix(julia): adapt queries to grammar changes (#6429) 2024-04-14 14:23:46 +02:00
Christian Degnbol Madsen
839dec615a feat(julia): broadcast pipe
Add support for capturing function call after a broadcasted pipe.
Currently works for unbroadcasted pipe.
There might be a better more complicated way to do this, since this will capture the broadcasting dot as part of the `@_pipe` capture.
2024-03-26 22:57:50 -04:00
Phạm Huy Hoàng
722617e672 refactor(format): drop extra indentation for field 2024-03-21 15:51:26 +01:00
Jaehwang Jung
998b230a77 feat(highlights)!: keyword @type.qualifier@keyword.modifier 2024-03-16 20:51:16 +08:00
再生花
31641d72a4
feat(format-scripts): linewrap predicates
"format-ignore".kick()
2024-02-23 10:42:01 +02: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
Christian Clason
5b90ea2aba feat(locals)!: switch to upstream captures 2024-01-19 16:58:37 +01:00
Christian Degnbol Madsen
65ef62092e fix(julia): add missing capture of ":" in selected import
If writing a selected import, e.g. `using BSON: @load`, the colon isn't currently captured.
This change captures it as `@punctuation.delimiter`.
2024-01-02 11:43:08 +01:00
Christian Degnbol Madsen
454c3a9ba8
fix(julia): pipe function highlight (#5815)
In Julia when piping into a function the function should be highlighted as a function call, and not a variable.
2023-12-22 12:24:04 +02:00
Ronan Arraes Jardim Chagas
a741b5dd0d Improve curly expression alignment 2023-10-29 01:37:31 +02:00
Ronan Arraes Jardim Chagas
639c22c52c Improve indentation in Julia language
This commit improves the indentation in the function declaration,
function call, and in the assignment expressions.
2023-10-29 01:37:31 +02:00
Ronan Arraes Jardim Chagas
a07ce2155b
Fix indent. of curly expressions and of ],} in BOL (#5580) 2023-10-27 21:53:58 +09:00
Ronan Arraes Jardim Chagas
1e58a81450
Fix Julia indentation after end and with parenthesis at the beginning of line (#5579) 2023-10-27 12:28:44 +00:00
Enzo L F
a255654459
feat(julia): added missing String and AbstractString builtin types (#5440)
* feat(julia): added missing String and AbstractString builtin types

* feat(juia): added all public built-in types in Core and Base

* feat(julia): removed private types from built-in type list
2023-09-27 11:50:57 +09:00
Loong
b6492f41c4 fix(julia): fix highlighting end keyword 2023-09-09 22:42:53 +02:00
Sergio A. Vargas
3fbf513829
feat(julia): spell-check docstrings
Enable spell checking of docstrings without markdown injections.
2023-08-16 16:30:59 -04: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
Sergio Alejandro Vargas
5be3ddeadd fix(julia): symbol highlighting
Update the `@symbol` capture to enable highlighting symbols
differently from variables.

See https://github.com/tree-sitter/tree-sitter-julia/issues/110
2023-07-24 21:33:47 +02:00
Long Wang
b4b94ec387 feat(julia): highlight docstrings before short function definitions 2023-07-11 21:40:37 +02:00
Sergio Alejandro Vargas
dcf46d07cc Update Julia queries 2023-07-08 11:24:01 +02:00
Amaan Qureshi
85330918f0 perf: remove match where possible 2023-04-21 18:24:17 -04: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
Amaan Qureshi
1012dd957e feat(julia): add builtin functions & types 2023-03-10 03:38:23 -05:00
Amaan Qureshi
8886384244 feat(julia): mark begin & end in an index or range expression as @variable.builtin 2023-03-10 03:38:23 -05:00
Amaan Qureshi
9c7fa77f14 fix(julia): refactor some operators and punctuation 2023-03-10 03:38:23 -05:00
Amaan Qureshi
95bcd6a8fa feat: add @string.documentation where applicable 2023-03-05 17:15:32 -05:00
Sergio Alejandro Vargas
4301040bbc feat(julia/highlights): Add as keyword 2023-02-03 14:29:30 -08:00
Sergio A. Vargas
4895c2133f
julia: add if_clause (#4204)
* fix(julia/highlights): Add `if_clause`

* Update Julia lockfile revision
2023-01-23 08:14:30 +00:00
Sergio A. Vargas
0cb637ca9f
julia: update parser and highlights (#4035)
- Update patterns for type definitions:
  The grammar was updated to parse `abstract type` and `primitive type`
  as a single token.
- Update @symbol capture to highlight quoted operators as symbols.
- Add pattern to highlight adjoint operator.
- Update patterns and captures for:
  - "keyword" operators (in, isa, where)
  - type operators (<:, >:)
  - Parametrized types.
2022-12-27 10:27:22 +01:00
Sergio A. Vargas
82cff67988
julia: update parser and highlights (#4016)
- Replace `scoped_identifier` with `field_expression` in function names
- Replace true and false with `boolean_literal`
2022-12-23 10:34:24 +01:00
Sergio A. Vargas
d31c71c959
julia: update queries to parser change (#3956) 2022-12-14 09:06:08 +01:00
Christian Clason
360315540c fix(julia): update queries to parser change 2022-12-03 12:00:27 +01:00
Stephan Seitz
d6a2ecb8b7 highlights: create subscoping for ternary operator
After https://github.com/nvim-treesitter/nvim-treesitter/issues/470,
we decided to use `@conditional` for ternary operator instead of
operator despite `@conditional` is documented for keywords only.
A sub-scoping can make it easier for people to highlight this operator
group differently.

Also unify the usage of `@conditional...` across languages.
2022-12-02 21:42:11 +01:00
ObserverOfTime
e973a5cbb2 injections(julia): add markdown 2022-11-27 17:35:10 +01:00
ObserverOfTime
9018fb26cc injections: add more regex injections 2022-11-27 17:35:10 +01:00