Skip to content
This repository was archived by the owner on Oct 21, 2025. It is now read-only.

Commit cdfae92

Browse files
authored
Merge pull request #55 from DataFlowAnalysis/fix/assignment-in-text-edit
Fix assignment autocompletion in text
2 parents fb24e23 + 80b8cc9 commit cdfae92

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/features/dfdElements/outputPortEditUi.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ class MonacoEditorDfdBehaviorCompletionProvider implements monaco.languages.Comp
158158
};
159159
}
160160

161-
const lastWord = model.getLineContent(position.lineNumber).trimEnd().split(" ").pop() || "";
161+
const lastWord =
162+
model.getLineContent(position.lineNumber).substring(0, position.column).trimEnd().split(" ").pop() || "";
162163
const availableInputs = parent.getAvailableInputs().filter((input) => input !== undefined) as string[];
163164
if (lastWord.endsWith(",") || lastWord.endsWith(".") || lastWord == statementType?.word) {
164165
// Suggestions per statement type
@@ -181,7 +182,7 @@ class MonacoEditorDfdBehaviorCompletionProvider implements monaco.languages.Comp
181182
};
182183
}
183184
} else if (statementType?.word === "assign") {
184-
const line = model.getLineContent(position.lineNumber);
185+
const line = model.getLineContent(position.lineNumber).substring(0, position.column);
185186
const hasFromKeyword = line.includes("from");
186187
const hasIfKeyword = line.includes("if");
187188
if (lastWord == "from") {

0 commit comments

Comments
 (0)