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-6f6c49b0.0 to 2.9.5-canary-fea49557.0

4

CHANGELOG.md
# graphql-language-service-interface
## 2.9.5-canary-6f6c49b0.0
## 2.9.5-canary-fea49557.0
### Patch Changes
- [`992640e8`](https://github.com/graphql/graphiql/commit/992640e8c1d93b025679219e763bde6127522fd4) [#2070](https://github.com/graphql/graphiql/pull/2070) Thanks [@acao](https://github.com/acao)! - Fix a bug with variable completion with or without `# graphql-language-service-interface across the ecosytem. Introduce more triggerCharacters for fun!
- [`a3368e00`](https://github.com/graphql/graphiql/commit/a3368e00f408c4108595c10bad1cb00e1cc71f7f) [#2070](https://github.com/graphql/graphiql/pull/2070) Thanks [@acao](https://github.com/acao)! - Fix a bug with variable completion with or without `# graphql-language-service-interface across the ecosytem. Introduce more triggerCharacters for fun!

@@ -9,0 +9,0 @@ ## 2.9.4

@@ -55,6 +55,11 @@ "use strict";

if (argDefs) {
return autocompleteUtils_1.hintList(token, argDefs.map(argDef => {
return autocompleteUtils_1.hintList(token, argDefs.map((argDef) => {
var _a;
return ({
label: argDef.name,
insertText: argDef.name + ': ',
command: {
command: 'editor.action.triggerSuggest',
title: 'Suggestions',
},
detail: String(argDef.type),

@@ -332,10 +337,10 @@ documentation: (_a = argDef.description) !== null && _a !== void 0 ? _a : undefined,

function getVariableCompletions(queryText, schema, token) {
let variableName;
let variableName = null;
let variableType;
const definitions = Object.create({});
runOnlineParser(queryText, (_, state) => {
if (state.kind === graphql_language_service_parser_1.RuleKinds.VARIABLE && state.name) {
if ((state === null || state === void 0 ? void 0 : state.kind) === graphql_language_service_parser_1.RuleKinds.VARIABLE && state.name) {
variableName = state.name;
}
if (state.kind === graphql_language_service_parser_1.RuleKinds.NAMED_TYPE && variableName) {
if ((state === null || state === void 0 ? void 0 : state.kind) === graphql_language_service_parser_1.RuleKinds.NAMED_TYPE && variableName) {
const parentDefinition = getParentDefinition(state, graphql_language_service_parser_1.RuleKinds.TYPE);

@@ -342,0 +347,0 @@ if (parentDefinition === null || parentDefinition === void 0 ? void 0 : parentDefinition.type) {

@@ -52,6 +52,11 @@ import { CompletionItemKind } from 'vscode-languageserver-types';

if (argDefs) {
return hintList(token, argDefs.map(argDef => {
return hintList(token, argDefs.map((argDef) => {
var _a;
return ({
label: argDef.name,
insertText: argDef.name + ': ',
command: {
command: 'editor.action.triggerSuggest',
title: 'Suggestions',
},
detail: String(argDef.type),

@@ -328,10 +333,10 @@ documentation: (_a = argDef.description) !== null && _a !== void 0 ? _a : undefined,

export function getVariableCompletions(queryText, schema, token) {
let variableName;
let variableName = null;
let variableType;
const definitions = Object.create({});
runOnlineParser(queryText, (_, state) => {
if (state.kind === RuleKinds.VARIABLE && state.name) {
if ((state === null || state === void 0 ? void 0 : state.kind) === RuleKinds.VARIABLE && state.name) {
variableName = state.name;
}
if (state.kind === RuleKinds.NAMED_TYPE && variableName) {
if ((state === null || state === void 0 ? void 0 : state.kind) === RuleKinds.NAMED_TYPE && variableName) {
const parentDefinition = getParentDefinition(state, RuleKinds.TYPE);

@@ -338,0 +343,0 @@ if (parentDefinition === null || parentDefinition === void 0 ? void 0 : parentDefinition.type) {

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

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

@@ -159,4 +159,9 @@ /**

token,
argDefs.map(argDef => ({
argDefs.map((argDef: GraphQLArgument): CompletionItem => ({
label: argDef.name,
insertText: argDef.name + ': ',
command: {
command: 'editor.action.triggerSuggest',
title: 'Suggestions',
},
detail: String(argDef.type),

@@ -589,11 +594,11 @@ documentation: argDef.description ?? undefined,

): CompletionItem[] {
let variableName: null | string;
let variableName: null | string = null;
let variableType: GraphQLInputObjectType | undefined | null;
const definitions: Record<string, any> = Object.create({});
// TODO: gather this as part of `AllTypeInfo`, as I don't think it's optimal to re-run the parser like this
runOnlineParser(queryText, (_, state: State) => {
if (state.kind === RuleKinds.VARIABLE && state.name) {
// TODO: gather this as part of `AllTypeInfo`, as I don't think it's optimal to re-run the parser like this
if (state?.kind === RuleKinds.VARIABLE && state.name) {
variableName = state.name;
}
if (state.kind === RuleKinds.NAMED_TYPE && variableName) {
if (state?.kind === RuleKinds.NAMED_TYPE && variableName) {
const parentDefinition = getParentDefinition(state, RuleKinds.TYPE);

@@ -609,2 +614,3 @@ if (parentDefinition?.type) {

if (!definitions[variableName]) {
// append `$` if the `token.string` is not already `$`
const label = token.string === '$' ? variableName : '$' + variableName;

@@ -611,0 +617,0 @@ definitions[variableName] = {

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc