Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getDefinitionForFragmentDefinition(
path: Uri,
text: string,
definition: FragmentDefinitionNode,
): Definition {
return {
path,
position: offsetToPosition(text, definition.name.loc.start),
range: locToRange(text, definition.loc),
name: definition.name.value,
language: LANGUAGE,
// This is a file inside the project root, good enough for now
projectRoot: path,
};
}
const meta = node => ({
representativeName: node.name,
startPosition: offsetToPosition(docText, node.loc.start),
endPosition: offsetToPosition(docText, node.loc.end),
children: node.selectionSet || [],
});
return {
function getPosition(text: string, node: ASTNode): Position {
const location = node.loc as Location;
invariant(location, 'Expected ASTNode to have a location.');
return offsetToPosition(text, location.start);
}
const meta = (node: any) => ({
representativeName: node.name,
startPosition: offsetToPosition(docText, node.loc.start),
endPosition: offsetToPosition(docText, node.loc.end),
children: node.selectionSet || [],
});
const meta = node => ({
representativeName: node.name,
startPosition: offsetToPosition(docText, node.loc.start),
endPosition: offsetToPosition(docText, node.loc.end),
children: node.selectionSet || [],
});
return {