Pure-D / serve-d

D LSP server (dlang language server protocol server)
MIT License
208 stars 50 forks source link

uriToFile: Ensure Linux relative paths are not mistaken for Windows network paths #379

Open alexandrumc opened 1 week ago

nordlow commented 1 week ago

CI breakage on Ubuntu at https://github.com/Pure-D/serve-d/actions/runs/11911163422/job/33192075621?pr=379#step:5:199.

It could be that those tests should be guarded behind a version(Windows) aswell.

alexandrumc commented 1 week ago

CI breakage on Ubuntu at https://github.com/Pure-D/serve-d/actions/runs/11911163422/job/33192075621?pr=379#step:5:199.

I'm not sure what's wrong here.

It's exactly as I thought: relative paths are purposely not allowed. See: https://github.com/Pure-D/serve-d/pull/379/files#diff-5fe989f330d97e3213311a21f32b49f79da9362777f9213f9edcf25ae2935e62R21

nordlow commented 1 week ago

It's exactly as I thought: relative paths are purposely not allowed. See: https://github.com/Pure-D/serve-d/pull/379/files#diff-5fe989f330d97e3213311a21f32b49f79da9362777f9213f9edcf25ae2935e62R21

There should be an in contract check for this, though.

WebFreak001 commented 1 week ago

relative paths should never come from an LSP implementation because the client can't assume the cwd of the server. The cwd that the client operates from might even be a virtual folder that doesn't have a filesystem equivalent. Usually you should avoid reading the files manually, since there are filesystem apis over JSON-RPC with LSP, but sometimes it's the only possible way to achieve certain things.