(
properties: alphaTab.importer.alphaTex.AlphaTexPropertiesNode | undefined,
offset: number,
availableProperties: Map<string, PropertyDefinition>,
endOfProperties: number
)
| 482 | } |
| 483 | |
| 484 | function createPropertiesCompletions( |
| 485 | properties: alphaTab.importer.alphaTex.AlphaTexPropertiesNode | undefined, |
| 486 | offset: number, |
| 487 | availableProperties: Map<string, PropertyDefinition>, |
| 488 | endOfProperties: number |
| 489 | ): CompletionItem[] { |
| 490 | if (!properties) { |
| 491 | return []; |
| 492 | } |
| 493 | |
| 494 | const end = properties.closeBrace?.start?.offset ?? properties.end!.offset; |
| 495 | if (offset < properties.openBrace!.start!.offset || offset > end) { |
| 496 | return []; |
| 497 | } |
| 498 | |
| 499 | const allPropCompletions: CompletionItem[] = Array.from(availableProperties.values()).map(p => |
| 500 | propertyToCompletion(p) |
| 501 | ); |
| 502 | |
| 503 | const prop = properties ? binaryNodeSearch(properties.properties, offset, endOfProperties) : undefined; |
| 504 | if (prop) { |
| 505 | const propIndex = properties.properties.indexOf(prop); |
| 506 | const endOfProp = |
| 507 | propIndex === properties.properties.length - 1 |
| 508 | ? endOfProperties |
| 509 | : properties.properties[propIndex + 1].start!.offset; |
| 510 | return createPropertyCompletions(prop, offset, availableProperties, allPropCompletions, endOfProp); |
| 511 | } |
| 512 | |
| 513 | return allPropCompletions; |
| 514 | } |
| 515 | |
| 516 | function createPropertyCompletions( |
| 517 | property: alphaTab.importer.alphaTex.AlphaTexPropertyNode, |
no test coverage detected