Skip to content

Conversation

@ckipp01
Copy link
Collaborator

@ckipp01 ckipp01 commented Jan 18, 2023

This PR starts testing against the highlights that nvim-treesitter has
defined to ensure we don't break things without warning. The general
flow is as follows:

  • When on linux we clone nvim-treesitter
  • After all of our initial testing we copy the queries that they have
    defined
  • If they differ, we run our highlight tests against them
  • We also issue a warning that the highlights have diverged (more than
    likely this will fail the highlighting tests anyways)

This is in ref to #136. @keynmol let me know if this is what you had in mind.

@ckipp01 ckipp01 requested review from eed3si9n and keynmol January 18, 2023 12:38

- name: checkout scala/scala
if: ${{ runner.os != 'Windows' }}
if: ${{ runner.os == 'Linux' }}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not exactly related to this but I realized we are cloning this on mac as well, but not running the smoke tests on mac. So I just switched this back to only clone on the os that we actually run it on.

Copy link
Collaborator

Choose a reason for hiding this comment

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

As a separate point, I think we can extract the Linux workflow as a separate thing, and on Mac/Windows just do npm run build && npm run test.

To declutter all those if conditionals.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I can try to follow-up with another pr and clean this up.

This PR starts testing against the highlights that nvim-treesitter has
defined to ensure we don't break things without warning. The general
flow is as follows:

- When on linux we clone nvim-treesitter
- After all of our initial testing we copy the queries that they have
  defined
- If they differ, we run our highlight tests against them
- We also issue a warning that the highlights have diverged (more than
  likely this will fail the highlighting tests anyways)

This is in ref to tree-sitter#136
run: |
echo "::warning file=queries/highlights.scm::Queries in this repo are out of sync with nvim-treesitter"
git diff queries/highlights.scm
npm run test
Copy link
Collaborator

Choose a reason for hiding this comment

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

Pretty sure the answer is "yes", but for discussion sake: should we necessarily fail the job if the queries are out of date?

PRs often change tree structure, and sometimes rename nodes - which breaks queries.

My personal opinion is that we are at a point (unless there's some catastrophic parser mistake current grammar has) where we can stabilise and treat breaking changes with a lot more care.

What are you thoughts @ckipp01 and @eed3si9n ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

My personal opinion is that we are at a point (unless there's some catastrophic parser mistake current grammar has) where we can stabilise and treat breaking changes with a lot more care.

I agree, except I'd say stabilize. If a PR breaks existing queries we should try working around it by creating a dummy node, or at least know that we are in that territory.

Copy link
Collaborator

Choose a reason for hiding this comment

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

except I'd say stabilize
image

image

@ckipp01 ckipp01 merged commit 802eba3 into tree-sitter:master Jan 19, 2023
@ckipp01 ckipp01 deleted the nvim-treesitter branch January 19, 2023 14:22
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.

3 participants