@coderline/alphatab-language-server 1.7.0-alpha.1630 → 1.7.0-alpha.1631

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/server.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * alphaTab Language Server v1.7.0-alpha.1630 (develop, build 1630)
2
+ * alphaTab Language Server v1.7.0-alpha.1631 (develop, build 1631)
3
3
  *
4
4
  * Copyright © 2025, Daniel Kuschny and Contributors, All rights reserved.
5
5
  *
@@ -5507,9 +5507,13 @@ function createArgumentCompletions(signatures, actualValues, offset, trailingEnd
5507
5507
  if (actualValues) {
5508
5508
  const value = binaryNodeSearch(actualValues.arguments, offset, trailingEnd);
5509
5509
  if (value?.parameterIndices) {
5510
+ const isNextParameter = offset > value.end.offset;
5510
5511
  const signatureCandidates = resolveSignature(signatures, actualValues);
5511
5512
  for (const [k, v] of signatureCandidates) {
5512
- const parameterIndex = value.parameterIndices.get(k);
5513
+ let parameterIndex = value.parameterIndices.get(k);
5514
+ if (parameterIndex !== undefined && isNextParameter && parameterIndex < v.parameters.length - 1) {
5515
+ parameterIndex++;
5516
+ }
5513
5517
  const values = parameterIndex !== undefined ? v.parameters[parameterIndex].values : undefined;
5514
5518
  if (values) {
5515
5519
  return values.map(i => valueItemToCompletion(i, {
@@ -5607,12 +5611,7 @@ function setupDiagnostics(connection, documents) {
5607
5611
  }
5608
5612
  });
5609
5613
  documents.onDidChangeContent(async (change) => {
5610
- const diagnostics = await validateTextDocument(change.document);
5611
- connection.sendDiagnostics({
5612
- diagnostics: diagnostics,
5613
- uri: change.document.uri,
5614
- version: change.document.version
5615
- });
5614
+ await validateTextDocument(change.document);
5616
5615
  });
5617
5616
  }
5618
5617
  function mapDiagnostics(atDiag) {
@@ -5686,6 +5685,7 @@ async function validateTextDocument(textDocument) {
5686
5685
  const text = textDocument.getText();
5687
5686
  const importer = new alphaTab.importer.AlphaTexImporter();
5688
5687
  importer.initFromString(text, new alphaTab.Settings());
5688
+ importer.parser.mode = alphaTab.importer.alphaTex.AlphaTexParseMode.Full;
5689
5689
  try {
5690
5690
  textDocument.score = importer.readScore();
5691
5691
  textDocument.ast = importer.scoreNode;
@@ -5860,18 +5860,32 @@ function withSignaturesToMarkdown(docs, prefix, syntaxName = 'Syntax') {
5860
5860
  ].join('\n');
5861
5861
  }
5862
5862
  function signatureParametersToMarkdownTable(signatures) {
5863
- return signatures.length === 0 || (signatures.length === 1 && signatures[0].parameters.length === 0)
5864
- ? ''
5865
- : [
5863
+ if (signatures.length === 0 || (signatures.length === 1 && signatures[0].parameters.length === 0)) {
5864
+ return '';
5865
+ }
5866
+ const hasOverloads = signatures.length > 1;
5867
+ if (hasOverloads) {
5868
+ return [
5869
+ '',
5870
+ '**Parameters:**',
5871
+ '| Overload | Name | Description | Type | Required |',
5872
+ '|----------|------|-------------|------|----------|',
5873
+ ...signatures.flatMap((s, si) => s.parameters.map(v => {
5874
+ return `| \`[${si + 1}]\` | \`${v.name}\` | ${(v.longDescription ?? v.shortDescription)?.replaceAll('\n', '<br />') ?? ''} | \`${nodeTypesToTypeDocs(v).replaceAll('|', '\\|')}\` | ${isRequiredParameter(v.parseMode) ? 'yes' : 'no'} ${v.defaultValue ?? ''} |`;
5875
+ }))
5876
+ ].join('\n');
5877
+ }
5878
+ else {
5879
+ return [
5866
5880
  '',
5867
5881
  '**Parameters:**',
5868
5882
  '| Name | Description | Type | Required |',
5869
5883
  '|------|-------------|------|----------|',
5870
- ...signatures.flatMap((s, si) => s.parameters.map(v => {
5871
- const index = signatures.length > 1 ? `[^${si + 1}] ` : '';
5872
- return `| \`${v.name}\` ${index}| ${(v.longDescription ?? v.shortDescription)?.replaceAll('\n', '<br />') ?? ''} | \`${nodeTypesToTypeDocs(v).replaceAll('|', '\\|')}\` | ${isRequiredParameter(v.parseMode) ? 'yes' : 'no'} ${v.defaultValue ?? ''} |`;
5884
+ ...signatures.flatMap(s => s.parameters.map(v => {
5885
+ return `| \`${v.name}\` | ${(v.longDescription ?? v.shortDescription)?.replaceAll('\n', '<br />') ?? ''} | \`${nodeTypesToTypeDocs(v).replaceAll('|', '\\|')}\` | ${isRequiredParameter(v.parseMode) ? 'yes' : 'no'} ${v.defaultValue ?? ''} |`;
5873
5886
  }))
5874
5887
  ].join('\n');
5888
+ }
5875
5889
  }
5876
5890
  function parameterValueDocsToMarkDown(docs) {
5877
5891
  return [`## ${docs.name}`, docs.longDescription ?? docs.shortDescription, ''].join('\n');
@@ -5879,7 +5893,7 @@ function parameterValueDocsToMarkDown(docs) {
5879
5893
  function signatureToSyntax(prefix, value, index, hasOverloads) {
5880
5894
  let syntax = '';
5881
5895
  if (hasOverloads) {
5882
- syntax += `// [^${index + 1}]: ${value.description}\n`;
5896
+ syntax += `// [${index + 1}]: ${value.description ?? ''}\n`;
5883
5897
  }
5884
5898
  else if (value.description) {
5885
5899
  syntax += `// ${value.description}\n`;