Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5028724

Browse files
authored
Merge pull requestdotnet#4711 from Microsoft/merges/master-to-dev15.8
Merge master to dev15.8
2 parentsb2a4c3d +297f67d commit5028724

File tree

2 files changed

+24
-47
lines changed

2 files changed

+24
-47
lines changed

‎vsintegration/src/FSharp.Editor/QuickInfo/QuickInfoProvider.fs‎

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,11 @@ type internal FSharpAsyncQuickInfoSource
199199
let!symbolUse,sigQuickInfo,targetQuickInfo= FSharpQuickInfo.getQuickInfo(checkerProvider.Checker, projectInfoManager, document, triggerPoint.Position, cancellationToken)
200200
letgetTrackingSpan(span:TextSpan)=
201201
textBuffer.CurrentSnapshot.CreateTrackingSpan(span.Start, span.Length, SpanTrackingMode.EdgeInclusive)
202+
letlineBreak= TaggedTextOps.Literals.lineBreak
203+
letjoinWithLineBreaks segments=
204+
match segments|> List.filter(Seq.isEmpty>>not)with
205+
|[]-> Seq.empty
206+
| xs-> xs|> List.reduce(fun acc elem->seq{yield! acc;yield lineBreak;yield! elem})
202207

203208
match sigQuickInfo, targetQuickInfowith
204209
| None, None->returnnull
@@ -208,32 +213,15 @@ type internal FSharpAsyncQuickInfoSource
208213
XmlDocumentation.BuildDataTipText(documentationBuilder, mainDescription.Add, documentation.Add, typeParameterMap.Add, usage.Add, exceptions.Add, quickInfo.StructuredText)
209214
letimageId= Tokenizer.GetImageIdForSymbol(quickInfo.Symbol, quickInfo.SymbolKind)
210215
letnavigation= QuickInfoNavigation(gotoDefinitionService, document, symbolUse.RangeAlternate)
211-
letcontent= QuickInfoViewProvider.provideContent(imageId, mainDescription, documentation, typeParameterMap, usage, exceptions, navigation)
216+
letdocs= joinWithLineBreaks[documentation; typeParameterMap; usage; exceptions]
217+
letcontent= QuickInfoViewProvider.provideContent(imageId, mainDescription, docs, navigation)
212218
letspan= getTrackingSpan quickInfo.Span
213219
return QuickInfoItem(span, content)
214220

215221
| Some sigQuickInfo, Some targetQuickInfo->
216222
letmainDescription,targetDocumentation,sigDocumentation,typeParameterMap,exceptions,usage= ResizeArray(), ResizeArray(), ResizeArray(), ResizeArray(), ResizeArray(), ResizeArray()
217223
XmlDocumentation.BuildDataTipText(documentationBuilder, ignore, sigDocumentation.Add, ignore, ignore, ignore, sigQuickInfo.StructuredText)
218224
XmlDocumentation.BuildDataTipText(documentationBuilder, mainDescription.Add, targetDocumentation.Add, typeParameterMap.Add, exceptions.Add, usage.Add, targetQuickInfo.StructuredText)
219-
220-
letwidth=
221-
mainDescription
222-
|> Seq.append targetDocumentation
223-
|> Seq.append exceptions
224-
|> Seq.append usage
225-
|> Seq.append sigDocumentation
226-
|> Seq.append typeParameterMap
227-
|> Seq.map(fun x-> x.Text.Length)
228-
|> Seq.max
229-
230-
// eyeballed formula returning separator width in chars such as to prevent it from wrapping
231-
// will not be needed once we replace the ascii-art divider with a XAML element
232-
letwidth=if width/2>85then85else width/2
233-
234-
letseperator= TaggedTextOps.tag Text(String.replicate width"")
235-
letlineBreak= TaggedTextOps.tag LineBreak"\n"
236-
237225
// get whitespace nomalized documentation text
238226
letgetText(tts:seq<Layout.TaggedText>)=
239227
lettext=
@@ -251,15 +239,12 @@ type internal FSharpAsyncQuickInfoSource
251239
| Some implText, Some sigTextwhen implText.Equals(sigText, StringComparison.OrdinalIgnoreCase)->
252240
yield! sigDocumentation
253241
| Some_, Some_->
254-
yield! sigDocumentation
255-
yield lineBreak
256-
yield seperator
257-
yield lineBreak
258-
yield! targetDocumentation]
259-
|> ResizeArray
242+
yield! joinWithLineBreaks[ sigDocumentation;[ TaggedTextOps.tagText"-------------"]; targetDocumentation]
243+
]|> ResizeArray
244+
letdocs= joinWithLineBreaks[documentation; typeParameterMap; usage; exceptions]
260245
letimageId= Tokenizer.GetImageIdForSymbol(targetQuickInfo.Symbol, targetQuickInfo.SymbolKind)
261246
letnavigation= QuickInfoNavigation(gotoDefinitionService, document, symbolUse.RangeAlternate)
262-
letcontent= QuickInfoViewProvider.provideContent(imageId, mainDescription,documentation, typeParameterMap, usage, exceptions, navigation)
247+
letcontent= QuickInfoViewProvider.provideContent(imageId, mainDescription,docs, navigation)
263248
letspan= getTrackingSpan targetQuickInfo.Span
264249
return QuickInfoItem(span, content)
265250
}|> Async.map Option.toObj

‎vsintegration/src/FSharp.Editor/QuickInfo/Views.fs‎

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@ module internal QuickInfoViewProvider =
5353
imageId:ImageId,
5454
description:#seq<Layout.TaggedText>,
5555
documentation:#seq<Layout.TaggedText>,
56-
typeParameterMap:#seq<Layout.TaggedText>,
57-
usage:#seq<Layout.TaggedText>,
58-
exceptions:#seq<Layout.TaggedText>,
5956
navigation:QuickInfoNavigation
6057
)=
6158

@@ -82,26 +79,21 @@ module internal QuickInfoViewProvider =
8279
currentContainerItems.Add(navigableTextRun:> obj)
8380
|_when item.Tag= LineBreak->
8481
flushRuns()
82+
// preserve succesive linebreaks
83+
if currentContainerItems.Count=0then
84+
runsCollection.Add(ClassifiedTextRun(PredefinedClassificationTypeNames.Other, System.String.Empty))
85+
flushRuns()
8586
flushContainer()
86-
|_->
87+
|_->
8788
letnewRun= ClassifiedTextRun(classificationTag, item.Text)
88-
runsCollection.Add(newRun)
89-
()
89+
runsCollection.Add(newRun)
9090
flushRuns()
9191
flushContainer()
92-
finalCollection|>List.ofSeq
92+
ContainerElement(ContainerElementStyle.Stacked,finalCollection|>Seq.map box)
9393

94-
letelements=
95-
[ description
96-
documentation
97-
typeParameterMap
98-
usage
99-
exceptions]
100-
|> List.filter(Seq.isEmpty>>not)
101-
|> List.map buildContainerElement
102-
|> List.concat
103-
|> List.map(fun x-> x:> obj)
104-
|>(fun e-> ContainerElement(ContainerElementStyle.Stacked, e))
105-
ContainerElement(
106-
ContainerElementStyle.Wrapped,
107-
[(ImageElement(imageId):> obj); elements:> obj])
94+
ContainerElement(ContainerElementStyle.Stacked,
95+
ContainerElement(ContainerElementStyle.Wrapped,
96+
ImageElement(imageId),
97+
buildContainerElement description),
98+
buildContainerElement documentation
99+
)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp