Skip to content

Commit 0d0f262

Browse files
committed
fix completions at start of line
1 parent 82c9cd8 commit 0d0f262

File tree

3 files changed

+6
-539
lines changed

3 files changed

+6
-539
lines changed

src/features/constraintMenu/AutoCompletion.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ export class AutoCompleteTree {
205205
column: lines[lines.length - 1].length + 1,
206206
});
207207
}
208+
208209
let result: WordCompletion[] = [];
209210
if (tokens.length == 0) {
210211
for (const r of this.roots) {
@@ -220,13 +221,16 @@ export class AutoCompleteTree {
220221
nodes: AutoCompleteNode[],
221222
tokens: Token[],
222223
index: number,
224+
cameFromFinal = false,
223225
skipStartCheck = false,
224226
): WordCompletion[] {
225227
// check for new start
226228
if (!skipStartCheck && tokens[index].column == 1) {
227229
const matchesAnyRoot = this.roots.some((n) => n.word.verifyWord(tokens[index].text).length === 0);
228230
if (matchesAnyRoot) {
229-
return this.completeNode(this.roots, tokens, index, true);
231+
return this.completeNode(this.roots, tokens, index, cameFromFinal, true);
232+
} else if (cameFromFinal || nodes.length == 0) {
233+
return this.completeNode([...this.roots, ...nodes], tokens, index, cameFromFinal, true);
230234
}
231235
}
232236

@@ -241,7 +245,7 @@ export class AutoCompleteTree {
241245
if (n.word.verifyWord(tokens[index].text).length > 0) {
242246
continue;
243247
}
244-
result = result.concat(this.completeNode(n.children, tokens, index + 1));
248+
result = result.concat(this.completeNode(n.children, tokens, index + 1, n.canBeFinal || false));
245249
}
246250
return result;
247251
}

src/features/dfdElements/di.config.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import { FilledBackgroundLabelView, DfdPositionalLabelView } from "./labels";
1818
import { AlwaysSnapPortsMoveMouseListener, ReSnapPortsAfterLabelChangeCommand, PortAwareSnapper } from "./portSnapper";
1919
import { OutputPortEditUIMouseListener, OutputPortEditUI, SetDfdOutputPortBehaviorCommand } from "./outputPortEditUi";
2020
import { DfdEditLabelValidator, DfdEditLabelValidatorDecorator } from "./editLabelValidator";
21-
import { PortBehaviorValidator } from "./outputPortBehaviorValidation";
2221
import { DfdNodeAnnotationUI, DfdNodeAnnotationUIMouseListener } from "./nodeAnnotationUi";
2322
import { DFDBehaviorRefactorer, RefactorInputNameInDFDBehaviorCommand } from "./behaviorRefactorer";
2423

@@ -32,8 +31,6 @@ export const dfdElementsModule = new ContainerModule((bind, unbind, isBound, reb
3231
bind(TYPES.MouseListener).to(AlwaysSnapPortsMoveMouseListener).inSingletonScope();
3332
configureCommand(context, ReSnapPortsAfterLabelChangeCommand);
3433

35-
bind(PortBehaviorValidator).toSelf().inSingletonScope();
36-
3734
bind(OutputPortEditUI).toSelf().inSingletonScope();
3835
bind(TYPES.IUIExtension).toService(OutputPortEditUI);
3936
bind(SWITCHABLE).toService(OutputPortEditUI);

0 commit comments

Comments
 (0)