From a77a095c6e62afb5931fd41803d03020cabb1f53 Mon Sep 17 00:00:00 2001 From: Vasily Kirichenko Date: Fri, 16 Dec 2016 12:23:29 +0300 Subject: [PATCH 1/8] include BlockStructureService.fs into FSharp.Editor project which is lost during one of the merges --- vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj | 1 + 1 file changed, 1 insertion(+) diff --git a/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj b/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj index 6d4d1d37fcc..a81f6a99af4 100644 --- a/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj +++ b/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj @@ -46,6 +46,7 @@ + From 270bab402430af6328799d37d29733698b276d62 Mon Sep 17 00:00:00 2001 From: Vasily Kirichenko Date: Fri, 16 Dec 2016 15:32:54 +0300 Subject: [PATCH 2/8] try to add glyph to quick info --- vsintegration/packages.config | 3 ++ .../src/FSharp.Editor/CommonHelpers.fs | 4 +- .../src/FSharp.Editor/FSharp.Editor.fsproj | 17 ++++++- .../QuickInfo/QuickInfoProvider.fs | 48 +++++++++++++++++-- 4 files changed, 65 insertions(+), 7 deletions(-) diff --git a/vsintegration/packages.config b/vsintegration/packages.config index 5b5d870661f..565e0e4aa66 100644 --- a/vsintegration/packages.config +++ b/vsintegration/packages.config @@ -18,6 +18,9 @@ + + + diff --git a/vsintegration/src/FSharp.Editor/CommonHelpers.fs b/vsintegration/src/FSharp.Editor/CommonHelpers.fs index 32fcbf76dc1..0660c30d4f8 100644 --- a/vsintegration/src/FSharp.Editor/CommonHelpers.fs +++ b/vsintegration/src/FSharp.Editor/CommonHelpers.fs @@ -15,7 +15,7 @@ open Microsoft.VisualStudio.FSharp.LanguageService open Microsoft.FSharp.Compiler.SourceCodeServices open Microsoft.FSharp.Compiler.SourceCodeServices.ItemDescriptionIcons -module CommonHelpers = +module internal CommonHelpers = type private SourceLineData(lineStart: int, lexStateAtStartOfLine: FSharpTokenizerLexState, lexStateAtEndOfLine: FSharpTokenizerLexState, hashCode: int, classifiedSpans: IReadOnlyList) = member val LineStart = lineStart member val LexStateAtStartOfLine = lexStateAtStartOfLine @@ -186,7 +186,7 @@ module CommonHelpers = | None -> None | ClassificationTypeNames.Operator -> let islandColumn = sourceText.Lines.GetLinePositionSpan(classifiedSpan.TextSpan).End.Character - Some (islandColumn, [""], classifiedSpan.TextSpan) + Some (islandColumn, [""], classifiedSpan.TextSpan) | _ -> None | _ -> None diff --git a/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj b/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj index a81f6a99af4..4216de69431 100644 --- a/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj +++ b/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj @@ -1,4 +1,4 @@ - + @@ -18,7 +18,8 @@ LIBRARY v4.6 $(NoWarn);75 - false $(OtherFlags) --warnon:1182 --subsystemversion:6.00 + false + $(OtherFlags) --warnon:1182 --subsystemversion:6.00 true false false @@ -80,6 +81,9 @@ + + + @@ -110,6 +114,15 @@ $(FSharpSourcesRoot)\..\packages\Microsoft.VisualStudio.CoreUtility.$(RoslynVSPackagesVersion)\lib\net45\Microsoft.VisualStudio.CoreUtility.dll + + $(FSharpSourcesRoot)\..\packages\Microsoft.VisualStudio.Imaging.$(RoslynVSPackagesVersion)\lib\net45\Microsoft.VisualStudio.Imaging.dll + + + $(FSharpSourcesRoot)\..\packages\Microsoft.VisualStudio.Imaging.Interop.14.0.DesignTime.$(RoslynVSPackagesVersion)\lib\net45\Microsoft.VisualStudio.Imaging.Interop.14.0.DesignTime.dll + + + $(FSharpSourcesRoot)\..\packages\Microsoft.VisualStudio.ImageCatalog.$(RoslynVSPackagesVersion)\lib\net45\Microsoft.VisualStudio.ImageCatalog.dll + $(FSharpSourcesRoot)\..\packages\Microsoft.VisualStudio.Utilities.$(RoslynVSPackagesVersion)\lib\net45\Microsoft.VisualStudio.Utilities.dll diff --git a/vsintegration/src/FSharp.Editor/QuickInfo/QuickInfoProvider.fs b/vsintegration/src/FSharp.Editor/QuickInfo/QuickInfoProvider.fs index 467ade58cb2..79bc668854d 100644 --- a/vsintegration/src/FSharp.Editor/QuickInfo/QuickInfoProvider.fs +++ b/vsintegration/src/FSharp.Editor/QuickInfo/QuickInfoProvider.fs @@ -25,7 +25,9 @@ open Microsoft.CodeAnalysis.Formatting open Microsoft.CodeAnalysis.Host.Mef open Microsoft.CodeAnalysis.Options open Microsoft.CodeAnalysis.Text +open Microsoft.CodeAnalysis.Editor.Shared.Extensions +open Microsoft.VisualStudio.Language.Intellisense open Microsoft.VisualStudio.FSharp.LanguageService open Microsoft.VisualStudio.Text open Microsoft.VisualStudio.Text.Classification @@ -33,20 +35,47 @@ open Microsoft.VisualStudio.Text.Tagging open Microsoft.VisualStudio.Text.Formatting open Microsoft.VisualStudio.Shell open Microsoft.VisualStudio.Shell.Interop +open Microsoft.VisualStudio.Imaging +//open Microsoft.VisualStudio.Imaging.Interop +open Microsoft.VisualStudio.PlatformUI open Microsoft.FSharp.Compiler open Microsoft.FSharp.Compiler.Parser open Microsoft.FSharp.Compiler.Range open Microsoft.FSharp.Compiler.SourceCodeServices + open System.Windows.Documents +open System.Windows.Controls +open System.Windows.Data +open System.Windows.Media // FSROSLYNTODO: with the merge of the below PR, the QuickInfo API should be changed // to allow for a more flexible syntax for defining the content of the tooltip. // The below interface should be discarded then or updated accourdingly. // https://github.com/dotnet/roslyn/pull/13623 -type internal FSharpDeferredQuickInfoContent(content: string, textProperties: TextFormattingRunProperties) = +type internal FSharpDeferredQuickInfoContent(content: string, textProperties: TextFormattingRunProperties, _glyph: Glyph) = interface IDeferredQuickInfoContent with override this.Create() : FrameworkElement = + //let moniker = GlyphExtensions.GetImageMoniker(glyph) + let image = new CrispImage() //Moniker = moniker) + + // Inform the ImageService of the background color so that images have the correct background. + let binding = + Binding( + "Background", + Converter = new BrushToColorConverter(), + RelativeSource = new RelativeSource(RelativeSourceMode.FindAncestor, typeof, 1)) + + image.SetBinding(ImageThemingUtilities.ImageBackgroundColorProperty, binding) |> ignore + + image.Margin <- new Thickness(1., 1., 3., 1.) + let symbolGlyphBorder = + new Border( + BorderThickness = new Thickness(0.), + BorderBrush = Brushes.Transparent, + VerticalAlignment = VerticalAlignment.Top, + Child = image) + let textBlock = TextBlock(Run(content), TextWrapping = TextWrapping.Wrap, TextTrimming = TextTrimming.None) textBlock.SetValue(TextElement.BackgroundProperty, textProperties.BackgroundBrush) textBlock.SetValue(TextElement.ForegroundProperty, textProperties.ForegroundBrush) @@ -54,7 +83,19 @@ type internal FSharpDeferredQuickInfoContent(content: string, textProperties: Te textBlock.SetValue(TextElement.FontSizeProperty, textProperties.FontRenderingEmSize) textBlock.SetValue(TextElement.FontStyleProperty, if textProperties.Italic then FontStyles.Italic else FontStyles.Normal) textBlock.SetValue(TextElement.FontWeightProperty, if textProperties.Bold then FontWeights.Bold else FontWeights.Normal) - upcast textBlock + + let symbolGlyphAndMainDescriptionDock = + new DockPanel( + LastChildFill = true, + HorizontalAlignment = HorizontalAlignment.Stretch, + Background = Brushes.Transparent) + + symbolGlyphAndMainDescriptionDock.Children.Add(symbolGlyphBorder) |> ignore + symbolGlyphAndMainDescriptionDock.Children.Add(textBlock) |> ignore + + let panel = StackPanel(Orientation = Orientation.Vertical) + panel.Children.Add(symbolGlyphAndMainDescriptionDock) |> ignore + upcast panel [] [] @@ -114,12 +155,13 @@ type internal FSharpQuickInfoProvider match projectInfoManager.TryGetOptionsForEditingDocumentOrProject(document) with | Some options -> let! textVersion = document.GetTextVersionAsync(cancellationToken) |> Async.AwaitTask + let! quickInfoResult = FSharpQuickInfoProvider.ProvideQuickInfo(checkerProvider.Checker, document.Id, sourceText, document.FilePath, position, options, textVersion.GetHashCode(), cancellationToken) match quickInfoResult with | Some(toolTipElement, textSpan) -> let dataTipText = XmlDocumentation.BuildDataTipText(documentationBuilder, toolTipElement) let textProperties = classificationFormatMapService.GetClassificationFormatMap("tooltip").DefaultTextProperties - return QuickInfoItem(textSpan, FSharpDeferredQuickInfoContent(dataTipText, textProperties)) + return QuickInfoItem(textSpan, FSharpDeferredQuickInfoContent(dataTipText, textProperties, Glyph.ClassPublic)) | None -> return null | None -> return null | None -> return null From 4c5c5e820f4120061480999eb120c2f02170650b Mon Sep 17 00:00:00 2001 From: Vasily Kirichenko Date: Fri, 16 Dec 2016 16:32:11 +0300 Subject: [PATCH 3/8] glyph appears --- vsintegration/packages.config | 1 - vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj | 7 ++----- .../src/FSharp.Editor/QuickInfo/QuickInfoProvider.fs | 9 +++++---- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/vsintegration/packages.config b/vsintegration/packages.config index 565e0e4aa66..fc1720883e7 100644 --- a/vsintegration/packages.config +++ b/vsintegration/packages.config @@ -19,7 +19,6 @@ - diff --git a/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj b/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj index 4216de69431..a6a4cdf1141 100644 --- a/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj +++ b/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj @@ -117,12 +117,9 @@ $(FSharpSourcesRoot)\..\packages\Microsoft.VisualStudio.Imaging.$(RoslynVSPackagesVersion)\lib\net45\Microsoft.VisualStudio.Imaging.dll - - $(FSharpSourcesRoot)\..\packages\Microsoft.VisualStudio.Imaging.Interop.14.0.DesignTime.$(RoslynVSPackagesVersion)\lib\net45\Microsoft.VisualStudio.Imaging.Interop.14.0.DesignTime.dll - - + $(FSharpSourcesRoot)\..\packages\Microsoft.VisualStudio.Utilities.$(RoslynVSPackagesVersion)\lib\net45\Microsoft.VisualStudio.Utilities.dll diff --git a/vsintegration/src/FSharp.Editor/QuickInfo/QuickInfoProvider.fs b/vsintegration/src/FSharp.Editor/QuickInfo/QuickInfoProvider.fs index 79bc668854d..2cc4498a79d 100644 --- a/vsintegration/src/FSharp.Editor/QuickInfo/QuickInfoProvider.fs +++ b/vsintegration/src/FSharp.Editor/QuickInfo/QuickInfoProvider.fs @@ -36,7 +36,7 @@ open Microsoft.VisualStudio.Text.Formatting open Microsoft.VisualStudio.Shell open Microsoft.VisualStudio.Shell.Interop open Microsoft.VisualStudio.Imaging -//open Microsoft.VisualStudio.Imaging.Interop +open Microsoft.VisualStudio.Imaging.Interop open Microsoft.VisualStudio.PlatformUI open Microsoft.FSharp.Compiler @@ -53,11 +53,12 @@ open System.Windows.Media // to allow for a more flexible syntax for defining the content of the tooltip. // The below interface should be discarded then or updated accourdingly. // https://github.com/dotnet/roslyn/pull/13623 -type internal FSharpDeferredQuickInfoContent(content: string, textProperties: TextFormattingRunProperties, _glyph: Glyph) = +type internal FSharpDeferredQuickInfoContent(content: string, textProperties: TextFormattingRunProperties, glyph: Glyph) = interface IDeferredQuickInfoContent with override this.Create() : FrameworkElement = - //let moniker = GlyphExtensions.GetImageMoniker(glyph) - let image = new CrispImage() //Moniker = moniker) + let moniker = GlyphExtensions.GetImageMoniker(glyph) + let image = new CrispImage() + image.Moniker <- (box moniker) :?> _ // Inform the ImageService of the background color so that images have the correct background. let binding = From 0ccf7d7cf92d247c58419f0428537878ecf2b93d Mon Sep 17 00:00:00 2001 From: Vasily Kirichenko Date: Fri, 16 Dec 2016 19:23:28 +0300 Subject: [PATCH 4/8] most glyphs are done --- .../src/FSharp.Editor/CommonHelpers.fs | 89 +++++++++++++++++++ .../QuickInfo/QuickInfoProvider.fs | 18 ++-- 2 files changed, 100 insertions(+), 7 deletions(-) diff --git a/vsintegration/src/FSharp.Editor/CommonHelpers.fs b/vsintegration/src/FSharp.Editor/CommonHelpers.fs index 0660c30d4f8..117446e7b1d 100644 --- a/vsintegration/src/FSharp.Editor/CommonHelpers.fs +++ b/vsintegration/src/FSharp.Editor/CommonHelpers.fs @@ -2,6 +2,7 @@ namespace Microsoft.VisualStudio.FSharp.Editor +open System open System.Collections.Generic open System.Threading open System.Threading.Tasks @@ -331,3 +332,91 @@ module internal Extensions = | GlyphMajor.Error -> Glyph.Error | _ -> Glyph.None +[] +module internal TypedAstExtensionHelpers = + type FSharpEntity with + member this.TryGetFullName() = + match (try this.TryFullName with _ -> None) with + | Some x -> Some x + | None -> + try Some (String.Join(".", this.AccessPath, this.DisplayName)) + with _ -> None + + type FSharpMemberOrFunctionOrValue with + // FullType may raise exceptions (see https://github.com/fsharp/fsharp/issues/307). + member x.FullTypeSafe = try Some x.FullType with _ -> None + + let (|Public|Internal|Protected|Private|) (a: FSharpAccessibility) = + if a.IsPublic then Public + elif a.IsInternal then Internal + elif a.IsPrivate then Private + else Protected + +module internal Glyph = + let forSymbol (symbol: FSharpSymbol) = + match symbol with + | :? FSharpUnionCase as x -> + match x.Accessibility with + | Public -> Glyph.EnumPublic + | Internal -> Glyph.EnumInternal + | Protected -> Glyph.EnumProtected + | Private -> Glyph.EnumPrivate + | :? FSharpActivePatternCase -> Glyph.EnumPublic + | :? FSharpField as x -> + match x.Accessibility with + | Public -> Glyph.FieldPublic + | Internal -> Glyph.FieldInternal + | Protected -> Glyph.FieldProtected + | Private -> Glyph.FieldPrivate + | :? FSharpParameter -> Glyph.Parameter + | :? FSharpMemberOrFunctionOrValue as x -> + if x.IsExtensionMember then + match x.Accessibility with + | Public -> Glyph.ExtensionMethodPublic + | Internal -> Glyph.ExtensionMethodInternal + | Protected -> Glyph.ExtensionMethodProtected + | Private -> Glyph.ExtensionMethodPrivate + elif x.IsProperty || x.IsPropertyGetterMethod || x.IsPropertySetterMethod then + match x.Accessibility with + | Public -> Glyph.PropertyPublic + | Internal -> Glyph.PropertyInternal + | Protected -> Glyph.PropertyProtected + | Private -> Glyph.PropertyPrivate + elif x.IsEvent then + match x.Accessibility with + | Public -> Glyph.EventPublic + | Internal -> Glyph.EventInternal + | Protected -> Glyph.EventProtected + | Private -> Glyph.EventPrivate + else + match x.Accessibility with + | Public -> Glyph.MethodPublic + | Internal -> Glyph.MethodInternal + | Protected -> Glyph.MethodProtected + | Private -> Glyph.MethodPrivate + | :? FSharpEntity as x -> + if x.IsFSharpModule then + match x.Accessibility with + | Public -> Glyph.ModulePublic + | Internal -> Glyph.ModuleInternal + | Protected -> Glyph.ModuleProtected + | Private -> Glyph.ModulePrivate + elif x.IsEnum || x.IsFSharpUnion then + match x.Accessibility with + | Public -> Glyph.EnumPublic + | Internal -> Glyph.EnumInternal + | Protected -> Glyph.EnumProtected + | Private -> Glyph.EnumPrivate + elif x.IsInterface then + match x.Accessibility with + | Public -> Glyph.InterfacePublic + | Internal -> Glyph.InterfaceInternal + | Protected -> Glyph.InterfaceProtected + | Private -> Glyph.InterfacePrivate + else + match x.Accessibility with + | Public -> Glyph.ClassPublic + | Internal -> Glyph.ClassInternal + | Protected -> Glyph.ClassProtected + | Private -> Glyph.ClassPrivate + | _ -> Glyph.None \ No newline at end of file diff --git a/vsintegration/src/FSharp.Editor/QuickInfo/QuickInfoProvider.fs b/vsintegration/src/FSharp.Editor/QuickInfo/QuickInfoProvider.fs index 2cc4498a79d..6532f86cc98 100644 --- a/vsintegration/src/FSharp.Editor/QuickInfo/QuickInfoProvider.fs +++ b/vsintegration/src/FSharp.Editor/QuickInfo/QuickInfoProvider.fs @@ -126,6 +126,7 @@ type internal FSharpQuickInfoProvider let textLineColumn = textLinePos.Character //let qualifyingNames, partialName = QuickParse.GetPartialLongNameEx(textLine.ToString(), textLineColumn - 1) let defines = CompilerEnvironment.GetCompilationDefinesForEditing(filePath, options.OtherOptions |> Seq.toList) + let tryClassifyAtPosition position = CommonHelpers.tryClassifyAtPosition(documentId, sourceText, filePath, defines, position, cancellationToken) @@ -137,10 +138,14 @@ type internal FSharpQuickInfoProvider match quickParseInfo with | Some (islandColumn, qualifiers, textSpan) -> let! res = checkFileResults.GetToolTipTextAlternate(textLineNumber, islandColumn, textLine.ToString(), qualifiers, FSharpTokenTag.IDENT) - return - match res with - | FSharpToolTipText [] -> None - | _ -> Some(res, textSpan) + match res with + | FSharpToolTipText [] -> return None + | _ -> + let! symbolUse = checkFileResults.GetSymbolUseAtLocation(textLineNumber, islandColumn, textLine.ToString(), qualifiers) + match symbolUse with + | Some symbolUse -> + return Some(res, textSpan, Glyph.forSymbol symbolUse.Symbol) + | None -> return None | None -> return None } @@ -156,13 +161,12 @@ type internal FSharpQuickInfoProvider match projectInfoManager.TryGetOptionsForEditingDocumentOrProject(document) with | Some options -> let! textVersion = document.GetTextVersionAsync(cancellationToken) |> Async.AwaitTask - let! quickInfoResult = FSharpQuickInfoProvider.ProvideQuickInfo(checkerProvider.Checker, document.Id, sourceText, document.FilePath, position, options, textVersion.GetHashCode(), cancellationToken) match quickInfoResult with - | Some(toolTipElement, textSpan) -> + | Some(toolTipElement, textSpan, glyph) -> let dataTipText = XmlDocumentation.BuildDataTipText(documentationBuilder, toolTipElement) let textProperties = classificationFormatMapService.GetClassificationFormatMap("tooltip").DefaultTextProperties - return QuickInfoItem(textSpan, FSharpDeferredQuickInfoContent(dataTipText, textProperties, Glyph.ClassPublic)) + return QuickInfoItem(textSpan, FSharpDeferredQuickInfoContent(dataTipText, textProperties, glyph)) | None -> return null | None -> return null | None -> return null From 612bb8e43ae475871f38dfc3fa7a6faed254db8b Mon Sep 17 00:00:00 2001 From: Vasily Kirichenko Date: Fri, 16 Dec 2016 20:50:56 +0300 Subject: [PATCH 5/8] fix tests compilation --- vsintegration/tests/unittests/QuickInfoProviderTests.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vsintegration/tests/unittests/QuickInfoProviderTests.fs b/vsintegration/tests/unittests/QuickInfoProviderTests.fs index d6157fc8317..c57093a5055 100644 --- a/vsintegration/tests/unittests/QuickInfoProviderTests.fs +++ b/vsintegration/tests/unittests/QuickInfoProviderTests.fs @@ -100,5 +100,5 @@ Full name: System.Console" FSharpQuickInfoProvider.ProvideQuickInfo(FSharpChecker.Instance, documentId, SourceText.From(fileContents), filePath, caretPosition, options, 0, CancellationToken.None) |> Async.RunSynchronously - let actual = quickInfo |> Option.map (fun (text, _) -> getQuickInfoText text) + let actual = quickInfo |> Option.map (fun (text, _, _) -> getQuickInfoText text) Assert.AreEqual(expected, actual) \ No newline at end of file From 1e1f0ec4365a364bd60fdea2df7c6394944fbebf Mon Sep 17 00:00:00 2001 From: Vasily Kirichenko Date: Fri, 16 Dec 2016 22:43:18 +0300 Subject: [PATCH 6/8] fix project file --- vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj | 1 - 1 file changed, 1 deletion(-) diff --git a/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj b/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj index a2eac2f1bde..f6b8961324e 100644 --- a/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj +++ b/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj @@ -50,7 +50,6 @@ - From cf09f9455eca5b5a7c02be3a8b91ded62b6f99ce Mon Sep 17 00:00:00 2001 From: Vasily Kirichenko Date: Sat, 17 Dec 2016 21:10:40 +0300 Subject: [PATCH 7/8] add Microsoft.VisualStudio.Imaging reference to all VS related projects --- vsintegration/packages.config | 1 - vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj | 3 --- .../FSharp.LanguageService.Base.csproj | 3 +++ .../src/FSharp.LanguageService/FSharp.LanguageService.fsproj | 3 +++ vsintegration/tests/Salsa/VisualFSharp.Salsa.fsproj | 3 +++ vsintegration/tests/unittests/VisualFSharp.Unittests.fsproj | 3 +++ 6 files changed, 12 insertions(+), 4 deletions(-) diff --git a/vsintegration/packages.config b/vsintegration/packages.config index fc1720883e7..17f244f2504 100644 --- a/vsintegration/packages.config +++ b/vsintegration/packages.config @@ -19,7 +19,6 @@ - diff --git a/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj b/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj index f6b8961324e..c8f83415118 100644 --- a/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj +++ b/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj @@ -120,9 +120,6 @@ $(FSharpSourcesRoot)\..\packages\Microsoft.VisualStudio.Imaging.$(RoslynVSPackagesVersion)\lib\net45\Microsoft.VisualStudio.Imaging.dll - $(FSharpSourcesRoot)\..\packages\Microsoft.VisualStudio.Utilities.$(RoslynVSPackagesVersion)\lib\net45\Microsoft.VisualStudio.Utilities.dll diff --git a/vsintegration/src/FSharp.LanguageService.Base/FSharp.LanguageService.Base.csproj b/vsintegration/src/FSharp.LanguageService.Base/FSharp.LanguageService.Base.csproj index 3cdd734ab5e..32dae6d49b4 100644 --- a/vsintegration/src/FSharp.LanguageService.Base/FSharp.LanguageService.Base.csproj +++ b/vsintegration/src/FSharp.LanguageService.Base/FSharp.LanguageService.Base.csproj @@ -124,6 +124,9 @@ $(FSharpSourcesRoot)\..\packages\Roslyn.Microsoft.VisualStudio.ComponentModelHost.0.0.2\lib\net46\Microsoft.VisualStudio.ComponentModelHost.dll + + $(FSharpSourcesRoot)\..\packages\Microsoft.VisualStudio.Imaging.$(RoslynVSPackagesVersion)\lib\net45\Microsoft.VisualStudio.Imaging.dll + {DED3BBD7-53F4-428A-8C9F-27968E768605} FSharp.Core diff --git a/vsintegration/src/FSharp.LanguageService/FSharp.LanguageService.fsproj b/vsintegration/src/FSharp.LanguageService/FSharp.LanguageService.fsproj index 54af1207843..fdbee63438b 100644 --- a/vsintegration/src/FSharp.LanguageService/FSharp.LanguageService.fsproj +++ b/vsintegration/src/FSharp.LanguageService/FSharp.LanguageService.fsproj @@ -138,6 +138,9 @@ $(FSharpSourcesRoot)\..\packages\Microsoft.VisualFSharp.Microsoft.VisualStudio.Shell.UI.Internal.14.0.25420\lib\net45\Microsoft.VisualStudio.Shell.UI.Internal.dll + + $(FSharpSourcesRoot)\..\packages\Microsoft.VisualStudio.Imaging.$(RoslynVSPackagesVersion)\lib\net45\Microsoft.VisualStudio.Imaging.dll + {DED3BBD7-53F4-428A-8C9F-27968E768605} diff --git a/vsintegration/tests/Salsa/VisualFSharp.Salsa.fsproj b/vsintegration/tests/Salsa/VisualFSharp.Salsa.fsproj index 57291e05efe..dd5a33d1512 100644 --- a/vsintegration/tests/Salsa/VisualFSharp.Salsa.fsproj +++ b/vsintegration/tests/Salsa/VisualFSharp.Salsa.fsproj @@ -101,6 +101,9 @@ $(FSharpSourcesRoot)\..\packages\Microsoft.VisualStudio.Shell.$(RoslynVSBinariesVersion).$(RoslynVSPackagesVersion)\lib\Microsoft.VisualStudio.Shell.$(RoslynVSBinariesVersion).dll True + + $(FSharpSourcesRoot)\..\packages\Microsoft.VisualStudio.Imaging.$(RoslynVSPackagesVersion)\lib\net45\Microsoft.VisualStudio.Imaging.dll + True $(NUnitLibDir)\nunit.framework.dll diff --git a/vsintegration/tests/unittests/VisualFSharp.Unittests.fsproj b/vsintegration/tests/unittests/VisualFSharp.Unittests.fsproj index 983f38c3319..eadf3f63ab6 100644 --- a/vsintegration/tests/unittests/VisualFSharp.Unittests.fsproj +++ b/vsintegration/tests/unittests/VisualFSharp.Unittests.fsproj @@ -204,6 +204,9 @@ $(FSharpSourcesRoot)\..\packages\Microsoft.VisualStudio.Editor.$(RoslynVSPackagesVersion)\lib\net45\Microsoft.VisualStudio.Editor.dll True + + $(FSharpSourcesRoot)\..\packages\Microsoft.VisualStudio.Imaging.$(RoslynVSPackagesVersion)\lib\net45\Microsoft.VisualStudio.Imaging.dll + From f4e94efccf2e69de0db5bf7860d96a7b24c55622 Mon Sep 17 00:00:00 2001 From: Vasily Kirichenko Date: Mon, 19 Dec 2016 11:30:35 +0300 Subject: [PATCH 8/8] do not use Roslyn internal type in public API --- .../src/FSharp.Editor/QuickInfo/QuickInfoProvider.fs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/vsintegration/src/FSharp.Editor/QuickInfo/QuickInfoProvider.fs b/vsintegration/src/FSharp.Editor/QuickInfo/QuickInfoProvider.fs index bd87669dad7..4bdd261d0d9 100644 --- a/vsintegration/src/FSharp.Editor/QuickInfo/QuickInfoProvider.fs +++ b/vsintegration/src/FSharp.Editor/QuickInfo/QuickInfoProvider.fs @@ -112,7 +112,8 @@ type internal FSharpQuickInfoProvider let xmlMemberIndexService = serviceProvider.GetService(typeof) :?> IVsXMLMemberIndexService let documentationBuilder = XmlDocumentation.CreateDocumentationBuilder(xmlMemberIndexService, serviceProvider.DTE) - static member ProvideQuickInfo(checker: FSharpChecker, documentId: DocumentId, sourceText: SourceText, filePath: string, position: int, options: FSharpProjectOptions, textVersionHash: int, cancellationToken: CancellationToken) = + static member ProvideQuickInfo(checker: FSharpChecker, documentId: DocumentId, sourceText: SourceText, filePath: string, position: int, + options: FSharpProjectOptions, textVersionHash: int, cancellationToken: CancellationToken) = async { let! _parseResults, checkResultsAnswer = checker.ParseAndCheckFileInProject(filePath, textVersionHash, sourceText.ToString(), options) let checkFileResults = @@ -144,7 +145,7 @@ type internal FSharpQuickInfoProvider let! symbolUse = checkFileResults.GetSymbolUseAtLocation(textLineNumber, islandColumn, textLine.ToString(), qualifiers) match symbolUse with | Some symbolUse -> - return Some(res, textSpan, Glyph.forSymbol symbolUse.Symbol) + return Some(res, textSpan, symbolUse.Symbol) | None -> return None | None -> return None } @@ -164,10 +165,10 @@ type internal FSharpQuickInfoProvider let! textVersion = document.GetTextVersionAsync(cancellationToken) |> Async.AwaitTask let! quickInfoResult = FSharpQuickInfoProvider.ProvideQuickInfo(checkerProvider.Checker, document.Id, sourceText, document.FilePath, position, options, textVersion.GetHashCode(), cancellationToken) match quickInfoResult with - | Some(toolTipElement, textSpan, glyph) -> + | Some(toolTipElement, textSpan, symbol) -> let dataTipText = XmlDocumentation.BuildDataTipText(documentationBuilder, toolTipElement) let textProperties = classificationFormatMapService.GetClassificationFormatMap("tooltip").DefaultTextProperties - return QuickInfoItem(textSpan, FSharpDeferredQuickInfoContent(dataTipText, textProperties, glyph)) + return QuickInfoItem(textSpan, FSharpDeferredQuickInfoContent(dataTipText, textProperties, Glyph.forSymbol symbol)) | None -> return null | None -> return null | None -> return null