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

Add indent and fold files to mermaid #6100

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

aareman
Copy link

@aareman aareman commented Feb 14, 2024

I added basic indentation and folding to mermaid files. The language only had highlights previously. (I think there is room for markdown injections by node names, but I wasn't planning to add that here)

First time contributing here, I read the Contributing.md file and still need to run the formatting scripts. Please let me know if there is anything else I need to change.


Thank you for this amazing plugin. 🙂

@clason
Copy link
Contributor

clason commented Feb 21, 2024

The mermaid queries are currently orphaned. Would you like to volunteer as maintainer?


[
"end"
] @indent.branch
Copy link
Member

@lucario387 lucario387 Feb 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@indent.end seems to be missing here.

Also you need to run ./scripts/format-queries.lua queries/mermaid

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@indent.end seems to be missing here.

I'm not sure what you mean here. Is @indent.end a required part of an indent query in neovim (I didn't see that in the docs)? By making it branch it does the following

flowchart BT
  subgraph DA
    direction BT
    a --> b
  end
flowchart BT
  subgraph DA
    direction BT
    a --> b
  end

In terms of the "end" of the first indent. There appears to be no "end" in mermaid js, since I think its one chart per file. And the TS Query Tree is rooted at document. I can't find anything contrary to this with some cursory looking. (I mostly use it in markdown -- one chart per code block)

Also you need to run ./scripts/format-queries.lua queries/mermaid

I was waiting to do this until I knew that I had a general direction to get the pr going.

@aareman
Copy link
Author

aareman commented Feb 21, 2024

The mermaid queries are currently orphaned. Would you like to volunteer as maintainer?

What would that entail? I would potentially be interested.

@lucario387
Copy link
Member

lucario387 commented Feb 21, 2024

What would that entail

Expected to be pinged and to have some responsiblity in fixing things when some mermaid changes happen that breaks the current queries.

@lucario387
Copy link
Member

Also, this PR is only for flowgraph and subgraph of mermaid, is it correct? What about the other mermaid graphs, do they not exist in the queries?

@clason
Copy link
Contributor

clason commented Feb 21, 2024

What would that entail

Expected to be pinged and to have some responsiblity in fixing things when some mermaid changes happen that breaks the current queries.

And ideally be proactive: monitor the mermaid parser and make PRs to adapt or extend the queries here before our CI fails. (Especially the latter -- if there are new nodes or such which queries need to be rewritten to make use of; our CI catches breaking changes but not possible improvements.)

As to "how": just add yourself as a maintainer in lua/nvim-treesitter/parsers.lua and remove the "experimental".

@aareman
Copy link
Author

aareman commented Feb 21, 2024

Also, this PR is only for flowgraph and subgraph of mermaid, is it correct? What about the other mermaid graphs, do they not exist in the queries?

That is a good point. I was thinking that there are other graphs. I can add them to the list.

I converted this PR to a draft till I make those changes

@aareman aareman marked this pull request as draft February 21, 2024 20:36
@aareman aareman marked this pull request as ready for review February 26, 2024 20:25
@aareman
Copy link
Author

aareman commented Feb 26, 2024

Added other graph types And fixed all linting/formatting issues.

I'm going to pass, for now, on the maintainer position for mermaid.

(diagram_sequence)
(diagram_class)
(diagram_state)
(diagram_gantt)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this indent the section part in a gantt chart

gantt
    title A Gantt Diagram
    dateFormat YYYY-MM-DD
    section Section
        A task          :a1, 2014-01-01, 30d
        Another task    :after a1, 20d
    section Another
        Task in Another :2014-01-12, 12d
        another task    :24d

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.

None yet

3 participants