(input: { path: string })
| 139 | }, |
| 140 | notify: { |
| 141 | async open(input: { path: string }) { |
| 142 | input.path = path.isAbsolute(input.path) ? input.path : path.resolve(Instance.directory, input.path) |
| 143 | const file = Bun.file(input.path) |
| 144 | const text = await file.text() |
| 145 | const extension = path.extname(input.path) |
| 146 | const languageId = LANGUAGE_EXTENSIONS[extension] ?? "plaintext" |
| 147 | |
| 148 | const version = files[input.path] |
| 149 | if (version !== undefined) { |
| 150 | const next = version + 1 |
| 151 | files[input.path] = next |
| 152 | log.info("textDocument/didChange", { |
| 153 | path: input.path, |
| 154 | version: next, |
| 155 | }) |
| 156 | await connection.sendNotification("textDocument/didChange", { |
| 157 | textDocument: { |
| 158 | uri: pathToFileURL(input.path).href, |
| 159 | version: next, |
| 160 | }, |
| 161 | contentChanges: [{ text }], |
| 162 | }) |
| 163 | return |
| 164 | } |
| 165 | |
| 166 | log.info("textDocument/didOpen", input) |
| 167 | diagnostics.delete(input.path) |
| 168 | await connection.sendNotification("textDocument/didOpen", { |
| 169 | textDocument: { |
| 170 | uri: pathToFileURL(input.path).href, |
| 171 | languageId, |
| 172 | version: 0, |
| 173 | text, |
| 174 | }, |
| 175 | }) |
| 176 | files[input.path] = 0 |
| 177 | return |
| 178 | }, |
| 179 | }, |
| 180 | get diagnostics() { |
| 181 | return diagnostics |
no test coverage detected