Socket
Socket
Sign inDemoInstall

graphql-language-service-interface

Package Overview
Dependencies
Maintainers
13
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-language-service-interface - npm Package Compare versions

Comparing version 2.9.5-canary-fea49557.0 to 2.9.5

5

dist/getHoverInformation.d.ts

@@ -5,3 +5,6 @@ import { GraphQLSchema } from 'graphql';

import { Hover } from 'vscode-languageserver-types';
export declare function getHoverInformation(schema: GraphQLSchema, queryText: string, cursor: IPosition, contextToken?: ContextToken): Hover['contents'];
export declare type HoverConfig = {
useMarkdown?: boolean;
};
export declare function getHoverInformation(schema: GraphQLSchema, queryText: string, cursor: IPosition, contextToken?: ContextToken, config?: HoverConfig): Hover['contents'];
//# sourceMappingURL=getHoverInformation.d.ts.map

24

dist/getHoverInformation.js

@@ -6,3 +6,3 @@ "use strict";

const getAutocompleteSuggestions_1 = require("./getAutocompleteSuggestions");
function getHoverInformation(schema, queryText, cursor, contextToken) {
function getHoverInformation(schema, queryText, cursor, contextToken, config) {
const token = contextToken || getAutocompleteSuggestions_1.getTokenAtPosition(queryText, cursor);

@@ -16,7 +16,9 @@ if (!schema || !token || !token.state) {

const typeInfo = getAutocompleteSuggestions_1.getTypeInfo(schema, token.state);
const options = { schema };
const options = Object.assign(Object.assign({}, config), { schema });
if ((kind === 'Field' && step === 0 && typeInfo.fieldDef) ||
(kind === 'AliasedField' && step === 2 && typeInfo.fieldDef)) {
const into = [];
renderMdCodeStart(into, options);
renderField(into, typeInfo, options);
renderMdCodeEnd(into, options);
renderDescription(into, options, typeInfo.fieldDef);

@@ -27,3 +29,5 @@ return into.join('').trim();

const into = [];
renderMdCodeStart(into, options);
renderDirective(into, typeInfo, options);
renderMdCodeEnd(into, options);
renderDescription(into, options, typeInfo.directiveDef);

@@ -34,3 +38,5 @@ return into.join('').trim();

const into = [];
renderMdCodeStart(into, options);
renderArg(into, typeInfo, options);
renderMdCodeEnd(into, options);
renderDescription(into, options, typeInfo.argDef);

@@ -43,3 +49,5 @@ return into.join('').trim();

const into = [];
renderMdCodeStart(into, options);
renderEnumValue(into, typeInfo, options);
renderMdCodeEnd(into, options);
renderDescription(into, options, typeInfo.enumValue);

@@ -52,3 +60,5 @@ return into.join('').trim();

const into = [];
renderMdCodeStart(into, options);
renderType(into, typeInfo, options, typeInfo.type);
renderMdCodeEnd(into, options);
renderDescription(into, options, typeInfo.type);

@@ -60,2 +70,12 @@ return into.join('').trim();

exports.getHoverInformation = getHoverInformation;
function renderMdCodeStart(into, options) {
if (options.useMarkdown) {
text(into, '```graphql\n');
}
}
function renderMdCodeEnd(into, options) {
if (options.useMarkdown) {
text(into, '\n```');
}
}
function renderField(into, typeInfo, options) {

@@ -62,0 +82,0 @@ renderQualifiedField(into, typeInfo, options);

@@ -5,2 +5,3 @@ import { DocumentNode, FragmentSpreadNode, NamedTypeNode } from 'graphql';

import { Hover, SymbolInformation } from 'vscode-languageserver-types';
import { HoverConfig } from './getHoverInformation';
import { DefinitionQueryResult } from './getDefinition';

@@ -14,3 +15,3 @@ export declare class GraphQLLanguageService {

getAutocompleteSuggestions(query: string, position: IPosition, filePath: Uri): Promise<Array<CompletionItem>>;
getHoverInformation(query: string, position: IPosition, filePath: Uri): Promise<Hover['contents']>;
getHoverInformation(query: string, position: IPosition, filePath: Uri, options?: HoverConfig): Promise<Hover['contents']>;
getDefinition(query: string, position: IPosition, filePath: Uri): Promise<DefinitionQueryResult | null>;

@@ -17,0 +18,0 @@ getDocumentSymbols(document: string, filePath: Uri): Promise<SymbolInformation[]>;

@@ -136,3 +136,3 @@ "use strict";

}
getHoverInformation(query, position, filePath) {
getHoverInformation(query, position, filePath, options) {
return __awaiter(this, void 0, void 0, function* () {

@@ -142,3 +142,3 @@ const projectConfig = this.getConfigForURI(filePath);

if (schema) {
return getHoverInformation_1.getHoverInformation(schema, query, position);
return getHoverInformation_1.getHoverInformation(schema, query, position, undefined, options);
}

@@ -145,0 +145,0 @@ return '';

@@ -5,3 +5,6 @@ import { GraphQLSchema } from 'graphql';

import { Hover } from 'vscode-languageserver-types';
export declare function getHoverInformation(schema: GraphQLSchema, queryText: string, cursor: IPosition, contextToken?: ContextToken): Hover['contents'];
export declare type HoverConfig = {
useMarkdown?: boolean;
};
export declare function getHoverInformation(schema: GraphQLSchema, queryText: string, cursor: IPosition, contextToken?: ContextToken, config?: HoverConfig): Hover['contents'];
//# sourceMappingURL=getHoverInformation.d.ts.map
import { GraphQLNonNull, GraphQLList, } from 'graphql';
import { getTokenAtPosition, getTypeInfo } from './getAutocompleteSuggestions';
export function getHoverInformation(schema, queryText, cursor, contextToken) {
export function getHoverInformation(schema, queryText, cursor, contextToken, config) {
const token = contextToken || getTokenAtPosition(queryText, cursor);

@@ -12,7 +12,9 @@ if (!schema || !token || !token.state) {

const typeInfo = getTypeInfo(schema, token.state);
const options = { schema };
const options = Object.assign(Object.assign({}, config), { schema });
if ((kind === 'Field' && step === 0 && typeInfo.fieldDef) ||
(kind === 'AliasedField' && step === 2 && typeInfo.fieldDef)) {
const into = [];
renderMdCodeStart(into, options);
renderField(into, typeInfo, options);
renderMdCodeEnd(into, options);
renderDescription(into, options, typeInfo.fieldDef);

@@ -23,3 +25,5 @@ return into.join('').trim();

const into = [];
renderMdCodeStart(into, options);
renderDirective(into, typeInfo, options);
renderMdCodeEnd(into, options);
renderDescription(into, options, typeInfo.directiveDef);

@@ -30,3 +34,5 @@ return into.join('').trim();

const into = [];
renderMdCodeStart(into, options);
renderArg(into, typeInfo, options);
renderMdCodeEnd(into, options);
renderDescription(into, options, typeInfo.argDef);

@@ -39,3 +45,5 @@ return into.join('').trim();

const into = [];
renderMdCodeStart(into, options);
renderEnumValue(into, typeInfo, options);
renderMdCodeEnd(into, options);
renderDescription(into, options, typeInfo.enumValue);

@@ -48,3 +56,5 @@ return into.join('').trim();

const into = [];
renderMdCodeStart(into, options);
renderType(into, typeInfo, options, typeInfo.type);
renderMdCodeEnd(into, options);
renderDescription(into, options, typeInfo.type);

@@ -55,2 +65,12 @@ return into.join('').trim();

}
function renderMdCodeStart(into, options) {
if (options.useMarkdown) {
text(into, '```graphql\n');
}
}
function renderMdCodeEnd(into, options) {
if (options.useMarkdown) {
text(into, '\n```');
}
}
function renderField(into, typeInfo, options) {

@@ -57,0 +77,0 @@ renderQualifiedField(into, typeInfo, options);

@@ -5,2 +5,3 @@ import { DocumentNode, FragmentSpreadNode, NamedTypeNode } from 'graphql';

import { Hover, SymbolInformation } from 'vscode-languageserver-types';
import { HoverConfig } from './getHoverInformation';
import { DefinitionQueryResult } from './getDefinition';

@@ -14,3 +15,3 @@ export declare class GraphQLLanguageService {

getAutocompleteSuggestions(query: string, position: IPosition, filePath: Uri): Promise<Array<CompletionItem>>;
getHoverInformation(query: string, position: IPosition, filePath: Uri): Promise<Hover['contents']>;
getHoverInformation(query: string, position: IPosition, filePath: Uri, options?: HoverConfig): Promise<Hover['contents']>;
getDefinition(query: string, position: IPosition, filePath: Uri): Promise<DefinitionQueryResult | null>;

@@ -17,0 +18,0 @@ getDocumentSymbols(document: string, filePath: Uri): Promise<SymbolInformation[]>;

@@ -133,3 +133,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

}
getHoverInformation(query, position, filePath) {
getHoverInformation(query, position, filePath, options) {
return __awaiter(this, void 0, void 0, function* () {

@@ -139,3 +139,3 @@ const projectConfig = this.getConfigForURI(filePath);

if (schema) {
return getHoverInformation(schema, query, position);
return getHoverInformation(schema, query, position, undefined, options);
}

@@ -142,0 +142,0 @@ return '';

{
"name": "graphql-language-service-interface",
"version": "2.9.5-canary-fea49557.0",
"version": "2.9.5",
"description": "Interface to the GraphQL Language Service",

@@ -5,0 +5,0 @@ "contributors": [

@@ -159,14 +159,16 @@ /**

token,
argDefs.map((argDef: GraphQLArgument): CompletionItem => ({
label: argDef.name,
insertText: argDef.name + ': ',
command: {
command: 'editor.action.triggerSuggest',
title: 'Suggestions',
},
detail: String(argDef.type),
documentation: argDef.description ?? undefined,
kind: CompletionItemKind.Variable,
type: argDef.type,
})),
argDefs.map(
(argDef: GraphQLArgument): CompletionItem => ({
label: argDef.name,
insertText: argDef.name + ': ',
command: {
command: 'editor.action.triggerSuggest',
title: 'Suggestions',
},
detail: String(argDef.type),
documentation: argDef.description ?? undefined,
kind: CompletionItemKind.Variable,
type: argDef.type,
}),
),
);

@@ -173,0 +175,0 @@ }

@@ -29,2 +29,4 @@ /**

export type HoverConfig = { useMarkdown?: boolean };
export function getHoverInformation(

@@ -35,2 +37,3 @@ schema: GraphQLSchema,

contextToken?: ContextToken,
config?: HoverConfig,
): Hover['contents'] {

@@ -47,3 +50,3 @@ const token = contextToken || getTokenAtPosition(queryText, cursor);

const typeInfo = getTypeInfo(schema, token.state);
const options = { schema };
const options = { ...config, schema };

@@ -58,3 +61,5 @@ // Given a Schema and a Token, produce the contents of an info tooltip.

const into: string[] = [];
renderMdCodeStart(into, options);
renderField(into, typeInfo, options);
renderMdCodeEnd(into, options);
renderDescription(into, options, typeInfo.fieldDef);

@@ -64,3 +69,5 @@ return into.join('').trim();

const into: string[] = [];
renderMdCodeStart(into, options);
renderDirective(into, typeInfo, options);
renderMdCodeEnd(into, options);
renderDescription(into, options, typeInfo.directiveDef);

@@ -70,3 +77,5 @@ return into.join('').trim();

const into: string[] = [];
renderMdCodeStart(into, options);
renderArg(into, typeInfo, options);
renderMdCodeEnd(into, options);
renderDescription(into, options, typeInfo.argDef);

@@ -80,3 +89,5 @@ return into.join('').trim();

const into: string[] = [];
renderMdCodeStart(into, options);
renderEnumValue(into, typeInfo, options);
renderMdCodeEnd(into, options);
renderDescription(into, options, typeInfo.enumValue);

@@ -90,3 +101,5 @@ return into.join('').trim();

const into: string[] = [];
renderMdCodeStart(into, options);
renderType(into, typeInfo, options, typeInfo.type);
renderMdCodeEnd(into, options);
renderDescription(into, options, typeInfo.type);

@@ -98,2 +111,13 @@ return into.join('').trim();

function renderMdCodeStart(into: string[], options: any) {
if (options.useMarkdown) {
text(into, '```graphql\n');
}
}
function renderMdCodeEnd(into: string[], options: any) {
if (options.useMarkdown) {
text(into, '\n```');
}
}
function renderField(into: string[], typeInfo: AllTypeInfo, options: any) {

@@ -180,2 +204,3 @@ renderQualifiedField(into, typeInfo, options);

}
if (t instanceof GraphQLNonNull) {

@@ -182,0 +207,0 @@ renderType(into, typeInfo, options, t.ofType);

@@ -38,3 +38,3 @@ /**

import { getAutocompleteSuggestions } from './getAutocompleteSuggestions';
import { getHoverInformation } from './getHoverInformation';
import { getHoverInformation, HoverConfig } from './getHoverInformation';
import { validateQuery, getRange, DIAGNOSTIC_SEVERITY } from './getDiagnostics';

@@ -254,2 +254,3 @@ import {

filePath: Uri,
options?: HoverConfig,
): Promise<Hover['contents']> {

@@ -260,3 +261,3 @@ const projectConfig = this.getConfigForURI(filePath);

if (schema) {
return getHoverInformation(schema, query, position);
return getHoverInformation(schema, query, position, undefined, options);
}

@@ -263,0 +264,0 @@ return '';

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc