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 to 2.9.6-canary-eb5c4300.0

4

dist/getAutocompleteSuggestions.js

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

if (!definitions[variableName]) {
const label = token.string === '$' ? variableName : '$' + variableName;
definitions[variableName] = {
detail: variableType.toString(),
label,
insertText: token.string === '$' ? variableName : '$' + variableName,
label: variableName,
type: variableType,

@@ -357,0 +357,0 @@ kind: vscode_languageserver_types_1.CompletionItemKind.Variable,

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

if (!definitions[variableName]) {
const label = token.string === '$' ? variableName : '$' + variableName;
definitions[variableName] = {
detail: variableType.toString(),
label,
insertText: token.string === '$' ? variableName : '$' + variableName,
label: variableName,
type: variableType,

@@ -353,0 +353,0 @@ kind: CompletionItemKind.Variable,

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

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

@@ -24,2 +24,7 @@ /**

const suggestionCommand = {
command: 'editor.action.triggerSuggest',
title: 'Suggestions',
};
describe('getAutocompleteSuggestions', () => {

@@ -54,2 +59,4 @@ let schema: GraphQLSchema;

.map(suggestion => {
// TODO: A PR where we do `const { type, ..rest} = suggestion; return rest;`
// and validate the entire completion object - kinds, documentation, etc
const response = { label: suggestion.label } as CompletionItem;

@@ -59,5 +66,11 @@ if (suggestion.detail) {

}
// if(suggestion.documentation) {
// response.documentation = String(suggestion.documentation)
// }
if (suggestion.insertText) {
response.insertText = suggestion.insertText;
}
if (suggestion.insertTextFormat) {
response.insertTextFormat = suggestion.insertTextFormat;
}
if (suggestion.command) {
response.command = suggestion.command;
}
return response;

@@ -200,3 +213,10 @@ });

const result = testSuggestions('{ human (', new Position(0, 9));
expect(result).toEqual([{ label: 'id', detail: 'String!' }]);
expect(result).toEqual([
{
label: 'id',
detail: 'String!',
insertText: 'id: ',
command: suggestionCommand,
},
]);
});

@@ -206,3 +226,10 @@

const result = testSuggestions('{ aliasTest: human( ', new Position(0, 20));
expect(result).toEqual([{ label: 'id', detail: 'String!' }]);
expect(result).toEqual([
{
label: 'id',
detail: 'String!',
command: suggestionCommand,
insertText: 'id: ',
},
]);
});

@@ -292,3 +319,5 @@

);
expect(result).toEqual([{ label: '$ep', detail: 'Episode' }]);
expect(result).toEqual([
{ label: 'ep', insertText: '$ep', detail: 'Episode' },
]);
});

@@ -302,4 +331,4 @@

expect(result).toEqual([
{ label: '$episode', detail: 'Episode' },
{ label: 'EMPIRE', detail: 'Episode' },
{ label: 'episode', detail: 'Episode', insertText: '$episode' },
{ label: 'JEDI', detail: 'Episode' },

@@ -306,0 +335,0 @@ { label: 'NEWHOPE', detail: 'Episode' },

@@ -615,6 +615,7 @@ /**

// append `$` if the `token.string` is not already `$`
const label = token.string === '$' ? variableName : '$' + variableName;
definitions[variableName] = {
detail: variableType.toString(),
label,
insertText: token.string === '$' ? variableName : '$' + variableName,
label: variableName, // keep label the same for `codemirror-graphql`
type: variableType,

@@ -621,0 +622,0 @@ kind: CompletionItemKind.Variable,

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