(connection: Connection, documents: TextDocuments<AlphaTexTextDocument>)
| 22 | import { binaryNodeSearch, parameterToSyntax } from '@coderline/alphatab-language-server/server/utils'; |
| 23 | |
| 24 | export function setupSignatureHelp(connection: Connection, documents: TextDocuments<AlphaTexTextDocument>) { |
| 25 | connection.onSignatureHelp(params => { |
| 26 | const document = documents.get(params.textDocument.uri); |
| 27 | if (!document?.ast) { |
| 28 | return null; |
| 29 | } |
| 30 | |
| 31 | const offset = document.offsetAt(params.position); |
| 32 | |
| 33 | // lookup bar at location |
| 34 | const bar = binaryNodeSearch(document.ast.bars, offset); |
| 35 | if (!bar) { |
| 36 | return null; |
| 37 | } |
| 38 | |
| 39 | const metaData = binaryNodeSearch(bar.metaData, offset); |
| 40 | if (metaData) { |
| 41 | return createMetaDataSignatureHelp(metaData, offset); |
| 42 | } |
| 43 | |
| 44 | const beat = binaryNodeSearch(bar.beats, offset); |
| 45 | if (beat) { |
| 46 | return createBeatSignatureHelp(beat, offset); |
| 47 | } |
| 48 | |
| 49 | return null; |
| 50 | }); |
| 51 | } |
| 52 | |
| 53 | function createMetaDataSignatureHelp( |
| 54 | metaData: alphaTab.importer.alphaTex.AlphaTexMetaDataNode, |
no test coverage detected