mesonbuild / vscode-meson

Meson for VisualStudio Code
Apache License 2.0
108 stars 50 forks source link

Recent changes can break with multiple meson.build files #187

Closed lukester1975 closed 1 year ago

lukester1975 commented 1 year ago

Problem being the list returned by const mesonFiles = await vscode.workspace.findFiles("**/meson.build");; the first entry is taken but the order is ... well, maybe not non-deterministic, but not necessarily workspace root "down" (e.g. Windows).

Wouldn't like to say what the best solution is, but I hacked just to order by path length to check #186 at least superficially worked on Windows: https://github.com/lukester1975/vscode-meson/commit/2d3201297801f6081d35b49ac840b652f3223694

Thanks

tristan957 commented 1 year ago

cc @wolfpld. Could we change the commit to prioritize the workspace root meson.build if it exists?

tristan957 commented 1 year ago

Thanks @lukester1975.

lukester1975 commented 1 year ago

NP.

You probably do want some sort of closest-to-workspace-root ordering though, if the idea is to cope with the root meson.build not being in the workspace root?

a/meson.build
a/b/meson.build

Wouldn't want a/b/meson.build (at least, generally, for sane layouts)...

wolfpld commented 1 year ago

Sorting the initial list of meson files by length sounds like a good solution to the problem at hand.

The idea is to exclude all dependent meson.build files (included with subdir) from the list, but this has not yet been done.

wolfpld commented 1 year ago

Should be fixed by #188.

xclaesse commented 1 year ago

My understanding is we only need to know if it's a Meson project or not. We don't actually need to search for all meson.build files, we could just check if it exists at the root of the workspace?

wolfpld commented 1 year ago

There is no requirement to keep a single "meson project" meson.build file in the repository. In some cases, such a setup would be too restrictive.