codemirror-graphql
Advanced tools
Comparing version 0.3.1 to 0.5.0
27
hint.js
@@ -154,3 +154,3 @@ /** | ||
if (typeInfo.parentType) { | ||
possibleTypes = _graphql.isAbstractType(typeInfo.parentType) ? typeInfo.parentType.getPossibleTypes() : [typeInfo.parentType]; | ||
possibleTypes = _graphql.isAbstractType(typeInfo.parentType) ? schema.getPossibleTypes(typeInfo.parentType) : [typeInfo.parentType]; | ||
} else { | ||
@@ -187,3 +187,3 @@ (function () { | ||
// Only include fragments which could possibly be spread here. | ||
_graphql.doTypesOverlap(typeInfo.parentType, typeMap[frag.typeCondition.name.value]) | ||
_graphql.doTypesOverlap(schema, typeInfo.parentType, typeMap[frag.typeCondition.name.value]) | ||
); | ||
@@ -223,3 +223,3 @@ }); | ||
var directives = schema.getDirectives().filter(function (directive) { | ||
return directive.onField && state.prevState.kind === 'Field' || directive.onFragment && (state.prevState.kind === 'FragmentDefinition' || state.prevState.kind === 'InlineFragment' || state.prevState.kind === 'FragmentSpread') || directive.onOperation && (state.prevState.kind === 'Query' || state.prevState.kind === 'Mutation' || state.prevState.kind === 'Subscription'); | ||
return canUseDirective(state.prevState.kind, directive); | ||
}); | ||
@@ -235,2 +235,23 @@ return _utilsHintList2['default'](editor, options, cur, token, directives.map(function (directive) { | ||
function canUseDirective(kind, directive) { | ||
var locations = directive.locations; | ||
switch (kind) { | ||
case 'Query': | ||
return locations.indexOf('QUERY') !== -1; | ||
case 'Mutation': | ||
return locations.indexOf('MUTATION') !== -1; | ||
case 'Subscription': | ||
return locations.indexOf('SUBSCRIPTION') !== -1; | ||
case 'Field': | ||
return locations.indexOf('FIELD') !== -1; | ||
case 'FragmentDefinition': | ||
return locations.indexOf('FRAGMENT_DEFINITION') !== -1; | ||
case 'FragmentSpread': | ||
return locations.indexOf('FRAGMENT_SPREAD') !== -1; | ||
case 'InlineFragment': | ||
return locations.indexOf('INLINE_FRAGMENT') !== -1; | ||
} | ||
return false; | ||
} | ||
// Utility for collecting rich type information given any token's state | ||
@@ -237,0 +258,0 @@ // from the graphql-mode parser. |
{ | ||
"name": "codemirror-graphql", | ||
"version": "0.3.1", | ||
"version": "0.5.0", | ||
"description": "GraphQL mode and helpers for CodeMirror.", | ||
@@ -51,3 +51,3 @@ "contributors": [ | ||
"peerDependencies": { | ||
"graphql": "^0.4.16", | ||
"graphql": "^0.5.0", | ||
"codemirror": "^5.6.0" | ||
@@ -60,11 +60,11 @@ }, | ||
"chai": "3.5.0", | ||
"chai-subset": "1.2.0", | ||
"codemirror": "5.6.0", | ||
"chai-subset": "1.2.2", | ||
"codemirror": "5.13.4", | ||
"eslint": "1.10.3", | ||
"flow-bin": "0.21.0", | ||
"graphql": "0.4.16", | ||
"jsdom": "8.0.2", | ||
"flow-bin": "0.22.1", | ||
"graphql": "0.5.0", | ||
"jsdom": "8.3.0", | ||
"mocha": "2.4.5", | ||
"sane": "1.3.1" | ||
"sane": "1.3.4" | ||
} | ||
} |
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
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
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
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
64290
281406
1726
5