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

fix: off-by-one error in token range (regression in #15). #244

Merged
merged 4 commits into from
Feb 28, 2024

Conversation

llllvvuu
Copy link
Contributor

@llllvvuu llllvvuu commented Feb 27, 2024

Should consistently use stream.getStartOfToken() + 1. Added some e2e tests to ensure that the regression in #15 is resolved without regressing #190.

Copy link

changeset-bot bot commented Feb 27, 2024

🦋 Changeset detected

Latest commit: 8f3b6cd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@0no-co/graphqlsp Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

This was referenced Feb 27, 2024
@@ -9,5 +9,11 @@ const PostsQuery = gql`
}
`;

const Regression190 = gql`
Copy link
Member

Choose a reason for hiding this comment

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

Does this also fail for graphql() function invocations?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It does, yeah. Want me to add that to the fixture as well? I pushed a fix btw!

Copy link
Member

Choose a reason for hiding this comment

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

Would love a fixture in the tada one as we're slowly moving more towards the function invocation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To clarify, Regression190 succeeds on main, but Regression15 does not. Regression190 is there to ensure that I didn't break #190 again while fixing #15.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would love a fixture in the tada one as we're slowly moving more towards the function invocation

Sure! One sec

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added!

Should consistently use `stream.getStartOfToken() + 1`. Added some e2e
tests to ensure that the regression in 0no-co#15 is resolved without
regressing 0no-co#190.
@llllvvuu llllvvuu changed the title test: regression tests for #15 and #190 fix: off-by-one error in token range (regression in #15). Feb 27, 2024
@llllvvuu llllvvuu marked this pull request as ready for review February 27, 2024 08:41
Copy link
Member

@JoviDeCroock JoviDeCroock left a comment

Choose a reason for hiding this comment

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

This looks good, thank you so much for taking your time to fix this. Just needs a changeset

server.send({
seq: 9,
type: 'request',
command: 'quickinfo',
arguments: {
file: testFile,
line: 5,
offset: 7,
Copy link
Member

Choose a reason for hiding this comment

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

I assume 7 still works, just clarifying

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It does, yeah, I just changed it to make it a tricker case

@llllvvuu llllvvuu marked this pull request as draft February 27, 2024 09:10
@llllvvuu
Copy link
Contributor Author

Changeset added 👍

@llllvvuu llllvvuu marked this pull request as ready for review February 27, 2024 09:38
Co-authored-by: Jovi De Croock <decroockjovi@gmail.com>
@JoviDeCroock JoviDeCroock merged commit 183e5f0 into 0no-co:main Feb 28, 2024
1 check passed
@github-actions github-actions bot mentioned this pull request Feb 28, 2024
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.

2 participants