(filePath: string, content: string, type: 'virtual' | 'physical' = 'physical')
| 396 | } |
| 397 | |
| 398 | async editFile(filePath: string, content: string, type: 'virtual' | 'physical' = 'physical') { |
| 399 | const normPath = await normalizePath(filePath); |
| 400 | const {text} = await this.fileManager.editFile(normPath, content, type); |
| 401 | |
| 402 | if (type === 'physical') { |
| 403 | if (!this.openedFiles.includes(normPath)) { |
| 404 | await this.lspClient.didChangeWatchedFiles(normPath); |
| 405 | } |
| 406 | } else { |
| 407 | if (this.openedFiles.includes(normPath)) { |
| 408 | await this.lspClient.didChange(normPath, text); |
| 409 | } else { |
| 410 | throw new Error('cannot make virtual changes to a file that is not open'); |
| 411 | } |
| 412 | } |
| 413 | } |
| 414 | |
| 415 | async getFileContent(filePath: string): Promise<string> { |
| 416 | return this.fileManager.getFileContent(await normalizePath(filePath)); |
no test coverage detected