| 19 | } |
| 20 | |
| 21 | function createWorkspaceHost(): workspaces.WorkspaceHost { |
| 22 | return { |
| 23 | readFile(path) { |
| 24 | return fs.readFile(path, 'utf-8'); |
| 25 | }, |
| 26 | async writeFile(path, data) { |
| 27 | await fs.writeFile(path, data); |
| 28 | }, |
| 29 | async isDirectory(path) { |
| 30 | try { |
| 31 | const stats = await fs.stat(path); |
| 32 | |
| 33 | return stats.isDirectory(); |
| 34 | } catch { |
| 35 | return false; |
| 36 | } |
| 37 | }, |
| 38 | async isFile(path) { |
| 39 | try { |
| 40 | const stats = await fs.stat(path); |
| 41 | |
| 42 | return stats.isFile(); |
| 43 | } catch { |
| 44 | return false; |
| 45 | } |
| 46 | }, |
| 47 | }; |
| 48 | } |
| 49 | |
| 50 | export const workspaceSchemaPath = path.join(__dirname, '../../lib/config/schema.json'); |
| 51 | |