@@ -11,6 +11,7 @@ import type { LSPServer } from "./server"
1111import { NamedError } from "@opencode-ai/util/error"
1212import { withTimeout } from "../util/timeout"
1313import { Instance } from "../project/instance"
14+ import { Filesystem } from "../util/filesystem"
1415
1516export namespace LSPClient {
1617 const log = Log . create ( { service : "lsp.client" } )
@@ -47,15 +48,15 @@ export namespace LSPClient {
4748
4849 const diagnostics = new Map < string , Diagnostic [ ] > ( )
4950 connection . onNotification ( "textDocument/publishDiagnostics" , ( params ) => {
50- const path = fileURLToPath ( params . uri )
51+ const filePath = Filesystem . normalizePath ( fileURLToPath ( params . uri ) )
5152 l . info ( "textDocument/publishDiagnostics" , {
52- path,
53+ path : filePath ,
5354 count : params . diagnostics . length ,
5455 } )
55- const exists = diagnostics . has ( path )
56- diagnostics . set ( path , params . diagnostics )
56+ const exists = diagnostics . has ( filePath )
57+ diagnostics . set ( filePath , params . diagnostics )
5758 if ( ! exists && input . serverID === "typescript" ) return
58- Bus . publish ( Event . Diagnostics , { path, serverID : input . serverID } )
59+ Bus . publish ( Event . Diagnostics , { path : filePath , serverID : input . serverID } )
5960 } )
6061 connection . onRequest ( "window/workDoneProgress/create" , ( params ) => {
6162 l . info ( "window/workDoneProgress/create" , params )
@@ -182,18 +183,16 @@ export namespace LSPClient {
182183 return diagnostics
183184 } ,
184185 async waitForDiagnostics ( input : { path : string } ) {
185- input . path = path . isAbsolute ( input . path ) ? input . path : path . resolve ( Instance . directory , input . path )
186- log . info ( "waiting for diagnostics" , input )
186+ const normalizedPath = Filesystem . normalizePath (
187+ path . isAbsolute ( input . path ) ? input . path : path . resolve ( Instance . directory , input . path ) ,
188+ )
189+ log . info ( "waiting for diagnostics" , { path : normalizedPath } )
187190 let unsub : ( ) => void
188191 return await withTimeout (
189192 new Promise < void > ( ( resolve ) => {
190193 unsub = Bus . subscribe ( Event . Diagnostics , ( event ) => {
191- const pathsMatch =
192- process . platform === "win32"
193- ? event . properties . path . toLowerCase ( ) === input . path . toLowerCase ( )
194- : event . properties . path === input . path
195- if ( pathsMatch && event . properties . serverID === result . serverID ) {
196- log . info ( "got diagnostics" , input )
194+ if ( event . properties . path === normalizedPath && event . properties . serverID === result . serverID ) {
195+ log . info ( "got diagnostics" , { path : normalizedPath } )
197196 unsub ?.( )
198197 resolve ( )
199198 }
0 commit comments