Skip to content

Commit 95357ad

Browse files
authored
Merge pull request #64 from code0-tech/feat/#63
If a value is set no references are suggested
2 parents d4a1c0e + c1bd5b9 commit 95357ad

2 files changed

Lines changed: 45 additions & 274 deletions

File tree

src/suggestion/getReferenceSuggestions.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,12 @@ export const getReferenceSuggestions = (
9797
dataTypes?: DataType[]
9898
): ReferenceValue[] => {
9999

100+
const nodeIndex = flow?.nodes?.nodes?.findIndex(n => n?.id == nodeId);
101+
102+
if (typeof nodeIndex == "number" && nodeIndex >= 0 && typeof targetIndex == "number" && targetIndex >= 0 && flow?.nodes?.nodes?.[nodeIndex]?.parameters?.nodes?.[targetIndex]) {
103+
flow.nodes.nodes[nodeIndex].parameters.nodes[targetIndex].value = null
104+
}
105+
100106
const sourceCode = generateFlowSourceCode(flow, functions, dataTypes, true);
101107
const fileName = "index.ts";
102108
const host = createCompilerHost(fileName, sourceCode);
@@ -161,7 +167,7 @@ export const getReferenceSuggestions = (
161167
return;
162168
}
163169

164-
const symbolType = checker.getTypeOfSymbolAtLocation(symbol, targetExpression!);
170+
const symbolType = checker.getTypeOfSymbolAtLocation(symbol, targetExpression);
165171

166172
// Handle node_ variables (node function results)
167173
if (name.startsWith("node_")) {

0 commit comments

Comments
 (0)