-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Connect inline rename UI to editor smart rename session #70420
Connect inline rename UI to editor smart rename session #70420
Conversation
As @AmadeusW proposed they want to have this checked to asap to get the backend tested. |
Synced with the infra folks so it's agreed now we use release/dev17.9 as our old |
_renameService.ActiveSession, | ||
session => new RenameFlyoutViewModel(session, | ||
identifierSelection, | ||
registerOleComponent: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you know what the registerOleComponent bit is about?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just warp all the argument here, guess Andrew @ryzngard would know this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registering for Ole fails in unit tests (I'd have to dig deeper to remember why) so we have this for testing purposes. Production code should always be true.
@@ -0,0 +1,91 @@ | |||
<UserControl x:Class="Microsoft.CodeAnalysis.InlineRename.UI.SmartRename.SmartRenameControl" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ryzngard for xaml review.
<Setter Property="ItemsPanel"> | ||
<Setter.Value> | ||
<ItemsPanelTemplate> | ||
<WrapPanel Orientation="Horizontal" Width="238" HorizontalAlignment="Left"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
slightly concerned about hardcoded values like 238. where did that number come from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got this from the editor side impl, tag @AmadeusW here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd try it without tbh. It should fill the space of the panel
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{ | ||
if (e.ClickCount == 1) | ||
{ | ||
var identifierName = ((FrameworkElement)sender).Tag.ToString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how do we know that the sender is a framework eleemnt, or that the tag contains the info we need?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By wpf definition https://learn.microsoft.com/en-us/dotnet/api/system.windows.frameworkelement.tag?view=windowsdesktop-7.0
Then tag is directly binded to the display string in xaml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, this is safe in WPF as long as this method is used for mouse events.
foreach (var name in _smartRenameSession.SuggestedNames) | ||
{ | ||
SuggestedNames.Add(name); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think an observable collection has a way to say "i'm about to make a bunch of changes" so it doesn't notify on each change.
Ok. This looks good to me. However, i'd like @jasonmalinowski @sharwell to have a pass, since they're experts in hooking things into the UI properly :) |
@@ -396,7 +396,7 @@ End Class | |||
End Using | |||
End Function | |||
|
|||
<WpfFact> | |||
<WpfFact(Skip:="https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1906990")> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This failed after updating the VS editor package to 17.9. (Only fails in our CI, Spanish VM)
#70471
Test is testing the behavior for both our code & editor side impl of IAsyncCompletionBroker
.
So, if this is regressed, it's already in VS, since editor team owns the insertion of the dll.
I have talked to Gen and we can temp skip this test and let editor folks to investigate this
src/EditorFeatures/Core.Wpf/InlineRename/UI/SmartRename/SmartRenameViewModel.cs
Outdated
Show resolved
Hide resolved
Will monitor the health of Integration test from Dart lab |
Thanks to @AmadeusW which added an internal preview API to suggested names based on copilot results.
This PR connects this to our inline rename UI
How it looks:
User could double-click & navigate using the keyboard to select the suggested names.
A few points: