Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
f4bd221
use proto on mac and linux
dsyme Mar 29, 2019
8a4baf3
reduce diff
dsyme Mar 30, 2019
0474a23
reduce diff
dsyme Mar 30, 2019
b96120e
reduce diff
dsyme Mar 30, 2019
cf9147b
reduce diff
dsyme Mar 30, 2019
286c336
reduce diff
dsyme Mar 30, 2019
7a6448e
reduce diff
dsyme Mar 30, 2019
965d3b1
Merge branch 'master' of https://github.com/Microsoft/visualfsharp in…
dsyme Apr 2, 2019
978414c
Merge branch 'master' into proto
KevinRansom Apr 8, 2019
95d94de
integrate master
dsyme Apr 14, 2019
a15ef59
integrate master
dsyme Apr 14, 2019
aed6752
fix build
dsyme Apr 14, 2019
bb78e5f
fix build
dsyme Apr 14, 2019
b88d23c
Merge branch 'fix77' into proto
dsyme Apr 14, 2019
1aa6a41
load right FSHarp.Build
dsyme Apr 15, 2019
058bdc9
publish proto apps
dsyme Apr 15, 2019
688850f
revert test env changes
dsyme Apr 15, 2019
c2c7213
revert testing changes
dsyme Apr 16, 2019
fdcf82a
Merge branch 'master' of http://github.com/Microsoft/visualfsharp int…
dsyme Apr 16, 2019
e46dcd5
don't repeat bootstrap
dsyme Apr 16, 2019
75e9cc3
be systematic about verbosity
dsyme Apr 17, 2019
d0f51d7
Merge branch 'proto' of https://github.com/dsyme/visualfsharp into proto
dsyme Apr 17, 2019
63c64ef
Merge branch 'master' of http://github.com/Microsoft/visualfsharp int…
dsyme Apr 18, 2019
8f09004
remove verbosity flags
dsyme Apr 24, 2019
5833f0c
Merge branch 'master' of http://github.com/Microsoft/visualfsharp int…
dsyme May 31, 2019
d96345d
fix compiler location (#6917)
KevinRansom Jun 2, 2019
7c39a4f
Remove dead code in Extensions and Pervasive files (#6916)
cartermp Jun 2, 2019
2d7237c
No IVTs for CodeLenses (#6906)
cartermp Jun 2, 2019
e4707c5
Open Implement Interface APIs (#6905)
cartermp Jun 2, 2019
3a3d6ed
Replace AgedLookup with Dictionary in XML doc generation and remove d…
cartermp Jun 2, 2019
b91fa8b
Attributes lists (#6830)
auduchinok Jun 2, 2019
c036b35
Make FSharpAccessibility.IsProtected public, optimize IsPublic proper…
auduchinok Jun 2, 2019
ad5f69e
Replace SynSimplePat list with SynSimplePats in ImplicitCtor (#6845)
auduchinok Jun 2, 2019
45fed83
Reconfigure Legacy MSBuildReferenceResolver to be API-driven (#6898)
cartermp Jun 2, 2019
57969f6
Remove IVT to FSharp.Editor (#6930)
cartermp Jun 2, 2019
d12a626
Merge branch 'master' of http://github.com/Microsoft/visualfsharp int…
dsyme Jun 3, 2019
1632239
try align with fsc.fsproj
dsyme Jun 3, 2019
14be767
Don't go looking for MSBuild v12 in SimulatedMSBuildReferenceResolver…
cartermp Jun 3, 2019
a8eb9b1
Merge branch 'master' of http://github.com/Microsoft/visualfsharp int…
dsyme Jun 4, 2019
52e0844
try to fix build
dsyme Jun 4, 2019
c96481f
Merge pull request #6380 from dsyme/proto
dsyme Jun 4, 2019
6d989fa
ensure Microsoft.FSharp.NetSdk.props makes it into VisualFSharpFull.v…
brettfo Jun 5, 2019
f72b7b2
split service.fs (#6247)
dsyme Jun 6, 2019
b101514
Update DEVGUIDE.md (#6950)
ShalokShalom Jun 6, 2019
e835edf
Update repo name (#6951)
ShalokShalom Jun 7, 2019
49082d3
Removing CONTRIBUTING.md (#6958)
cartermp Jun 10, 2019
832f2c0
Remove IVT to FSharp.Build (#6970)
cartermp Jun 11, 2019
8e0565f
Don't stop type checking recursive module on unresolved open (#6965)
auduchinok Jun 11, 2019
e556508
Remove IVT to fsi from FSharp.Compiler.Private (#6957)
cartermp Jun 11, 2019
a4cbfe1
enable preview LSP support in VS (#6945)
brettfo Jun 11, 2019
027e8c9
fixed List.map3 misleading error message on different length lists (#…
reacheight Jun 11, 2019
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
Next Next commit
No IVTs for CodeLenses (#6906)
* Don't expose Legacy MSBuildReferenceResolver

* Move the files boss hoss

* Remove unused opens

* Fix tests

* Remove IVT dependency for CodeLens and put logging behind a flag

* oopsie doopsie

* meep morp

* blub glub

* heepers jeepers

* Update fsi.fs

* Update service.fs

* Update service.fsi

* Update FSharpCheckerProvider.fs

* Update FSharpLanguageServiceTestable.fs

* Update TestLib.LanguageService.fs

* Updates for build in release

* I'm not touching MSBuildReferenceResolver I'm not touching MSBuildReferenceResolver I'm not touching MSBuildReferenceResolver

* Different ignore and adjust ifdefs
  • Loading branch information
cartermp authored and KevinRansom committed Jun 2, 2019
commit 2d7237cd49c0e0da8efb461994bb6e490130f455
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@
<Compile Include="..\service\ServiceAnalysis.fs">
<Link>Service/ServiceAnalysis.fs</Link>
</Compile>

<!-- the core of the F# Interactive fsi.exe implementation -->
<EmbeddedText Include="..\fsi\FSIstrings.txt">
<Link>FSIstrings.txt</Link>
Expand All @@ -688,7 +688,7 @@
<Compile Include="..\fsi\fsi.fs">
<Link>InteractiveSession/fsi.fs</Link>
</Compile>

<Compile Include="..\MSBuildReferenceResolver.fs" Condition="'$(MonoPackaging)' != 'true'">
<Link>Misc/MSBuildReferenceResolver.fs</Link>
</Compile>
Expand Down
4 changes: 2 additions & 2 deletions src/fsharp/service/service.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2102,12 +2102,12 @@ type FSharpCheckFileResults(filename: string, errors: FSharpErrorInfo[], scopeOp
RequireCompilationThread ctok
scope.IsRelativeNameResolvableFromSymbol(pos, plid, symbol))

member info.GetDisplayEnvForPos(pos: pos) : Async<DisplayEnv option> =
member info.GetDisplayContextForPos(pos: pos) : Async<FSharpDisplayContext option> =
let userOpName = "CodeLens"
reactorOp userOpName "GetDisplayContextAtPos" None (fun ctok scope ->
DoesNotRequireCompilerThreadTokenAndCouldPossiblyBeMadeConcurrent ctok
let (nenv, _), _ = scope.GetBestDisplayEnvForPos pos
Some nenv.DisplayEnv)
Some(FSharpDisplayContext(fun _ -> nenv.DisplayEnv)))

member info.ImplementationFile =
if not keepAssemblyContents then invalidOp "The 'keepAssemblyContents' flag must be set to true on the FSharpChecker in order to access the checked contents of assemblies"
Expand Down
4 changes: 2 additions & 2 deletions src/fsharp/service/service.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ type public FSharpCheckFileResults =

member internal GetVisibleNamespacesAndModulesAtPoint : pos -> Async<Tast.ModuleOrNamespaceRef[]>

/// Find the most precise display environment for the given line and column.
member internal GetDisplayEnvForPos : pos : pos -> Async<DisplayEnv option>
/// Find the most precise display context for the given line and column.
member GetDisplayContextForPos : pos : pos -> Async<FSharpDisplayContext option>

/// Determines if a long ident is resolvable at a specific point.
/// <param name="userOpName">An optional string used for tracing compiler operations associated with this request.</param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace rec Microsoft.VisualStudio.FSharp.Editor

open System
open System.Windows.Controls
open Microsoft.VisualStudio.Text
open Microsoft.VisualStudio.Text.Editor
Expand Down Expand Up @@ -123,7 +122,9 @@ type CodeLensDisplayService (view : IWpfTextView, buffer : ITextBuffer, layerNam
let startLineNumber = snapshot.GetLineNumberFromPosition(trackingSpan.GetStartPoint(snapshot).Position)
let uiElement =
if self.UiElements.ContainsKey trackingSpan then
#if DEBUG
logErrorf "Added a tracking span twice, this is not allowed and will result in invalid values! %A" (trackingSpan.GetText snapshot)
#endif
self.UiElements.[trackingSpan]
else
let defaultStackPanel = self.CreateDefaultStackPanel()
Expand Down Expand Up @@ -152,7 +153,12 @@ type CodeLensDisplayService (view : IWpfTextView, buffer : ITextBuffer, layerNam
let firstLine = view.TextViewLines.FirstVisibleLine
view.DisplayTextLineContainingBufferPosition (firstLine.Start, 0., ViewRelativePosition.Top)
self.RelayoutRequested.Enqueue(())
with e -> logErrorf "Error in line lens provider: %A" e
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 @@ -171,20 +177,30 @@ type CodeLensDisplayService (view : IWpfTextView, buffer : ITextBuffer, layerNam
self.UiElements.Remove trackingSpan |> ignore
try
self.CodeLensLayer.RemoveAdornment(Grid)
with e ->
with e ->
#if DEBUG
logExceptionWithContext(e, "Removing line lens")
#else
ignore e
#endif
#if DEBUG
else
logWarningf "No ui element is attached to this tracking span!"
#endif
let lineNumber =
(trackingSpan.GetStartPoint self.CurrentBufferSnapshot).Position
|> self.CurrentBufferSnapshot.GetLineNumberFromPosition
if self.TrackingSpans.ContainsKey lineNumber then
#if DEBUG
if self.TrackingSpans.[lineNumber].Remove trackingSpan |> not then
logWarningf "No tracking span is accociated with this line number %d!" lineNumber
#endif
if self.TrackingSpans.[lineNumber].Count = 0 then
self.TrackingSpans.Remove lineNumber |> ignore
#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 @@ -234,7 +250,12 @@ type CodeLensDisplayService (view : IWpfTextView, buffer : ITextBuffer, layerNam
applyFuncOnLineStackPanels line (fun ui ->
ui.Visibility <- Visibility.Hidden
)
with e -> logErrorf "Error in non visible lines iteration %A" e
with e ->
#if DEBUG
logErrorf "Error in non visible lines iteration %A" e
#else
ignore e
#endif
for lineNumber in newVisibleLineNumbers do
try
let line =
Expand All @@ -244,7 +265,12 @@ type CodeLensDisplayService (view : IWpfTextView, buffer : ITextBuffer, layerNam
ui.Visibility <- Visibility.Visible
self.LayoutUIElementOnLine view line ui
)
with e -> logErrorf "Error in new visible lines iteration %A" e
with e ->
#if DEBUG
logErrorf "Error in new visible lines iteration %A" e
#else
ignore e
#endif
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 @@ -267,8 +293,13 @@ type CodeLensDisplayService (view : IWpfTextView, buffer : ITextBuffer, layerNam

self.AsyncCustomLayoutOperation visibleLineNumbers buffer
|> RoslynHelpers.StartAsyncSafe self.LayoutChangedCts.Token "HandleLayoutChanged"
with e -> logExceptionWithContext (e, "Layout changed")
with e ->
#if DEBUG
logExceptionWithContext (e, "Layout changed")
#else
ignore e
#endif

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

abstract AsyncCustomLayoutOperation : int Set -> ITextSnapshot -> unit Async
abstract AsyncCustomLayoutOperation : int Set -> ITextSnapshot -> unit Async
58 changes: 48 additions & 10 deletions vsintegration/src/FSharp.Editor/CodeLens/CodeLensGeneralTagger.fs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ open Microsoft.VisualStudio.Text
open Microsoft.VisualStudio.Text.Editor
open Microsoft.VisualStudio.Text.Formatting
open System.Windows
open System.Collections.Generic
open Microsoft.VisualStudio.Text.Tagging

open Microsoft.VisualStudio.FSharp.Editor.Logging
Expand All @@ -32,7 +31,9 @@ type CodeLensGeneralTagger (view, buffer) as self =
let left = Canvas.GetLeft parent
let top = Canvas.GetTop parent
let width = parent.ActualWidth
#if DEBUG
logInfof "Width of parent: %.4f" width
#endif
left + width, top
| _ ->
try
Expand All @@ -47,12 +48,18 @@ type CodeLensGeneralTagger (view, buffer) as self =
// Calling the method twice fixes this bug and ensures that all values are correct.
// Okay not really :( Must be replaced later with an own calculation depending on editor font settings!
if 7 * offset > int g.Left then
#if DEBUG
logErrorf "Incorrect return from geometry measure"
#endif
Canvas.GetLeft ui, g.Top
else
g.Left, g.Top
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)
Canvas.SetTop(ui, top)
Expand Down Expand Up @@ -89,7 +96,12 @@ type CodeLensGeneralTagger (view, buffer) as self =
self, stackPanel, AdornmentRemovedCallback(fun _ _ -> ())) |> ignore
self.AddedAdornments.Add stackPanel |> ignore
| _ -> ()
with e -> logExceptionWithContext (e, "LayoutChanged, processing new visible lines")
with e ->
#if DEBUG
logExceptionWithContext (e, "LayoutChanged, processing new visible lines")
#else
ignore e
#endif
} |> Async.Ignore

override self.AddUiElementToCodeLens (trackingSpan:ITrackingSpan, uiElement:UIElement)=
Expand All @@ -114,7 +126,13 @@ type CodeLensGeneralTagger (view, buffer) as self =
let lineNumber =
try
snapshot.GetLineNumberFromPosition(span.Start.Position)
with e -> logExceptionWithContext (e, "line number tagging"); 0
with e ->
#if DEBUG
logExceptionWithContext (e, "line number tagging")
#else
ignore e
#endif
0
if self.TrackingSpans.ContainsKey(lineNumber) && self.TrackingSpans.[lineNumber] |> Seq.isEmpty |> not then

let tagSpan = snapshot.GetLineFromLineNumber(lineNumber).Extent
Expand All @@ -128,26 +146,46 @@ type CodeLensGeneralTagger (view, buffer) as self =
let span =
try
tagSpan.TranslateTo(span.Snapshot, SpanTrackingMode.EdgeExclusive)
with e -> logExceptionWithContext (e, "tag span translation"); tagSpan
with e ->
#if DEBUG
logExceptionWithContext (e, "tag span translation")
#else
ignore e
#endif
tagSpan
let sizes =
try
stackPanels |> Seq.map (fun ui ->
ui.Measure(Size(10000., 10000.))
ui.DesiredSize )
with e -> logExceptionWithContext (e, "internal tagging"); Seq.empty
with e ->
#if DEBUG
logExceptionWithContext (e, "internal tagging")
#else
ignore e
#endif
Seq.empty
let height =
try
sizes
|> Seq.map (fun size -> size.Height)
|> Seq.sortDescending
|> Seq.tryHead
|> Option.defaultValue 0.
with e -> logExceptionWithContext (e, "height tagging"); 0.
with e ->
#if DEBUG
logExceptionWithContext (e, "height tagging")
#else
ignore e
#endif
0.0

yield TagSpan(span, CodeLensGeneralTag(0., height, 0., 0., 0., PositionAffinity.Predecessor, stackPanels, self)) :> ITagSpan<CodeLensGeneralTag>
}
with e ->
with e ->
#if DEBUG
logErrorf "Error in code lens get tags %A" e
Seq.empty


#else
ignore e
#endif
Seq.empty
10 changes: 1 addition & 9 deletions vsintegration/src/FSharp.Editor/CodeLens/CodeLensProvider.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,15 @@

namespace rec Microsoft.VisualStudio.FSharp.Editor


open System
open Microsoft.VisualStudio.Text
open Microsoft.VisualStudio.Text.Editor
open System.ComponentModel.Composition
open Microsoft.VisualStudio.Utilities
open Microsoft.CodeAnalysis
open Microsoft.VisualStudio.Shell
open Microsoft.VisualStudio
open Microsoft.VisualStudio.LanguageServices
open System.Collections.Generic
open Microsoft.CodeAnalysis.Editor.Shared.Utilities
open Microsoft.VisualStudio.Text.Tagging
open Microsoft.VisualStudio.Text.Classification
open Microsoft.VisualStudio.ComponentModelHost
open System.Threading
open Microsoft.VisualStudio.FSharp.Editor.Logging
open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Editor.Shared.Utilities

[<Export(typeof<IWpfTextViewCreationListener>)>]
Expand Down Expand Up @@ -108,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
Loading