Stream: t-compiler/wg-rls-2.0

Topic: 1670: fs wrappers

LDSpits (Sep 09 2019 at 17:30, on Zulip):

Hey, I'm currently working at But it feels like the impact of the change is a bit bigger than expected

matklad (Sep 09 2019 at 17:36, on Zulip):

@LDSpits why is that?

LDSpits (Sep 09 2019 at 17:38, on Zulip):

There does not seem to be a direct replacement for the existSync call. I found 2 solutions though.

matklad (Sep 09 2019 at 17:39, on Zulip):

We can replace everything except existsSync, and leave a FIXME :-)

LDSpits (Sep 09 2019 at 17:41, on Zulip):

I can use workspace.fs.stat and use the failure as an existsync. Or i can use workspace.findfiles to search for the cargo.toml

matklad (Sep 09 2019 at 17:42, on Zulip):

fs.stat seems like the right approach

LDSpits (Sep 09 2019 at 17:42, on Zulip):

i feel like the FindFiles solution might actually be more complete here.

LDSpits (Sep 09 2019 at 17:43, on Zulip):

That way we can open Directories where the cargo.toml is not at the root (which the code currently assumes)

LDSpits (Sep 09 2019 at 17:44, on Zulip):

however, I'll have to do more than just replace fs.existSync...

matklad (Sep 09 2019 at 17:44, on Zulip):

yeah, that seems resonable.

matklad (Sep 09 2019 at 17:44, on Zulip):

However, doing fs.stat for startes I assume would be smaller diff

matklad (Sep 09 2019 at 17:44, on Zulip):

and replacing it with findFiles seems like a separate refactoring

LDSpits (Sep 09 2019 at 17:44, on Zulip):

that is true

LDSpits (Sep 09 2019 at 17:46, on Zulip):

Ok, I'll replace the call with fs.stat first then. Should I open an issue about the locating of cargo.toml after that?

matklad (Sep 09 2019 at 17:47, on Zulip):

yeah, I think openning an issue would be useful. Could you also research what happens now if Cargo.toml is not at the root? I think that the server side might miss this as well.

LDSpits (Sep 09 2019 at 18:14, on Zulip):

Rust-analyzer currently throws `[ra_lsp_server::main_loop] loading workspace failed: can't find Cargo.toml when attempting to load with a non-root cargo.toml from the server

Laurențiu Nicola (Sep 09 2019 at 19:46, on Zulip):

can workspaces have their Cargo.toml in a random subdirectory? how does it work?

Daniel Mcnab (Sep 10 2019 at 07:40, on Zulip):

I think this is for if you gave:

| Backend/
|| Cargo.toml
|| src/
| Frontend/
|| index.ts
|| tsconfig.json

Currently, we fail if you open, but ideally we would detect that it is in the Backend project

Last update: Sep 18 2020 at 19:30UTC