Skip to content

Migrate markdown scopes #2043

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

Merged
merged 2 commits into from
Nov 26, 2023
Merged

Migrate markdown scopes #2043

merged 2 commits into from
Nov 26, 2023

Conversation

AndreasArvidsson
Copy link
Member

@AndreasArvidsson AndreasArvidsson commented Nov 20, 2023

Checklist

  • [-] I have added tests
  • [-] I have updated the docs and cheatsheet
  • [-] I have not broken the cheatsheet

@AndreasArvidsson AndreasArvidsson added lang-markdown Support for the Markdown family of markup languages scope-migration Migrating scopes to next-gen scope implementation labels Nov 20, 2023
Comment on lines +13 to +19
(section
(atx_heading
(_)
heading_content: (_) @name
) @_.removal
(#shrink-to-match! @name "^\\s*(?<keep>.*)$")
) @_.domain
Copy link
Member

Choose a reason for hiding this comment

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

Huh is it really this simple? I guess I only needed the leading sibling finder for when we were searching for a section heading of a specific level? If so I'd be tempted to just drop support for specific levels; I can't imagine anyone is using that 🤷‍♂️

Copy link
Member

Choose a reason for hiding this comment

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

Oh I guess this is technically wrong. I believe "grand name" would be incorrect, because the domain should include all subheadings

Copy link
Member Author

Choose a reason for hiding this comment

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

All the test passed. That was kind of my benchmark.

I would be happy to drop the specific section levels.

I think that is something we can worry about when we try to implement that logic?

Copy link
Member Author

Choose a reason for hiding this comment

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

Already looks like subsections are nested

(document
  (section
    (atx_heading
      (atx_h1_marker)
      heading_content: (inline)
    )
    (paragraph
      (inline)
    )
    (section
      (atx_heading
        (atx_h2_marker)
        heading_content: (inline)
      )
      (paragraph
        (inline)
      )
    )
  )
)

Copy link
Member

Choose a reason for hiding this comment

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

Oh amazing. I believe all that sibling logic is a holdover from the old markdown parser we used to use then. We should be able to drop most of that and do something much simpler now

@pokey pokey added this pull request to the merge queue Nov 26, 2023
Merged via the queue into main with commit 41cf78d Nov 26, 2023
@pokey pokey deleted the markdown_migration branch November 26, 2023 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang-markdown Support for the Markdown family of markup languages scope-migration Migrating scopes to next-gen scope implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants