Skip to content
This repository has been archived by the owner on Oct 31, 2021. It is now read-only.

Printf specifiers tagger #1257

Merged

Conversation

vasily-kirichenko
Copy link
Contributor

It works like this:

6677

I'd like to use different color for this tags. Currently I reuse "MarkerFormatDefinition/HighlightedReference", as HighlightUsageTagger does. @dungpa do you know a way to add a color (visible in settings) and specify to use it in this new tagger? If I remember correctly, we did use a custom color for tags until we found out how to use the standard one.

@dungpa
Copy link
Contributor

dungpa commented Nov 19, 2015

Dig up the old code, here it is https://github.com/fsprojects/VisualFSharpPowerTools/blob/8c172d04050559655be75e28182ec8e3cc027641/src/FSharpVSPowerTools.Logic/HighlightUsageTagger.fs#L21-L35. The main issue is to hook up theme change in order to have appropriate colors for each theme.

@vasily-kirichenko
Copy link
Contributor Author

I stole the color for light theme from R#:

image

@vasily-kirichenko
Copy link
Contributor Author

@vasily-kirichenko
Copy link
Contributor Author

Fixed the issue with themes. Now we should grab the proper Dark theme color from R#.

@vasily-kirichenko
Copy link
Contributor Author

@dungpa do you think we should add a separate sub-setting for this feature?

@vasily-kirichenko
Copy link
Contributor Author

I think it's ready.

@vasily-kirichenko
Copy link
Contributor Author

Wait, it does not work for user defined printf functions.

@dungpa
Copy link
Contributor

dungpa commented Nov 20, 2015

Here is the color from R# dark theme:
image

DarkThemeColor = Color.FromRgb(128, 255, 128);

@vasily-kirichenko
Copy link
Contributor Author

@dungpa I mean the tags color, not classifier color. I've grabbed it.

OK, finding printf argument positions is rather messy, especially if they are forward/backward piped.

That said, the feature works in most case.

{ SpecifierRange: Range.range
ArgumentRange: Range.range }

let private sortRange (r: Range.range) = r.StartLine, r.StartColumn
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this mean 'startPos' i.e. a tuple denoting start position? (sortRange sounds like a totally different thing.)

@dungpa
Copy link
Contributor

dungpa commented Nov 20, 2015

Looks great. I agree it should be a separate feature with its own setting.

@vasily-kirichenko
Copy link
Contributor Author

All done.

@dungpa
Copy link
Contributor

dungpa commented Nov 21, 2015

Awesome.

dungpa added a commit that referenced this pull request Nov 21, 2015
@dungpa dungpa merged commit 025e726 into fsprojects-archive:master Nov 21, 2015
@WildBamboo
Copy link

This super handy feature doesn't seem to work in fsx files for me, but works in fs files. Is this known and expected, or a bug? I'm running Visual Studio 2013; F# 3.x I think. F# Interactive version 12.0.30815.0. Ok, yup, I have a C:\Program Files (x86)\Microsoft SDKs\F#\3.1\Framework\v4.0 folder but not a F# 4.0.

@dungpa
Copy link
Contributor

dungpa commented Dec 1, 2015

@WildBamboo It's a bug. Could you open a separate issue with more information e.g. (1) What is location of FSharp.Core 4.3.1.0 in your system? (2) Can you see any error logged in Diagnostics mode http://fsprojects.github.io/VisualFSharpPowerTools/faq.html#What-is-Diagnostic-mode-When-should-I-use-it? Thanks.

@WildBamboo
Copy link

Created issue #1257 and in the process got some more info. It appears <| usage breaks things. Probably what @vasily-kirichenko was getting at above:

OK, finding printf argument positions is rather messy, especially if they are forward/backward piped.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants