(
documentUri: string,
languageId: string,
connection: ProtocolConnection,
initResponse: InitializeResult<any>
)
| 203 | } |
| 204 | |
| 205 | function setupSignatureHelp( |
| 206 | documentUri: string, |
| 207 | languageId: string, |
| 208 | connection: ProtocolConnection, |
| 209 | initResponse: InitializeResult<any> |
| 210 | ) { |
| 211 | if (!initResponse.capabilities.signatureHelpProvider) { |
| 212 | return; |
| 213 | } |
| 214 | |
| 215 | // TODO: registration is global, this will break with multiple editors |
| 216 | monaco.languages.registerSignatureHelpProvider(languageId, { |
| 217 | async provideSignatureHelp(_, position, token, context) { |
| 218 | const params: SignatureHelpParams = { |
| 219 | position: { |
| 220 | character: position.column - 1, |
| 221 | line: position.lineNumber - 1 |
| 222 | }, |
| 223 | textDocument: { |
| 224 | uri: documentUri |
| 225 | }, |
| 226 | context: { |
| 227 | isRetrigger: context.isRetrigger, |
| 228 | triggerKind: monacoToLspSignatureHelpTriggerKind(context.triggerKind), |
| 229 | activeSignatureHelp: context.activeSignatureHelp |
| 230 | ? monacoToLspSignatureHelp(context.activeSignatureHelp) |
| 231 | : undefined, |
| 232 | triggerCharacter: context.triggerCharacter |
| 233 | } |
| 234 | }; |
| 235 | |
| 236 | const response = await connection.sendRequest(SignatureHelpRequest.type, params, token); |
| 237 | if (response === null) { |
| 238 | return null; |
| 239 | } |
| 240 | |
| 241 | return lspToMonacoSignatureHelp(response); |
| 242 | }, |
| 243 | signatureHelpRetriggerCharacters: initResponse.capabilities.signatureHelpProvider!.retriggerCharacters, |
| 244 | signatureHelpTriggerCharacters: initResponse.capabilities.signatureHelpProvider!.triggerCharacters |
| 245 | }); |
| 246 | } |
| 247 | function setupCompletion( |
| 248 | documentUri: string, |
| 249 | languageId: string, |
no outgoing calls
no test coverage detected