@@ -193,7 +193,10 @@ class MonacoEditorDfdBehaviorCompletionProvider implements monaco.languages.Comp
193
193
if (
194
194
model . getValueInRange (
195
195
new monaco . Range ( position . lineNumber , position . column - 1 , position . lineNumber , position . column ) ,
196
- ) === "{"
196
+ ) === "{" &&
197
+ model . getValueInRange (
198
+ new monaco . Range ( position . lineNumber , position . column , position . lineNumber , position . column + 1 ) ,
199
+ ) !== "}"
197
200
) {
198
201
return {
199
202
suggestions : [ curlyBracketCompletion ] ,
@@ -228,19 +231,24 @@ class MonacoEditorDfdBehaviorCompletionProvider implements monaco.languages.Comp
228
231
229
232
// Check if we're inside the input list (i.e., inside first curly braces `{}`)
230
233
const openBraceIndex = line . indexOf ( "{" ) ;
231
- const firstSemicolonIndex = line . indexOf ( "; " ) ;
234
+ const closingBraceIndex = line . indexOf ( "} " ) ;
232
235
236
+ console . log ( "Moin" + column ) ;
237
+ console . log ( "Moin" + openBraceIndex ) ;
238
+ console . log ( "Moin" + closingBraceIndex ) ;
239
+ console . log ( "Moin" + ( openBraceIndex !== - 1 && ( closingBraceIndex === - 1 || column <= closingBraceIndex ) ) ) ;
233
240
// If the first semicolon hasn't been typed yet, assume we're inside the input list
234
- if ( openBraceIndex !== - 1 && ( firstSemicolonIndex === - 1 || column < firstSemicolonIndex ) ) {
241
+ if ( openBraceIndex !== - 1 && ( closingBraceIndex === - 1 || column <= closingBraceIndex + 1 ) ) {
235
242
// Inside `{List of available inputs}` section
236
243
return this . getInputCompletions ( model , position , availableInputs ) ;
237
244
}
238
245
239
246
// If the second semicolon hasn't been typed yet, assume we're typing in the term section or outPorts list
247
+ const firstSemicolonIndex = line . indexOf ( ";" ) ;
240
248
const secondSemicolonIndex = line . indexOf ( ";" , firstSemicolonIndex + 1 ) ;
241
249
const secondOpenBraceIndex = line . indexOf ( "{" , openBraceIndex + 1 ) ;
242
250
243
- if ( secondSemicolonIndex !== - 1 && column > secondSemicolonIndex ) {
251
+ if ( secondSemicolonIndex !== - 1 && column > secondSemicolonIndex + 1 ) {
244
252
// If the second semicolon hasn't been typed but we're inside the second curly brace, assume it's outPorts
245
253
if ( secondOpenBraceIndex !== - 1 && column > secondOpenBraceIndex ) {
246
254
// We're inside the `{List of outPorts}` section
0 commit comments