How to use the graphql-language-service-interface.getHoverInformation function in graphql-language-service-interface

To help you get started, we’ve selected a few graphql-language-service-interface examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github graphql / graphiql / packages / monaco-graphql / src / monaco-graphql-query.ts View on Github external
export async function provideHoverInfo({
  position,
  model,
  schema
}: ProviderItemInput): Promise {
  const graphQLPosition = new GraphQLPosition(
    position.lineNumber - 1,
    position.column,
  );
  graphQLPosition.setCharacter(position.column);
  graphQLPosition.line = position.lineNumber - 1;
  const hoverInfo = getHoverInformation(
    schema,
    model.getValue(),
    graphQLPosition,
  );
  if (!hoverInfo) {
    return {
      contents: [],
    };
  }
  return {
    contents: [{ value: `${hoverInfo}` }],
  };
}