(method, params)
| 164 | } |
| 165 | |
| 166 | _request(method, params) { |
| 167 | return new Promise((resolve, reject) => { |
| 168 | const id = this.requestId++; |
| 169 | this.pending.set(id, { resolve, reject }); |
| 170 | const msg = { jsonrpc: '2.0', id, method, params }; |
| 171 | this.process.stdin.write(encodeMessage(msg)); |
| 172 | setTimeout(() => { |
| 173 | if (this.pending.has(id)) { |
| 174 | this.pending.delete(id); |
| 175 | reject(new Error(`LSP timeout: ${method}`)); |
| 176 | } |
| 177 | }, 10000); |
| 178 | }); |
| 179 | } |
| 180 | |
| 181 | _notify(method, params) { |
| 182 | if (!this.process) return; |
no test coverage detected