microsoft / vscode-cmake-tools

CMake integration in Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=vector-of-bool.cmake-tools
MIT License
1.48k stars 454 forks source link

Auto select active folder feature not working with project having same starting names #4146

Open MNASTM opened 3 weeks ago

MNASTM commented 3 weeks ago

Brief Issue Summary

Considering user is NOT working with multi root workspaces, but with the single folder structure:

MyFolder ├── .vscode ├── MyProjectA ├── MyProjectABC

the .vscode/.settings.json contains:

{
"cmake.sourceDirectory": ["<pathTo>/MyFolder/MyProjectA","<pathTo>/MyFolder/MyProjectABC"],
}

In this case, the Automatic select active folder feature is not working and always stays on MyProjectA, I assume because:

<pathTo>/MyFolder/MyProjectABC/src/main.c starts with <pathTo>/MyFolder/MyProjectA so it thinks it belongs to MyProjectA

CMake Tools Diagnostics

No response

Debug Log

No response

Additional Information

No response

MNASTM commented 3 weeks ago

Issue spotted I think:

https://github.com/microsoft/vscode-cmake-tools/blob/d0ad11e5665316f314e53d00e4110bc9becdef76/src/util.ts#L950

Small test adding a trailing path separator of the parent project path to avoid partial match looks to fix the issue.

I can create a PR if that's fine :)

gcampbell-msft commented 3 weeks ago

@MNASTM That would be great! We're always happy to take community contributions.

MNASTM commented 3 weeks ago

I am not able to push my branch:

Permission to microsoft/vscode-cmake-tools.git denied to MNASTM fatal: unable to access 'https://github.com/microsoft/vscode-cmake-tools.git/': The requested URL returned error: 403

Either I am missing something from this project or I have a conflicting configuration with my compagnie organization. Please let me know if something is required from your side?

gcampbell-msft commented 3 weeks ago

@MNASTM I believe the issue is that the preferred way to make PR's into our repo is by creating a personal fork of the repository and then creating a PR from that. You can see examples of PRs from other contributors in the currently active PRs, here is an example as well: https://github.com/microsoft/vscode-cmake-tools/pull/4129

MNASTM commented 3 weeks ago

@MNASTM I believe the issue is that the preferred way to make PR's into our repo is by creating a personal fork of the repository and then creating a PR from that. You can see examples of PRs from other contributors in the currently active PRs, here is an example as well: #4129

My bad, thx!