Skip to content

Commit 7be8ee4

Browse files
alanzmeta-codesync[bot]
authored andcommitted
do not discover projects in buck-out
Summary: A buck project puts its artefacts into a directory called `buck-out`, with a hash as part of the file name. When buck is used to generate `.erl` or `.hrl` files, they will end up there. This means we have no way of knowing what project a given file in `buck-out` belongs to. When we do load the owning project, it explicitly enumerates all the files belonging to the project in the `applicable_files` part of the `AppData`, and we can then correctly process files in `buck-out`. The ELP LSP project discovery process starts at the given open file in the IDE, and keeps looking in parent directories until it finds something that identifies an erlang project, such as a `.elp.toml` file. Even if we have one at the root of the repo, `buck-out` is shared across all projects within the repo, so we do not necessarily know which one the file belongs to. To prevent loading a fallback project and then not correctly reesolving the file in its correct project when it is opened, we do not initiate project discovery on files withing the `buck-out` directory. Reviewed By: TD5, TheGeorge Differential Revision: D85577495 fbshipit-source-id: 58e1ad4ab25e1278493ac4a620119ece6d8971e8
1 parent ed59eb5 commit 7be8ee4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

crates/elp/src/server.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1808,6 +1808,11 @@ impl Server {
18081808
}
18091809

18101810
fn fetch_projects_if_needed(&mut self, path: &AbsPath) {
1811+
// We do not try to load a project for a file that is in the buck-out directory,
1812+
// as it will have been generated by buck from a file originating in a different directory.
1813+
if path.to_string().contains("/buck-out/") {
1814+
return;
1815+
}
18111816
let path = path.to_path_buf();
18121817
let loader = self.project_loader.clone();
18131818
let query_config = self.config.buck_query();

0 commit comments

Comments
 (0)