-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[Cleanup] Use named arguments in PresentationFramework #10671
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
base: main
Are you sure you want to change the base?
[Cleanup] Use named arguments in PresentationFramework #10671
Conversation
Automated changes. Contributes to dotnet#10018
Manual changes. Contributes to dotnet#10018
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #10671 +/- ##
===================================================
- Coverage 11.25210% 11.22373% -0.02838%
===================================================
Files 3353 3353
Lines 668062 668058 -4
Branches 74980 74980
===================================================
- Hits 75171 74981 -190
- Misses 591642 591833 +191
+ Partials 1249 1244 -5
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
@@ -91,7 +91,7 @@ internal void ActivateDynamicBehavior(EditingBehavior dynamicBehavior, InputDevi | |||
//we pass true for userInitiated because we've simply consulted the InputDevice | |||
//(and only StylusDevice or MouseDevice) for the current position of the device | |||
InitializeCapture(inputDevice, (IStylusEditing)dynamicBehavior, | |||
true /*userInitiated*/, false/*Don't reset the RTI*/); | |||
userInitiated: true, false/*Don't reset the RTI*/); |
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.
It appears like you missed one here, Don't reset the RTI
-> resetDynamicRenderer
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.
A few more. Some may be on purpose, but I though it best to point them out. One appears to be an error that wasn't caught because it's inside a preprocessor directive.
@@ -3405,7 +3405,7 @@ private void RaiseEventForFormerFirstIMEVisibleNode(TextTreeNode node) | |||
|
|||
// Next node was the old first node. Its IMECharCount | |||
// just bumped up, report that. | |||
AddChange(startEdgePosition, /* symbolCount */ 0, /* IMECharCount */ 1, PrecursorTextChangeType.ContentAdded); | |||
AddChange(startEdgePosition, symbolCount: 0, /* IMECharCount */ 1, PrecursorTextChangeType.ContentAdded); |
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.
IMECharCount
-> charCount
@@ -3417,7 +3417,7 @@ private void RaiseEventForNewFirstIMEVisibleNode(TextTreeNode node) | |||
|
|||
// node was the old second node. Its IMECharCount | |||
// just dropped down, report that. | |||
AddChange(startEdgePosition, /* symbolCount */ 0, /* IMECharCount */ 1, PrecursorTextChangeType.ContentRemoved); | |||
AddChange(startEdgePosition, symbolCount: 0, /* IMECharCount */ 1, PrecursorTextChangeType.ContentRemoved); |
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.
IMECharCount
-> charCount
@@ -415,7 +415,7 @@ internal void TargetOnDragOver(DragEventArgs e) | |||
Brush caretBrush = TextSelection.GetCaretBrush(_textEditor); | |||
|
|||
// Show the caret on the dropable position. | |||
_caretDragDrop.Update(/*visible:*/true, caretRectangle, caretBrush, 0.5, italic, CaretScrollMethod.None, /*wordWrappingPosition*/ double.NaN); | |||
_caretDragDrop.Update(visible: true, caretRectangle, caretBrush, 0.5, italic, CaretScrollMethod.None, /*wordWrappingPosition*/ double.NaN); |
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.
wordWrappingPosition
-> scrollToOriginPosition
@@ -1180,7 +1180,7 @@ internal static TextRange InsertRows(TextRange textRange, int rowCount) | |||
{ | |||
// Create new cell and transfer all formatting properties to it from a source cell. | |||
// All properties except for RowSpan will be transferred. | |||
AddCellCopy(newRow, currentCell, -1/*negative means at the endPosition*/, /*copyRowSpan:*/false, /*copyColumnSpan:*/true); | |||
AddCellCopy(newRow, currentCell, -1/*negative means at the endPosition*/, copyRowSpan: false, copyColumnSpan: 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.
Maybe this was skipped on purpose, but if not: negative means at the endPosition
-> cellInsertionIndex
@@ -150,7 +150,7 @@ internal override void OnEndEdit(UnsafeNativeMethods.ITfContext context, | |||
|
|||
#if UNUSED_IME_HIGHLIGHT_LAYER | |||
// Need to pass the foreground and background color of the composition | |||
_highlightLayer.Add(start, end, /*TextDecorationCollection:*/null); | |||
_highlightLayer.Add(start, end, TextDecorationCollection: null); |
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 appears to be an error, the parameter is textDecorations
} | ||
|
||
protected override XamlMember LookupAttachableMember(string name) | ||
{ | ||
return FindMember(name, true /* isAttached */, false /* skipReadOnlyCheck doens't matter for Attached */); | ||
return FindMember(name, isAttached: true, false /* skipReadOnlyCheck doens't matter for Attached */); |
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.
May have been skipped on purpose, but maybe change it to skipReadOnlyCheck: false /* doens't matter for Attached */
@@ -447,7 +447,7 @@ internal List<AutomationPeer> GetCellItemPeers() | |||
|
|||
if (column != null) | |||
{ | |||
DataGridCellItemAutomationPeer peer = GetOrCreateCellItemPeer(column,/*addParentInfo*/ false ); | |||
DataGridCellItemAutomationPeer peer = GetOrCreateCellItemPeer(column,addParentInfo: false); |
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.
nit: spacing
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.
Spacing nits, feel free to ignore
@@ -894,7 +894,7 @@ internal static Rect GetCharacterRect(ITextPointer thisPointer, LogicalDirection | |||
} | |||
else if (thisPointer.TextContainer.Parent is Visual) | |||
{ | |||
Invariant.Assert(textView.RenderScope == thisPointer.TextContainer.Parent || ((Visual)thisPointer.TextContainer.Parent).IsAncestorOf( /*descendant:*/textView.RenderScope), | |||
Invariant.Assert(textView.RenderScope == thisPointer.TextContainer.Parent || ((Visual)thisPointer.TextContainer.Parent).IsAncestorOf( descendant: textView.RenderScope), |
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.
nit: spacing
@@ -903,10 +903,10 @@ internal static Rect GetCharacterRect(ITextPointer thisPointer, LogicalDirection | |||
templatedParent = null; | |||
} | |||
|
|||
if (templatedParent != null && templatedParent.IsAncestorOf( /*descendant:*/textView.RenderScope)) | |||
if (templatedParent != null && templatedParent.IsAncestorOf( descendant: textView.RenderScope)) |
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.
nit: spacing
@@ -628,7 +628,7 @@ internal bool InDeferredSection | |||
#if !PBTCOMPILER | |||
internal ParserContext ScopedCopy() | |||
{ | |||
return ScopedCopy( true /* copyNameScopeStack */ ); | |||
return ScopedCopy( copyNameScopeStack: 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.
nit: spacing
@@ -218,7 +218,7 @@ internal int Read(byte[] buffer, int offset, int count) | |||
int bufferIndex; | |||
|
|||
byte[] readBuffer = GetBufferFromFilePosition( | |||
ReadPosition,true /*reader*/, | |||
ReadPosition,reader: 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.
nit: spacing
@@ -4777,7 +4777,7 @@ private static void DeferActions( TriggerBase triggerBase, | |||
if( !deferredActions.TryGetValue(triggerContainer, out actionList) ) | |||
{ | |||
actionList = new List<DeferredAction>(); | |||
deferredActions.Add(/* key */triggerContainer,/* value */actionList); | |||
deferredActions.Add(key: triggerContainer,value: actionList); |
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.
nit: spacing
Contributes to #10018
Description
I replaced comments specifying an argument name with named arguments, which were introduced in C# 7. This improves readability and maintainability.
My changes are in 2 commits. The first commit is automated changes using regexes and the second commit is manual changes where the comment is outdated or formatted differently than the parameter name.
Note: The compiled IL is identical.
Customer Impact
None.
Regression
No.
Testing
Local build + validated IL.
Risk
Low to none.
Microsoft Reviewers: Open in CodeFlow