MCPcopy Create free account
hub / github.com/CoderLine/alphaTab / createPropertiesCompletions

Function createPropertiesCompletions

packages/lsp/src/server/completion.ts:484–514  ·  view source on GitHub ↗
(
    properties: alphaTab.importer.alphaTex.AlphaTexPropertiesNode | undefined,
    offset: number,
    availableProperties: Map<string, PropertyDefinition>,
    endOfProperties: number
)

Source from the content-addressed store, hash-verified

482}
483
484function 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
516function createPropertyCompletions(
517 property: alphaTab.importer.alphaTex.AlphaTexPropertyNode,

Callers 4

createBeatCompletionsFunction · 0.85
createNoteCompletionsFunction · 0.85

Calls 7

binaryNodeSearchFunction · 0.90
propertyToCompletionFunction · 0.85
fromMethod · 0.80
mapMethod · 0.45
valuesMethod · 0.45
indexOfMethod · 0.45

Tested by

no test coverage detected