(
documentUri: string,
languageId: string,
connection: ProtocolConnection,
initResponse: InitializeResult<any>
)
| 172 | } |
| 173 | |
| 174 | function setupHover( |
| 175 | documentUri: string, |
| 176 | languageId: string, |
| 177 | connection: ProtocolConnection, |
| 178 | initResponse: InitializeResult<any> |
| 179 | ) { |
| 180 | if (!initResponse.capabilities.hoverProvider) { |
| 181 | return; |
| 182 | } |
| 183 | |
| 184 | // TODO: registration is global, this will break with multiple editors |
| 185 | monaco.languages.registerHoverProvider(languageId, { |
| 186 | async provideHover(_, position, token) { |
| 187 | const params: HoverParams = { |
| 188 | position: { |
| 189 | line: position.lineNumber - 1, |
| 190 | character: position.column - 1 |
| 191 | }, |
| 192 | textDocument: { |
| 193 | uri: documentUri |
| 194 | } |
| 195 | }; |
| 196 | const response = await connection.sendRequest(HoverRequest.type, params, token); |
| 197 | if (response === null) { |
| 198 | return null; |
| 199 | } |
| 200 | return lspToMonacoHover(response); |
| 201 | } |
| 202 | }); |
| 203 | } |
| 204 | |
| 205 | function setupSignatureHelp( |
| 206 | documentUri: string, |
no outgoing calls
no test coverage detected