Stream: contributing

Topic: Zed extension: roc tree sitter build error


view this post on Zulip Alf Richter (Apr 28 2024 at 16:09):

@Eli Dowling the Zed Extensions CI gives following error:
image.png
https://github.com/zed-industries/extensions/actions/runs/8860237363/job/24335434614

view this post on Zulip Eli Dowling (Apr 28 2024 at 22:28):

Okay, so that's going to be because just like helix and neovim zed supports it's own specific selection of tree sitter queries. The default ones inside the tree-sitter-roc repo are from Helix and I imagine zed probably matches that closely but we'll have to either find documentation for the queries that z supports or just go by trial and error removing the ones that don't work for now

view this post on Zulip Eli Dowling (Apr 28 2024 at 22:28):

I'd love to help you but unfortunately zed it's completely borked on Linux for me :(

view this post on Zulip Alf Richter (Apr 28 2024 at 22:42):

We could try to run their CI scripts inside of the your tree sitter or the my zed-roc repo, so we would at least get the errors step by step.

view this post on Zulip Eli Dowling (Apr 28 2024 at 22:48):

You get the errors when you load the plugin in zed if you run zed from the CLI

view this post on Zulip Eli Dowling (Apr 28 2024 at 22:48):

I was able to get that far on my Linux setup

view this post on Zulip Eli Dowling (Apr 28 2024 at 22:48):

I was able to get that far on my Linux setup test

view this post on Zulip Alf Richter (Apr 30 2024 at 07:29):

@Eli Dowling: I have build the zed extension cli tool locally on my ARM Mac, they are using the tool in the CI Build. It’s included as create in the main zed.git, but only published for x86 Linux. I’ll try to detect the problematic queries and mark these, bc. I have no clue about tree sitter and queries atm. :)

view this post on Zulip dwyd (Apr 30 2024 at 13:57):

Commenting out the following lines got it "working" for me on arm mac.

# highlights.scm
(backpassing_expr assignee: (identifier_pattern (identifier) @parameter.definition))
;----function invocations ----
(function_call_expr
  caller:  (variable_expr
      (identifier)@function))

(function_call_expr
  caller: (field_access_expr (identifier)@function .))

; pattern captures
(when_is_branch pattern: (_ (identifier_pattern (identifier) @variable.parameter)))

# indents.scm
;;It's annoying when pipelines automatically dedent this pervents that
(expr_body
    result: (bin_op_expr)
)@extend

;this automatically dedents, this may be more annying than helpful when writing pipelines
(expr_body
    result: (_)
) @extend.prevent-once

# injections.scm
;injection from piping function calls
(bin_op_expr
part: (const
    [(multiline_string)(string)] @injection.content)
part: (operator)
part: (variable_expr
  (identifier)@injection.language))

Logs all displayed the error message of Impossible pattern

# example
Error loading highlights query

Caused by:
    Query error at 143:19. Impossible pattern:
    (backpassing_expr assignee: (identifier_pattern (identifier) @parameter.definition))

view this post on Zulip Eli Dowling (Apr 30 2024 at 22:53):

Lovely! I'll look into this when I get some time :)

view this post on Zulip Eli Dowling (May 01 2024 at 07:15):

Okay I think this is now a fixed issue I updated my version of zed and it's working fine. It seems like at some point zed didn't support part of the query syntax and now it does. Using @Alf Richter's extension worked well for me

view this post on Zulip dwyd (May 01 2024 at 17:08):

Thank you both! Seems to be working for me too. Pulled down the latest changes and I don't see any errors in the Zed log when rebuilding.

view this post on Zulip Alf Richter (May 01 2024 at 17:52):

I've triggered a new build of my PR
https://github.com/zed-industries/extensions/pull/432
If this CI/CD run is successful, then the roc extension should be installable as normal zed plugin.

view this post on Zulip Richard Feldman (May 01 2024 at 18:15):

yeah I forgot to mention, this has been working well for me too!


Last updated: Jul 06 2025 at 12:14 UTC