Skip to content

[VS] Rename: dialog in XAML, no exception for a renamed file in the project tree - #2163

Merged
RobertvanderHulst merged 1 commit into
X-Sharp:devfrom
hpetriffer:fix/rename-dialog-xaml
Nov 8, 2026
Merged

RobertvanderHulst merged 1 commit into
X-Sharp:devfrom
hpetriffer:fix/rename-dialog-xaml

Conversation

@hpetriffer

Copy link
Copy Markdown
Contributor

Follow-up to #2154, for the two review comments there.

Depends on #2161: dev does not compile at the moment (FindReferencesCommand.cs after the merge of #2154 and #2156). This branch is based on dev and builds once #2161 is merged.

Changes

  • Rename dialog in XAML. Rename/RenameDialog.xaml (a DialogWindow, x:ClassModifier="internal") replaces the dialog that was built in code; the code-behind keeps only what depends on the symbol (title, late-bound option text, initial values, visibility, events). Both LanguageService projects (VS 2019 and VS 2022) include it as a Page. The interface used by RenameCommand is unchanged.
    • New: the dialog uses the VS theme (toolkit:Themes.UseVsTheme), like the other X# windows, so it is dark in the dark theme. The title bar is still drawn by Windows.
  • No exception when a file is renamed. While a file is renamed, the CPS project tree can still ask XSharpProjectTreePropertiesProvider for the icon of the old path. InferSubTypeFromBaseClass now returns early when the file does not exist, instead of FindClassDeclaration throwing a FileNotFoundException that was caught. The catch stays for the race between the check and the read.

Tests

  • LanguageService2022 and ProjectSystemCPS build; LanguageService (VS 2019) compiles (with the [VS] Find References: fix SelectTarget after the merge of #2154 and #2156 #2161 change applied locally).
  • LanguageService.Tests: 174/174 passed.
  • VS 2022 experimental instance, SDK-style WinForms project (form with .designer.prg): rename of the form class with "Rename file" renames both files and all references; the dialog shows correctly in the dark theme. With the debugger attached and break on thrown System.IO.FileNotFoundException, no break in FindClassDeclaration.

🤖 Generated with Claude Code

…roject tree

- The rename dialog is defined in XAML (RenameDialog.xaml) instead of being built in code;
  both LanguageService projects include it. It now uses the VS theme like the other X# windows.
- XSharpProjectTreePropertiesProvider: while a file is renamed the tree can still ask for the
  old path; return early when the file does not exist instead of throwing (and catching)
  a FileNotFoundException in FindClassDeclaration.

Follow-up to X-Sharp#2154 (review comments).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@RobertvanderHulst
RobertvanderHulst merged commit bcc2a92 into X-Sharp:dev Nov 8, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants