fix(graphql-language-service): fix off by one on hover#3882
fix(graphql-language-service): fix off by one on hover#3882bensengupta wants to merge 5 commits intographql:mainfrom
Conversation
🦋 Changeset detectedLatest commit: 14cca83 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
|
Seems like there is a race condition in the tests. Am unable to reproduce test failure locally. Maybe replace this graphiql/packages/graphql-language-service-server/src/MessageProcessor.ts Lines 142 to 144 in b495159 with this? try {
void mkdirSync(this._tmpDirBase);
} catch (err) {
if (err instanceof Error && 'code' in err && err.code === 'EEXIST') {
return;
}
throw err;
} |
| schema: GraphQLSchema, | ||
| contextToken?: ContextToken, | ||
| options?: { mode?: GraphQLDocumentMode; uri?: string }, | ||
| offset = 0, |
There was a problem hiding this comment.
Just to explain this change: getContextAtPosition is used in 2 places:
In getHoverInformation, the offset needs to be changed to 0 to fix the off-by-one problem on hover.
In getAutocompleteSuggestions, the offset needs to be kept at 1 as the current behavior is correct.
|
Hey @acao @dimaMachina, any chance one of you could have a look? |
Hey, thanks for making this! This PR fixes a small off-by-one issue when hovering.
Details
I am using graphql-language-service-cli in Neovim. The issue is illustrated below:Hover, no information (incorrect, should show info)




Hover, shows information (correct)
Hover, shows information (incorrect, should not show info)
Hover, no information (correct)