Skip to content

Commit

Permalink
only take line content till cursor
Browse files Browse the repository at this point in the history
  • Loading branch information
Kr0nox committed Dec 22, 2024
1 parent fb24e23 commit 80b8cc9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/features/dfdElements/outputPortEditUi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ class MonacoEditorDfdBehaviorCompletionProvider implements monaco.languages.Comp
};
}

const lastWord = model.getLineContent(position.lineNumber).trimEnd().split(" ").pop() || "";
const lastWord =
model.getLineContent(position.lineNumber).substring(0, position.column).trimEnd().split(" ").pop() || "";
const availableInputs = parent.getAvailableInputs().filter((input) => input !== undefined) as string[];
if (lastWord.endsWith(",") || lastWord.endsWith(".") || lastWord == statementType?.word) {
// Suggestions per statement type
Expand All @@ -181,7 +182,7 @@ class MonacoEditorDfdBehaviorCompletionProvider implements monaco.languages.Comp
};
}
} else if (statementType?.word === "assign") {
const line = model.getLineContent(position.lineNumber);
const line = model.getLineContent(position.lineNumber).substring(0, position.column);
const hasFromKeyword = line.includes("from");
const hasIfKeyword = line.includes("if");
if (lastWord == "from") {
Expand Down

0 comments on commit 80b8cc9

Please sign in to comment.