Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support indents and folding #112

Closed
wants to merge 0 commits into from
Closed

Support indents and folding #112

wants to merge 0 commits into from

Conversation

yads
Copy link

@yads yads commented Jun 5, 2023

  • added indents.scm and folds.scm queries

@alexlafroscia
Copy link
Collaborator

Hey, thanks for the PR!

Is there some way to add tests for these new features, the way that the highlighting has tests?

@yads
Copy link
Author

yads commented Jun 6, 2023

I honestly have no idea how to do that. I looked at the tests directory and can't make heads or tails of what's going on. Is there somewhere you can point me to get more info?

@yads
Copy link
Author

yads commented Jun 6, 2023

Did some more digging and near as I can tell only parsing and highlights tests are supported by tree-sitter test. https://tree-sitter.github.io/tree-sitter/creating-parsers#command-test. On the plus side I'll add a locals.scm query as well.

@lougreenwood
Copy link

🎉

@yads yads mentioned this pull request Oct 16, 2023
@NullVoxPopuli
Copy link
Member

somehow I already have these in my local install? is this PR needed?

❯ echo $PWD
/home/nvp/.local/share/nvim/site/pack/packer/start/nvim-treesitter/queries/glimmer
❯ cat folds.scm indents.scm locals.scm 
───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       │ File: folds.scm
───────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ [
   2   │  (element_node (element_node_start))
   3   │  (block_statement)
   4   │ ] @fold
───────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────
───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       │ File: indents.scm
───────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ [
   2   │   (element_node (element_node_start))
   3   │   (element_node_void)
   4   │   (block_statement (block_statement_start))
   5   │   (mustache_statement)
   6   │ ] @indent.begin
   7   │ 
   8   │ (element_node (element_node_end  [">"] @indent.end))
   9   │ (element_node_void "/>" @indent.end)
  10   │ [
  11   │  ">"
  12   │  "/>"
  13   │  "</"
  14   │  "{{/"
  15   │  "}}"
  16   │ ] @indent.branch
  17   │ 
  18   │ (mustache_statement
  19   │   (helper_invocation helper: (identifier) @_identifier (#eq? @_identifier "else"))
  20   │   ) @indent.branch
  21   │ (mustache_statement ((identifier) @_identifier (#eq? @_identifier "else"))) @indent.branch
  22   │ (comment_statement) @indent.ignore
───────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────
───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       │ File: locals.scm
───────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ [
   2   │  (element_node)
   3   │  (block_statement)
   4   │ ] @scope
   5   │ 
   6   │ (identifier) @reference
   7   │ (block_params (identifier) @definition.var)
───────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────

@yads
Copy link
Author

yads commented Oct 26, 2023

So technically it isn't because I submitted these changes to treesitter directly nvim-treesitter/nvim-treesitter@0ae4942 However, it would be good to have these merged into the main repo for glimmer imo.

@NullVoxPopuli
Copy link
Member

NullVoxPopuli commented Oct 26, 2023

I'm a newb and I don't know anything, so what's the advantage of having files here vs there? <3

@yads
Copy link
Author

yads commented Oct 26, 2023 via email

@NullVoxPopuli
Copy link
Member

@alexlafroscia can we merge and release?

@NullVoxPopuli
Copy link
Member

hm.. this was not intended to be closed.

I tried rebasing the branch, and I guess something went wrong?

NullVoxPopuli added a commit that referenced this pull request Mar 16, 2024
Copies over the contents from the original PR here: #112
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants