Commit 889cf8a
Allow preset modification commands to target CMakeUserPresets.json (#4733)
* Initial plan
* Allow preset modification commands to target CMakeUserPresets.json
Add determineTargetPresetsFile() to presetsController that:
1. Uses the focused presets file editor if one is active
2. Prompts user to choose when both files exist
3. Uses whichever file exists when only one is present
4. Falls back to inheritance-based logic when neither exists
Co-authored-by: snehara99 <[email protected]>
* Address code review: use path.basename and simplify conditions
Co-authored-by: snehara99 <[email protected]>
* Add changelog entry for issue #4564 in improvements section
Co-authored-by: snehara99 <[email protected]>
* Remove dead inheritsFromUserPreset fallback in addPresetAddUpdate
When determineTargetPresetsFile() returns null, neither presets file
exists on disk. The inheritsFromUserPreset() check was dead code in
this path since it checks against user presets that don't exist.
Default to CMakePresets.json instead.
Co-authored-by: snehara99 <[email protected]>
* Restore inheritsFromUserPreset as first priority in addPresetAddUpdate
Check if the new preset inherits from a user preset first — if so,
automatically write to CMakeUserPresets.json without prompting. Only
fall through to determineTargetPresetsFile() when there's no
inheritance relationship dictating the target file.
Co-authored-by: snehara99 <[email protected]>
* Fix active editor detection by capturing activeTextEditor before QuickPick dialogs
Snapshot vscode.window.activeTextEditor at the start of each
addXxxPreset() method, before any QuickPick interactions that could
shift focus. Pass the captured path through to determineTargetPresetsFile()
so the active editor check works correctly.
Co-authored-by: snehara99 <[email protected]>
* Fix path comparison using platformNormalizePath for cross-platform compatibility
The strict equality comparison between uri.fsPath and path.join() results
could fail due to case differences on Windows or path separator differences.
Use util.platformNormalizePath() on both paths before comparing to handle
case normalization on Windows and Unicode normalization on macOS.
Co-authored-by: snehara99 <[email protected]>
---------
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: snehara99 <[email protected]>1 parent b80d038 commit 889cf8a
2 files changed
Lines changed: 82 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
| 205 | + | |
| 206 | + | |
205 | 207 | | |
206 | 208 | | |
207 | 209 | | |
| |||
423 | 425 | | |
424 | 426 | | |
425 | 427 | | |
426 | | - | |
| 428 | + | |
427 | 429 | | |
428 | 430 | | |
429 | 431 | | |
| |||
435 | 437 | | |
436 | 438 | | |
437 | 439 | | |
438 | | - | |
| 440 | + | |
439 | 441 | | |
440 | 442 | | |
441 | 443 | | |
| |||
463 | 465 | | |
464 | 466 | | |
465 | 467 | | |
| 468 | + | |
| 469 | + | |
466 | 470 | | |
467 | 471 | | |
468 | 472 | | |
| |||
532 | 536 | | |
533 | 537 | | |
534 | 538 | | |
535 | | - | |
| 539 | + | |
536 | 540 | | |
537 | 541 | | |
538 | 542 | | |
539 | 543 | | |
540 | 544 | | |
541 | 545 | | |
542 | 546 | | |
| 547 | + | |
| 548 | + | |
543 | 549 | | |
544 | 550 | | |
545 | 551 | | |
| |||
609 | 615 | | |
610 | 616 | | |
611 | 617 | | |
612 | | - | |
| 618 | + | |
613 | 619 | | |
614 | 620 | | |
615 | 621 | | |
616 | 622 | | |
617 | 623 | | |
618 | 624 | | |
| 625 | + | |
| 626 | + | |
619 | 627 | | |
620 | 628 | | |
621 | 629 | | |
| |||
685 | 693 | | |
686 | 694 | | |
687 | 695 | | |
688 | | - | |
| 696 | + | |
689 | 697 | | |
690 | 698 | | |
691 | 699 | | |
692 | 700 | | |
693 | 701 | | |
694 | 702 | | |
| 703 | + | |
| 704 | + | |
695 | 705 | | |
696 | 706 | | |
697 | 707 | | |
| |||
774 | 784 | | |
775 | 785 | | |
776 | 786 | | |
777 | | - | |
| 787 | + | |
778 | 788 | | |
779 | 789 | | |
780 | 790 | | |
| |||
1562 | 1572 | | |
1563 | 1573 | | |
1564 | 1574 | | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
| 1592 | + | |
| 1593 | + | |
| 1594 | + | |
| 1595 | + | |
| 1596 | + | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
1565 | 1623 | | |
1566 | 1624 | | |
1567 | | - | |
1568 | | - | |
| 1625 | + | |
1569 | 1626 | | |
1570 | 1627 | | |
1571 | 1628 | | |
| 1629 | + | |
1572 | 1630 | | |
1573 | | - | |
1574 | 1631 | | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
| 1635 | + | |
| 1636 | + | |
| 1637 | + | |
| 1638 | + | |
| 1639 | + | |
| 1640 | + | |
| 1641 | + | |
| 1642 | + | |
| 1643 | + | |
| 1644 | + | |
| 1645 | + | |
| 1646 | + | |
1575 | 1647 | | |
1576 | 1648 | | |
1577 | | - | |
1578 | 1649 | | |
1579 | 1650 | | |
1580 | 1651 | | |
| |||
0 commit comments