Skip to content

Quick info glyph #2028

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

Closed

Conversation

vasily-kirichenko
Copy link
Contributor

WIP

image

  • Show proper glyph for each language construct

@vasily-kirichenko
Copy link
Contributor Author

It's ready

1

@forki
Copy link
Contributor

forki commented Dec 16, 2016

Amazing. You even fix the details. Hero.

@KevinRansom
Copy link
Contributor

@vasily-kirichenko
The CI sees a Build error:
this should repro it:
build vs

  D:\j\workspace\release_ci_pa---3f142ccc\vsintegration\tests\unittests\QuickInfoProviderTests.fs(103,52): error FS0001: Type mismatch. Expecting a�    'FSharpToolTipText * TextSpan * Glyph'    �but given a�    'FSharpToolTipText * TextSpan'    �The tuples have differing lengths of 3 and 2 [D:\j\workspace\release_ci_pa---3f142ccc\vsintegration\tests\unittests\VisualFSharp.Unittests.fsproj]


@vasily-kirichenko
Copy link
Contributor Author

@KevinRansom fixed.

@KevinRansom
Copy link
Contributor

@vasily-kirichenko
ty

@vasily-kirichenko
Copy link
Contributor Author

Let me know if I should merge with master (when master is green again).

@KevinRansom
Copy link
Contributor

@vasily-kirichenko
Copy link
Contributor Author

Both should use IncludesRightColumn

@KevinRansom
Copy link
Contributor

Yay ... I guessed right :-)

@vasily-kirichenko
Copy link
Contributor Author

:) All features use IncludesRightColumn except Quick Info, because the tooltip appear too early when you move cursor towards a symbol from right side, like this: symbol |, should work like this: symbol|

@vasily-kirichenko
Copy link
Contributor Author

I've merged with master.

@KevinRansom
Copy link
Contributor

@dotnet-bot test this please

@cartermp
Copy link
Contributor

Love it!

Next step is hooking up to a presenter to get type colors in there. I plan on looking at that over Christmas time. Well, assuming you don't already have it implemented by then :p

@Pilchie
Copy link
Member

Pilchie commented Dec 16, 2016

You don't need a custom presenter - you should look at how Roslyn does it here with TaggedText

Copy link
Contributor

@KevinRansom KevinRansom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

other than packages this looks good.

@@ -18,6 +18,8 @@
<package id="Microsoft.VisualStudio.Shell.Design" version="14.3.25407" targetFramework="net46" />
<package id="Microsoft.VisualStudio.Settings.15.0" version="15.0.25824-RC" targetFramework="net46" />
<package id="Microsoft.VisualStudio.Utilities" version="14.3.25407" targetFramework="net46" />
<package id="Microsoft.VisualStudio.Imaging" version="14.3.25407" targetFramework="net46" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or perhaps we should get 2.0.0-rc2 versions published

@@ -113,6 +117,12 @@
<Reference Include="Microsoft.VisualStudio.CoreUtility, Version=$(RoslynVSBinariesVersion).0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>$(FSharpSourcesRoot)\..\packages\Microsoft.VisualStudio.CoreUtility.$(RoslynVSPackagesVersion)\lib\net45\Microsoft.VisualStudio.CoreUtility.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.Imaging, Version=$(RoslynVSBinariesVersion).0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>$(FSharpSourcesRoot)\..\packages\Microsoft.VisualStudio.Imaging.$(RoslynVSPackagesVersion)\lib\net45\Microsoft.VisualStudio.Imaging.dll</HintPath>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The package path might not be right.

@vasily-kirichenko
Copy link
Contributor Author

@KevinRansom I'm not sure I understand how VS package versioning set up here. Why these references so complicated? https://github.com/Microsoft/visualfsharp/blob/master/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj#L92-L133

It looks like all VisualStudio.xxx packages are assumed to have exactly same RoslynVSBinariesVersion version:

 <Reference Include="Microsoft.VisualStudio.Editor, Version=$(RoslynVSBinariesVersion).0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
      <HintPath>$(FSharpSourcesRoot)\..\packages\Microsoft.VisualStudio.Editor.$(RoslynVSPackagesVersion)\lib\net45\Microsoft.VisualStudio.Editor.dll</HintPath>
    </Reference>

That's not the case we have currently:

<package id="Microsoft.VisualStudio.LanguageServices" version="2.0.0-rc2" targetFramework="net46" />
  <package id="Microsoft.Composition" version="1.0.27" targetFramework="net46" />
  <package id="Microsoft.VisualStudio.Package.LanguageService.14.0" version="14.3.25407" targetFramework="net46" />
  <package id="Microsoft.VisualStudio.Editor" version="14.3.25407" targetFramework="net46" />
  <package id="Microsoft.VisualStudio.Text.UI" version="14.3.25407" targetFramework="net46" />
  <package id="Microsoft.VisualStudio.Text.UI.Wpf" version="14.3.25407" targetFramework="net46" />
  <package id="Microsoft.VisualStudio.Text.Data" version="14.3.25407" targetFramework="net46" />
  <package id="Microsoft.VisualStudio.Text.Logic" version="14.3.25407" targetFramework="net46" />
  <package id="Microsoft.VisualStudio.Threading" version="14.1.131" targetFramework="net46" />
  <package id="Microsoft.VisualStudio.CoreUtility" version="14.3.25407" targetFramework="net46" />
  <package id="Microsoft.VisualStudio.Shell.Design" version="14.3.25407" targetFramework="net46" />
  <package id="Microsoft.VisualStudio.Settings.15.0" version="15.0.25824-RC" targetFramework="net46" />
  <package id="Microsoft.VisualStudio.Utilities" version="14.3.25407" targetFramework="net46" />
  <package id="Microsoft.VisualStudio.Language.StandardClassification" version="14.3.25407" targetFramework="net46" />
  <package id="Microsoft.VisualStudio.Language.Intellisense" version="14.3.25407" targetFramework="net46" />
  <package id="Microsoft.VisualStudio.Designer.Interfaces" version="1.1.4322" />

You suggest to update Imaging to RC, so how it should be done? Some packages are available in version 15.0.25901-RC, some are not.

I found this approach hard to maintain. Why just not use VS UI to manage the packages automagically?
(However, I've not managed to get any results trying to gather updated packages with it)

@vladima
Copy link
Contributor

vladima commented Dec 17, 2016

getting there...
image

@vasily-kirichenko
Copy link
Contributor Author

@vladima Oh, cool!

@vasily-kirichenko
Copy link
Contributor Author

vasily-kirichenko commented Dec 17, 2016

OK, I've sorted out the packages versions, now VisualFSharp.sln builds successfully on clean checkout.

@dungpa
Copy link
Contributor

dungpa commented Dec 17, 2016

@Pilchie @vladima I tried to colorize signature help by changing https://github.com/Microsoft/visualfsharp/blob/ca2ed9bfbec4710802f3782ce8840ec060618347/vsintegration/src/FSharp.Editor/Completion/SignatureHelp.fs#L182-L206 to use TextTags.Class, TextTags.Keyword, etc. However, F# signature helps still have no color.

Any idea on creating a signature help presenter for F#?

@vasily-kirichenko
Copy link
Contributor Author

@dungpa
Copy link
Contributor

dungpa commented Dec 17, 2016

I think it's relevant but should not be necessary. The signature help is colorized at http://source.roslyn.io/#Microsoft.CodeAnalysis.EditorFeatures/Implementation/Intellisense/SignatureHelp/Presentation/SignatureHelpClassifier.cs,50

The signature help classifier is restricted to C#/VB at http://source.roslyn.io/#Microsoft.CodeAnalysis.EditorFeatures/Implementation/Intellisense/SignatureHelp/Presentation/SignatureHelpClassifierProvider.cs,13. What is the easiest way to enable this for F# signature help? /cc @Pilchie @vladima

@dungpa
Copy link
Contributor

dungpa commented Dec 17, 2016

Ok, I found a way in #2034

@vasily-kirichenko
Copy link
Contributor Author

Tests fail because VisualFSharp.unittests.dll cannot be loaded:

image

Any ideas how to spot the wrong/missing assembly?

I think that the way packages are managed in this repository is unhealthy. What about switching to Paket?

/cc @forki

@vasily-kirichenko
Copy link
Contributor Author

OK, I reverted the big changes (VS packages ver. 14 -> 15) and it's now simply adds a single Microsoft.VisualStudio.Imaging ver. 14. Same error on loading the test dll :(

@vasily-kirichenko
Copy link
Contributor Author

I'm stuck with this :(

@KevinRansom
Copy link
Contributor

@vasily-kirichenko
I can take a look mate.

@vasily-kirichenko
Copy link
Contributor Author

@KevinRansom thanks!

@vasily-kirichenko
Copy link
Contributor Author

@KevinRansom Microsoft.VisualStudio.Imaging is here for a single reason - we use CryspImage type from it. I've ported this code http://source.roslyn.io/#Microsoft.CodeAnalysis.EditorFeatures/Implementation/Intellisense/QuickInfo/DeferredContent/SymbolGlyphDeferredContent.cs,26 as is, if it helps.

BTW, I had to write this unsafe casting:

let moniker = GlyphExtensions.GetImageMoniker(glyph)
let image = new CrispImage()
image.Moniker <- (box moniker) :?> _

because ImageMoniker returned by the extension method is different from CryspImage.Moniker expects (both are identical simple structures, so it works). Maybe it's a hint of why this type loading error occurs.

@KevinRansom
Copy link
Contributor

KevinRansom commented Dec 19, 2016

@vasily-kirichenko @Pilchie @brettfo

This happens because the Roslyn dll's do not have InternalsVisible enabled for VisualFSharpTests.dll

https://github.com/Microsoft/visualfsharp/blob/master/vsintegration/src/FSharp.Editor/QuickInfo/QuickInfoProvider.fs#L73

This guy's async returns a value:

Microsoft.FSharp.Core.FSharpFunc`2[System.Tuple`3[
    Microsoft.FSharp.Compiler.SourceCodeServices.FSharpToolTipText,
    Microsoft.CodeAnalysis.Text.TextSpan,Microsoft.CodeAnalysis.Glyph],System.String]

Microsoft.CodeAnalysis.Glyph is internal and thus can not be seen from the test dll.

Which means it can't be used in test code unless the test code has Internals Visible enabled for it:

Either:
1.Rewrite to completely isolate Microsoft.CodeAnalysis.Glyph we actually are mostly there already
or ...
2. Modify Roslyn to Make Glyph public
or ...
3. set internals visible to our test assembly.

@vasily-kirichenko
Copy link
Contributor Author

vasily-kirichenko commented Dec 19, 2016

@KevinRansom Thanks! Will try #1.

@vasily-kirichenko
Copy link
Contributor Author

@KevinRansom fixed. I can load and run the tests locally. Phew, that was a tricky nasty stuff. Thanks!

@vasily-kirichenko
Copy link
Contributor Author

@dotnet-bot test this please

@KevinRansom
Copy link
Contributor

Hmmm that failure is absolutely not expected.
@dotnet-bot test this please

@vasily-kirichenko
Copy link
Contributor Author

vasily-kirichenko commented Dec 19, 2016

@vladima has almost finished his work on colorful quick info tooltips here master...vladima:vladima/classification which operates on a slightly higher level of abstraction than this PR and it's incompatible with it anyway. So I'm closing this in favor of vladima#1 (or whatever approach @vladima will choose for showing the glyph). Currently it looks like this:

image

@KevinRansom
Copy link
Contributor

Okay ... thanks.

@vasily-kirichenko
Copy link
Contributor Author

@KevinRansom sorry for wasting your time :(

@KevinRansom
Copy link
Contributor

@vasily-kirichenko
It's never a waste of my time mate ... and besides, even if it were (which it wasn't) .... you paid me back many thousands of times with all of your awesome IDE PR's. I reckon I owe you tons.

Kevin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants