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

Function createPropertyCompletions

packages/lsp/src/server/completion.ts:516–561  ·  view source on GitHub ↗
(
    property: alphaTab.importer.alphaTex.AlphaTexPropertyNode,
    offset: number,
    availableProperties: Map<string, PropertyDefinition>,
    allPropCompletions: CompletionItem[],
    endOfProperty: number
)

Source from the content-addressed store, hash-verified

514}
515
516function createPropertyCompletions(
517 property: alphaTab.importer.alphaTex.AlphaTexPropertyNode,
518 offset: number,
519 availableProperties: Map<string, PropertyDefinition>,
520 allPropCompletions: CompletionItem[],
521 endOfProperty: number
522) {
523 const completions: CompletionItem[] = [];
524 const propCompletion =
525 !property || (property.property.start!.offset <= offset && offset <= property.property.end!.offset);
526 if (propCompletion) {
527 completions.push(
528 ...allPropCompletions.map(c => ({
529 ...c,
530 additionalTextEdits: [
531 TextEdit.del({
532 start: {
533 line: property.property.start!.line - 1,
534 character: property.property.start!.col - 1
535 },
536 end: {
537 line: property.property.end!.line - 1,
538 character: property.property.end!.col - 1
539 }
540 })
541 ]
542 }))
543 );
544 return completions;
545 } else if (offset >= property.end!.offset) {
546 completions.push(...allPropCompletions);
547 }
548
549 const propDocs = availableProperties.get(property.property.text.toLowerCase());
550 if (!propDocs) {
551 return completions;
552 }
553
554 completions.splice(
555 0,
556 0,
557 ...createArgumentCompletions(propDocs.signatures, property.arguments, offset, endOfProperty)
558 );
559
560 return completions;
561}

Callers 1

Calls 5

getMethod · 0.65
pushMethod · 0.45
mapMethod · 0.45
spliceMethod · 0.45

Tested by

no test coverage detected