Skip to content
This repository was archived by the owner on Sep 2, 2020. It is now read-only.

Support for 'textDocument/hover' #217

Merged
merged 2 commits into from
Apr 5, 2018
Merged

Conversation

lostplan
Copy link
Collaborator

Display field type & description information (logic ported from
graphql/codemirror-graphql)

Fixes: #216

* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
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 have specified the wrong licence I think. graphql/codemirror-graphql is under BSD, which requires redistributions (including those with modifications) to follow the same.

Thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

We should change all license info to MIT (I believe we had a very interesting series of events because of this 😃). I haven't changed licensing info for graphql-language-service and codemirror-graphql just yet.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That would be a worthwhile effort.

Copy link
Contributor

@asiandrummer asiandrummer left a comment

Choose a reason for hiding this comment

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

It's completely okay to have codemirror-graphql export info.js and reuse that instead of porting the file here. Would that be a more suitable approach?

@@ -46,6 +46,8 @@ import {

import {parse, print} from 'graphql';
import {getAutocompleteSuggestions} from './getAutocompleteSuggestions';
import {getHoverInformation} from './getHoverInformation';
import type {Hover} from 'vscode-languageserver-types';
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't have a good lint rule set up for this, but I'd encourage including type imports on the top of the list of imports.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

filePath: Uri,
): Promise<Hover.contents> {
const projectConfig = this._graphQLConfig.getConfigForFile(filePath);
const schema = await this._graphQLCache
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as the last PR here - could we defer fetching schema until we're absolutely in need of one?

Copy link
Collaborator Author

@lostplan lostplan Apr 4, 2018

Choose a reason for hiding this comment

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

This is about as late as we can leave it – at this point the MessageProcessor has already validated that the hover position contains a graphql document

* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
Copy link
Contributor

Choose a reason for hiding this comment

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

We should change all license info to MIT (I believe we had a very interesting series of events because of this 😃). I haven't changed licensing info for graphql-language-service and codemirror-graphql just yet.

Display field type & description information (logic ported from
graphql/codemirror-graphql)
@lostplan
Copy link
Collaborator Author

lostplan commented Apr 4, 2018

I'll investigate consolidating hover rendering logic between this repo and codemirror-graphql separately to this change. I think it would make sense for canonical logic to live in this repo.

@lostplan lostplan merged commit 123825d into graphql:master Apr 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants