feat: support ${workspaceFolder} and relative paths in cmake.exclude#4689
feat: support ${workspaceFolder} and relative paths in cmake.exclude#4689
Conversation
…exclude Co-authored-by: snehara99 <113148726+snehara99@users.noreply.github.com>
Co-authored-by: snehara99 <113148726+snehara99@users.noreply.github.com>
Co-authored-by: snehara99 <113148726+snehara99@users.noreply.github.com>
|
@copilot can you document the test updates |
Co-authored-by: snehara99 <113148726+snehara99@users.noreply.github.com>
Added test documentation in commit 9511d75. The PR description now includes a detailed "Test Updates Documentation" section with:
|
Co-authored-by: snehara99 <113148726+snehara99@users.noreply.github.com>
Co-authored-by: snehara99 <113148726+snehara99@users.noreply.github.com>
…n build directory changes (#4694) * Initial plan * Fix terminal cwd not updating when build directory changes Co-authored-by: snehara99 <113148726+snehara99@users.noreply.github.com> * Fix issue number reference from #4689 to #4549 Co-authored-by: snehara99 <113148726+snehara99@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: snehara99 <113148726+snehara99@users.noreply.github.com>
|
@copilot the windows unit tests don't pass. Can you see if it's a code issue or a test issue? Update the solution based on what you find and explain why you made the changes you did in a comment on the PR. Here are the logs: |
Co-authored-by: snehara99 <113148726+snehara99@users.noreply.github.com>
This was a test issue, not a code issue. Fixed in commit 32e941f. Root cause: The tests were using
Fix: Updated the tests to use |
This changes visible behavior
The following changes are proposed:
expandExcludePath()andexpandExcludePaths()functions inutil.tsto expand path variables and resolve relative pathsprojectController.tsto expand exclude paths before comparison inaddFolder()anddoExcludedFoldersChange()docs/cmake-settings.mdto markcmake.excludeas supporting substitutionCHANGELOG.mdwith feature description and PR linkThe purpose of this change
cmake.excludeonly accepted absolute paths. Variable paths (${workspaceFolder},${workspaceFolder:Name}) and relative paths were not resolved, preventing portable workspace configurations.Now supports:
{ "cmake.exclude": [ "${workspaceFolder}/subproject", "${workspaceFolder:OtherRoot}", "relative/path" ] }Path expansion behavior:
${workspaceFolder}→ current workspace folder path${workspaceFolder:Name}→ named workspace folder path (case-insensitive lookup)Other Notes/Information
The
${workspaceFolder:Name}lookup is case-insensitive, consistent with VS Code's behavior on Windows/macOS file systems.Test Updates Documentation
Added comprehensive unit tests in
test/unit-tests/util.test.tsfor the new path expansion functions:Test Suite:
expandExcludePath tests- Tests for single path expansion (6 tests):Expand ${workspaceFolder} variable${workspaceFolder}is correctly replaced with the workspace folder pathExpand multiple ${workspaceFolder} variables${workspaceFolder}in a single path are all expandedResolve relative pathsubdir/nestedare resolved to absolute paths relative to the workspace folderAbsolute path remains unchangedD:\Other\Pathor/other/path) are not modifiedExpand ${workspaceFolder} and resolve relative path${workspaceFolder}/../other)${workspaceFolder:name} fallback when folder name not found${workspaceFolder:Name}variables are left as-is and treated as relative pathsTest Suite:
expandExcludePaths tests- Tests for array path expansion (2 tests):Expand multiple pathsEmpty array returns empty arrayTest Helper Functions:
createMockWorkspaceFolder(): Creates mockvscode.WorkspaceFolderobjects for testingtestBasePath: Platform-aware base path for cross-platform test compatibilitygetExpectedPath(): Helper to construct expected paths using the same normalization as the code under testWindows Test Fix
Fixed Windows unit test failures by updating tests to use
util.lightNormalizePath()instead ofpath.normalize()for expected values. The codebase'slightNormalizePath()function converts Windows backslashes to forward slashes and usesvscode.Uri.file().fsPathwhich returns lowercase drive letters on Windows. The tests now use the same normalization approach as the code under test for cross-platform consistency.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.