Skip to content

Commit 9dd3a56

Browse files
author
nicosammito
committed
feat: enhance node function suggestion by incorporating type variant checks
1 parent 0933a49 commit 9dd3a56

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/suggestion/getNodeSuggestions.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {DataType, FunctionDefinition, NodeFunction} from "@code0-tech/sagittarius-graphql-types";
22
import {createCompilerHost, getSharedTypeDeclarations} from "../utils";
3+
import {DataTypeVariant, getTypeVariant} from "../extraction/getTypeVariant";
34

45
/**
56
* Suggests NodeFunctions based on a given type and a list of available FunctionDefinitions.
@@ -13,7 +14,9 @@ export const getNodeSuggestions = (
1314

1415
let functionToSuggest = functions
1516

16-
if (type && functions) {
17+
const typeVariant = type ? getTypeVariant(type, dataTypes) : null;
18+
19+
if (type && functions && typeVariant !== DataTypeVariant.NODE) {
1720
function getGenericsCount(input: string): number {
1821
const match = input.trim().match(/^<([^>]+)>/);
1922
if (!match) return 0;

0 commit comments

Comments
 (0)