( _server: LspServerDefinition, rootUri: string | null, )
| 1290 | export default defaultManager; |
| 1291 | |
| 1292 | function normalizeRootUriForServer( |
| 1293 | _server: LspServerDefinition, |
| 1294 | rootUri: string | null, |
| 1295 | ): NormalizedRootUri { |
| 1296 | if (!rootUri || typeof rootUri !== "string") { |
| 1297 | return { normalizedRootUri: null, originalRootUri: null }; |
| 1298 | } |
| 1299 | const schemeMatch = /^([a-zA-Z][\w+\-.]*?):/.exec(rootUri); |
| 1300 | const scheme = schemeMatch ? schemeMatch[1].toLowerCase() : null; |
| 1301 | |
| 1302 | // Already a file:// URI - use as-is |
| 1303 | if (scheme === "file") { |
| 1304 | return { normalizedRootUri: rootUri, originalRootUri: rootUri }; |
| 1305 | } |
| 1306 | |
| 1307 | // Try to convert content:// URIs to file:// URIs |
| 1308 | if (scheme === "content") { |
| 1309 | const fileUri = contentUriToFileUri(rootUri); |
| 1310 | if (fileUri) { |
| 1311 | return { normalizedRootUri: fileUri, originalRootUri: rootUri }; |
| 1312 | } |
| 1313 | // Can't convert to file:// - server won't work properly |
| 1314 | return { normalizedRootUri: null, originalRootUri: rootUri }; |
| 1315 | } |
| 1316 | |
| 1317 | // Unknown scheme - try to use as-is |
| 1318 | return { normalizedRootUri: rootUri, originalRootUri: rootUri }; |
| 1319 | } |
| 1320 | |
| 1321 | function normalizeDocumentUri(uri: string | null | undefined): string | null { |
| 1322 | if (!uri || typeof uri !== "string") return null; |
no test coverage detected