Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,10 @@ object LspEditorUtil {
}

private fun toUri(file: File): URI {
try {
// URI scheme specified by language server protocol
val uri = URI("file", "", file.absoluteFile.toURI().path, null)
val fallback = file.toPath().toAbsolutePath().normalize().toUri()
return if (uri.isCompliant()) uri else fallback
} catch (e: URISyntaxException) {
LOG.warn { "${e.localizedMessage}: $e" }
return file.absoluteFile.toURI()
}
// Use Path.toUri() for proper cross-platform URI handling
// Fixes Windows MCP workspace configuration bug where malformed URIs
// get interpreted as literal file paths during directory creation
return file.toPath().toAbsolutePath().normalize().toUri()
}

private fun URI.isCompliant(): Boolean {
Expand Down