graphql-language-service-interface
Advanced tools
Comparing version 2.10.0 to 2.10.1-canary-742288e7.0
@@ -16,5 +16,3 @@ "use strict"; | ||
if (op) { | ||
graphql_2.visit(graphql_2.parse(op, { | ||
allowLegacyFragmentVariables: true, | ||
}), { | ||
graphql_2.visit(graphql_2.parse(op), { | ||
FragmentDefinition(def) { | ||
@@ -21,0 +19,0 @@ externalFragments.push(def); |
@@ -13,5 +13,3 @@ import { CompletionItemKind, InsertTextFormat, } from 'vscode-languageserver-types'; | ||
if (op) { | ||
visit(parse(op, { | ||
allowLegacyFragmentVariables: true, | ||
}), { | ||
visit(parse(op), { | ||
FragmentDefinition(def) { | ||
@@ -18,0 +16,0 @@ externalFragments.push(def); |
{ | ||
"name": "graphql-language-service-interface", | ||
"version": "2.10.0", | ||
"version": "2.10.1-canary-742288e7.0", | ||
"description": "Interface to the GraphQL Language Service", | ||
@@ -34,3 +34,3 @@ "contributors": [ | ||
"graphql-language-service-types": "^1.8.6", | ||
"graphql-language-service-utils": "^2.7.0", | ||
"graphql-language-service-utils": "^2.7.1-canary-742288e7.0", | ||
"vscode-languageserver-types": "^3.15.1" | ||
@@ -37,0 +37,0 @@ }, |
@@ -12,3 +12,3 @@ /** | ||
import fs from 'fs'; | ||
import fs, { readSync } from 'fs'; | ||
import { | ||
@@ -78,4 +78,6 @@ buildSchema, | ||
describe('getAutocompleteSuggestions', () => { | ||
let graphQLVersion; | ||
let schema: GraphQLSchema; | ||
beforeEach(async () => { | ||
// graphQLVersion = pkg.version; | ||
const schemaIDL = fs.readFileSync( | ||
@@ -126,2 +128,9 @@ path.join(__dirname, '__schema__/StarWarsSchema.graphql'), | ||
describe('with Operation types', () => { | ||
const pkg = fs | ||
.readFileSync( | ||
path.join(path.parse(require.resolve('graphql')).dir, 'package.json'), | ||
'utf8', | ||
) | ||
.toString(); | ||
const { version: graphQLVersion } = JSON.parse(pkg); | ||
it('provides correct sortText response', () => { | ||
@@ -438,25 +447,24 @@ const result = getAutocompleteSuggestions( | ||
const expectedDirectiveSuggestions = [ | ||
{ label: 'include' }, | ||
{ label: 'skip' }, | ||
]; | ||
// TODO: remove this once defer and stream are merged to `graphql` | ||
if (graphQLVersion.includes('defer')) { | ||
expectedDirectiveSuggestions.push({ label: 'stream' }); | ||
} | ||
expectedDirectiveSuggestions.push({ label: 'test' }); | ||
it('provides correct directive suggestions', () => { | ||
expect(testSuggestions('{ test @ }', new Position(0, 8))).toEqual([ | ||
{ label: 'include' }, | ||
{ label: 'skip' }, | ||
{ label: 'stream' }, | ||
{ label: 'test' }, | ||
]); | ||
expect(testSuggestions('{ test @ }', new Position(0, 8))).toEqual( | ||
expectedDirectiveSuggestions, | ||
); | ||
expect(testSuggestions('{ test @', new Position(0, 8))).toEqual([ | ||
{ label: 'include' }, | ||
{ label: 'skip' }, | ||
{ label: 'stream' }, | ||
{ label: 'test' }, | ||
]); | ||
expect(testSuggestions('{ test @', new Position(0, 8))).toEqual( | ||
expectedDirectiveSuggestions, | ||
); | ||
expect( | ||
testSuggestions('{ aliasTest: test @ }', new Position(0, 19)), | ||
).toEqual([ | ||
{ label: 'include' }, | ||
{ label: 'skip' }, | ||
{ label: 'stream' }, | ||
{ label: 'test' }, | ||
]); | ||
).toEqual(expectedDirectiveSuggestions); | ||
@@ -463,0 +471,0 @@ expect(testSuggestions('query @', new Position(0, 7))).toEqual([]); |
@@ -87,12 +87,7 @@ /** | ||
if (op) { | ||
visit( | ||
parse(op, { | ||
allowLegacyFragmentVariables: true, | ||
}), | ||
{ | ||
FragmentDefinition(def) { | ||
externalFragments.push(def); | ||
}, | ||
visit(parse(op), { | ||
FragmentDefinition(def) { | ||
externalFragments.push(def); | ||
}, | ||
); | ||
}); | ||
} | ||
@@ -99,0 +94,0 @@ return externalFragments; |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
391687
6835
2