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

Function createDurationChangeCompletions

packages/lsp/src/server/completion.ts:215–257  ·  view source on GitHub ↗
(
    durationChange: alphaTab.importer.alphaTex.AlphaTexBeatDurationChangeNode,
    offset: number,
    endOfDurationChange: number
)

Source from the content-addressed store, hash-verified

213}
214
215function createDurationChangeCompletions(
216 durationChange: alphaTab.importer.alphaTex.AlphaTexBeatDurationChangeNode,
217 offset: number,
218 endOfDurationChange: number
219): CompletionItem[] {
220 const completions: CompletionItem[] = [];
221
222 if (!durationChange.properties || offset < durationChange.properties.start!.offset) {
223 const endOfValue = durationChange.properties?.start ?? durationChange.end!;
224 const replacement: TextEdit[] | undefined = durationChange.properties
225 ? [
226 TextEdit.del({
227 start: {
228 line: durationChange.colon.start!.line - 1,
229 character: durationChange.colon.start!.col - 1
230 },
231 end: {
232 line: endOfValue.line - 1,
233 character: endOfValue.col - 1
234 }
235 })
236 ]
237 : undefined;
238
239 completions.push(
240 ...durationCompletionItems.map(d => ({
241 ...d,
242 additionalTextEdits: replacement
243 }))
244 );
245 } else if (
246 durationChange.properties &&
247 durationChange.properties.start!.offset < offset &&
248 durationChange.properties.end!.offset
249 ) {
250 const endOfProperties = durationChange.properties?.closeBrace?.start?.offset ?? endOfDurationChange;
251 completions.push(
252 ...createPropertiesCompletions(durationChange.properties, offset, durationChangeProperties, endOfProperties)
253 );
254 }
255
256 return completions;
257}
258
259function createNoteCompletions(
260 beat: alphaTab.importer.alphaTex.AlphaTexBeatNode,

Callers 1

createBeatCompletionsFunction · 0.85

Calls 3

pushMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected