Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix auto select active project (#4146) #4151

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Bug Fixes:
- Fix our setting of `isUserPreset` for presets, only set it to `true` if it's defined in a user presets file. [#4059](https://github.com/microsoft/vscode-cmake-tools/issues/4059)
- Fix issue where duplicate presets are being listed in dropdown. [#4104](https://github.com/microsoft/vscode-cmake-tools/issues/4104)
- Fix various GCC compiler errors and GCC linker errors not showing up in Problems View [#2864](https://github.com/microsoft/vscode-cmake-tools/issues/2864)
- Fix auto select active project corner case. [#4146](https://github.com/microsoft/vscode-cmake-tools/issues/4146) Contributed by STMicroelectronics

## 1.19.52

Expand Down
8 changes: 7 additions & 1 deletion src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,13 @@ export async function scheduleAsyncTask<T>(task: () => Promise<T>): Promise<T> {
export function isFileInsideFolder(uri: vscode.Uri, folderPath: string): boolean {
const parent = platformNormalizePath(folderPath);
const file = platformNormalizePath(uri.fsPath);
return file.startsWith(parent);

// Ensure project path ends with a path separator to avoid partial matches
const parentWithEndingSeparator = parent.endsWith(path.posix.sep)
? parent
: `${parent}${path.posix.sep}`;

return file.startsWith(parentWithEndingSeparator);
}

/**
Expand Down
Loading