Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Different ignore and adjust ifdefs
  • Loading branch information
cartermp committed May 31, 2019
commit c803dc4a3ea4813740c06872fa51512ac0cf8d8f
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,9 @@ type CodeLensDisplayService (view : IWpfTextView, buffer : ITextBuffer, layerNam
with e ->
#if DEBUG
logErrorf "Error in line lens provider: %A" e
#else
ignore e
#endif
()

/// Public non-thread-safe method to add line lens for a given tracking span.
/// Returns an UIElement which can be used to add Ui elements and to remove the line lens later.
Expand All @@ -179,14 +180,13 @@ type CodeLensDisplayService (view : IWpfTextView, buffer : ITextBuffer, layerNam
with e ->
#if DEBUG
logExceptionWithContext(e, "Removing line lens")
#else
ignore e
#endif
e |> ignore
()
else
#if DEBUG
else
logWarningf "No ui element is attached to this tracking span!"
#endif
()
let lineNumber =
(trackingSpan.GetStartPoint self.CurrentBufferSnapshot).Position
|> self.CurrentBufferSnapshot.GetLineNumberFromPosition
Expand All @@ -197,11 +197,10 @@ type CodeLensDisplayService (view : IWpfTextView, buffer : ITextBuffer, layerNam
#endif
if self.TrackingSpans.[lineNumber].Count = 0 then
self.TrackingSpans.Remove lineNumber |> ignore
else
#if DEBUG
else
logWarningf "No tracking span is accociated with this line number %d!" lineNumber
#endif
()

abstract member AddUiElementToCodeLens : ITrackingSpan * UIElement -> unit
default self.AddUiElementToCodeLens (trackingSpan:ITrackingSpan, uiElement:UIElement) =
Expand Down Expand Up @@ -254,9 +253,9 @@ type CodeLensDisplayService (view : IWpfTextView, buffer : ITextBuffer, layerNam
with e ->
#if DEBUG
logErrorf "Error in non visible lines iteration %A" e
#else
ignore e
#endif
e |> ignore
()
for lineNumber in newVisibleLineNumbers do
try
let line =
Expand All @@ -269,9 +268,9 @@ type CodeLensDisplayService (view : IWpfTextView, buffer : ITextBuffer, layerNam
with e ->
#if DEBUG
logErrorf "Error in new visible lines iteration %A" e
#else
ignore e
#endif
e |> ignore
()
if not e.VerticalTranslation && e.NewViewState.ViewportHeight <> e.OldViewState.ViewportHeight then
self.RelayoutRequested.Enqueue() // Unfortunately zooming requires a relayout too, to ensure that no weird layout happens due to unkown reasons.
if self.RelayoutRequested.Count > 0 then
Expand All @@ -297,9 +296,9 @@ type CodeLensDisplayService (view : IWpfTextView, buffer : ITextBuffer, layerNam
with e ->
#if DEBUG
logExceptionWithContext (e, "Layout changed")
#else
ignore e
#endif
e |> ignore
()

abstract LayoutUIElementOnLine : IWpfTextView -> ITextViewLine -> Grid -> unit

Expand Down
21 changes: 14 additions & 7 deletions vsintegration/src/FSharp.Editor/CodeLens/CodeLensGeneralTagger.fs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ type CodeLensGeneralTagger (view, buffer) as self =
with e ->
#if DEBUG
logExceptionWithContext (e, "Error in layout ui element on line")
#else
ignore e
#endif
Canvas.GetLeft ui, Canvas.GetTop ui
Canvas.SetLeft(ui, left)
Expand Down Expand Up @@ -97,9 +99,9 @@ type CodeLensGeneralTagger (view, buffer) as self =
with e ->
#if DEBUG
logExceptionWithContext (e, "LayoutChanged, processing new visible lines")
#else
ignore e
#endif
e |> ignore
()
} |> Async.Ignore

override self.AddUiElementToCodeLens (trackingSpan:ITrackingSpan, uiElement:UIElement)=
Expand Down Expand Up @@ -127,8 +129,9 @@ type CodeLensGeneralTagger (view, buffer) as self =
with e ->
#if DEBUG
logExceptionWithContext (e, "line number tagging")
#else
ignore e
#endif
e |> ignore
0
if self.TrackingSpans.ContainsKey(lineNumber) && self.TrackingSpans.[lineNumber] |> Seq.isEmpty |> not then

Expand All @@ -146,8 +149,9 @@ type CodeLensGeneralTagger (view, buffer) as self =
with e ->
#if DEBUG
logExceptionWithContext (e, "tag span translation")
#else
ignore e
#endif
e |> ignore
tagSpan
let sizes =
try
Expand All @@ -157,8 +161,9 @@ type CodeLensGeneralTagger (view, buffer) as self =
with e ->
#if DEBUG
logExceptionWithContext (e, "internal tagging")
#else
ignore e
#endif
e |> ignore
Seq.empty
let height =
try
Expand All @@ -170,15 +175,17 @@ type CodeLensGeneralTagger (view, buffer) as self =
with e ->
#if DEBUG
logExceptionWithContext (e, "height tagging")
#else
ignore e
#endif
e |> ignore
0.0

yield TagSpan(span, CodeLensGeneralTag(0., height, 0., 0., 0., PositionAffinity.Predecessor, stackPanels, self)) :> ITagSpan<CodeLensGeneralTag>
}
with e ->
#if DEBUG
logErrorf "Error in code lens get tags %A" e
#else
ignore e
#endif
e |> ignore
Seq.empty
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,4 @@ type internal CodeLensProvider
interface IWpfTextViewCreationListener with
override __.TextViewCreated view =
if settings.CodeLens.Enabled && settings.CodeLens.ReplaceWithLineLens then
addLineLensProviderOnce view (view.TextBuffer) |> ignore
addLineLensProviderOnce view (view.TextBuffer) |> ignore
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,9 @@ type internal FSharpCodeLensService
with e ->
#if DEBUG
logErrorf "Error in lazy line lens computation. %A" e
#else
ignore e
#endif
e |> ignore
return None
}

Expand Down Expand Up @@ -308,8 +309,7 @@ type internal FSharpCodeLensService
#if DEBUG
logExceptionWithContext (e, "Line Lens tracking tag span creation")
#endif
e |> ignore
()
ignore e
()
lastResults <- newResults
do! Async.SwitchToContext uiContext |> liftAsync
Expand Down Expand Up @@ -390,8 +390,9 @@ type internal FSharpCodeLensService
| e ->
#if DEBUG
logErrorf "Line Lens startup failed with: %A" e
#else
ignore e
#endif
e |> ignore
numberOfFails <- numberOfFails + 1
} |> Async.Start
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ type internal LineLensDisplayService (view, buffer) =
with e ->
#if DEBUG
logExceptionWithContext (e, "Error in layout ui element on line")
#else
ignore e
#endif
e |> ignore
Canvas.GetLeft ui, Canvas.GetTop ui
Canvas.SetLeft(ui, left)
Canvas.SetTop(ui, top)
Expand Down Expand Up @@ -66,7 +67,7 @@ type internal LineLensDisplayService (view, buffer) =
with e ->
#if DEBUG
logExceptionWithContext (e, "LayoutChanged, processing new visible lines")
#else
ignore e
#endif
e |> ignore
()
} |> Async.Ignore