Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
fsharp
提交
6082fa80
F
fsharp
项目概览
dotNET Platform
/
fsharp
11 个月 前同步成功
通知
0
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
fsharp
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6082fa80
编写于
4月 19, 2017
作者:
J
Jakub Majocha
提交者:
Kevin Ransom (msft)
4月 19, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Style QuickInfo links in XAML (#2883)
* quickinfo styles in xaml * refactor * reduce diff
上级
4fcfb8b6
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
62 addition
and
41 deletion
+62
-41
vsintegration/src/FSharp.Editor/QuickInfo/Views.fs
vsintegration/src/FSharp.Editor/QuickInfo/Views.fs
+16
-41
vsintegration/src/FSharp.UIResources/FSharp.UIResources.csproj
...egration/src/FSharp.UIResources/FSharp.UIResources.csproj
+4
-0
vsintegration/src/FSharp.UIResources/HyperlinkStyles.xaml
vsintegration/src/FSharp.UIResources/HyperlinkStyles.xaml
+42
-0
未找到文件。
vsintegration/src/FSharp.Editor/QuickInfo/Views.fs
浏览文件 @
6082fa80
namespace
Microsoft
.
VisualStudio
.
FSharp
.
Editor
open
System
.
ComponentModel
.
Composition
open
System
open
System
.
Windows
open
System
.
Windows
.
Controls
open
System
.
Windows
.
Data
open
System
.
Windows
.
Media
open
Microsoft
.
CodeAnalysis
open
Microsoft
.
CodeAnalysis
.
Classification
...
...
@@ -35,44 +34,19 @@ module private SessionHandling =
member
__.
AugmentQuickInfoSession
(
session
,_,_)
=
currentSession
<-
Some
session
member
__.
Dispose
()
=
()
}
module
private
SourceLink
=
let
solid
=
70
uy
,
DashStyles
.
Solid
let
dot
=
255
uy
,
DashStyle
([
1
.
0
;
5
.
0
],
0
.
0
)
let
dash
=
90
uy
,
DashStyle
([
5
.
0
;
5
.
0
],
0
.
0
)
let
none
=
0
uy
,
DashStyles
.
Solid
let
opacityCoverter
=
{
new
IValueConverter
with
member
this
.
Convert
(
value
,
_,
parameter
,
_)
=
match
value
with
|
:?
Color
as
c
->
Color
.
FromArgb
(
unbox
parameter
,
c
.
R
,
c
.
G
,
c
.
B
)
:>
_
|
_
->
Binding
.
DoNothing
member
this
.
ConvertBack
(_,_,_,_)
=
Binding
.
DoNothing
}
let
getUnderlineStyle
()
=
if
not
Settings
.
QuickInfo
.
DisplayLinks
then
none
else
match
Settings
.
QuickInfo
.
UnderlineStyle
with
|
QuickInfoUnderlineStyle
.
Solid
->
solid
|
QuickInfoUnderlineStyle
.
Dot
->
dot
|
QuickInfoUnderlineStyle
.
Dash
->
dash
type
internal
SourceLink
(
run
)
as
this
=
inherit
Documents
.
Hyperlink
(
run
)
let
opacity
,
dashStyle
=
SourceLink
.
getUnderlineStyle
()
let
underlineBrush
=
Media
.
SolidColorBrush
()
do
BindingOperations
.
SetBinding
(
underlineBrush
,
SolidColorBrush
.
ColorProperty
,
Binding
(
"Foreground.Color"
,
Source
=
this
,
Converter
=
SourceLink
.
opacityCoverter
,
ConverterParameter
=
opacity
))
|>
ignore
let
normalUnderline
=
TextDecorationCollection
[
TextDecoration
(
Location
=
TextDecorationLocation
.
Underline
,
PenOffset
=
1
.
0
)]
let
slightUnderline
=
TextDecorationCollection
[
TextDecoration
(
Location
=
TextDecorationLocation
.
Underline
,
PenOffset
=
1
.
0
,
Pen
=
Pen
(
Brush
=
underlineBrush
,
DashStyle
=
dashStyle
))]
do
this
.
TextDecorations
<-
slightUnderline
override
this
.
OnMouseEnter
(
e
)
=
base
.
OnMouseEnter
(
e
)
this
.
TextDecorations
<-
normalUnderline
override
this
.
OnMouseLeave
(
e
)
=
base
.
OnMouseLeave
(
e
)
this
.
TextDecorations
<-
slightUnderline
module
private
HyperlinkStyles
=
// TODO: move this one time initialization to a more suitable spot
do
Application
.
ResourceAssembly
<-
typeof
<
Microsoft
.
VisualStudio
.
FSharp
.
UIResources
.
Strings
>.
Assembly
let
private
styles
=
ResourceDictionary
(
Source
=
Uri
(
"HyperlinkStyles.xaml"
,
UriKind
.
Relative
))
let
getCurrent
()
:
Style
=
let
key
=
if
Settings
.
QuickInfo
.
DisplayLinks
then
match
Settings
.
QuickInfo
.
UnderlineStyle
with
|
QuickInfoUnderlineStyle
.
Solid
->
"solid_underline"
|
QuickInfoUnderlineStyle
.
Dot
->
"dot_underline"
|
QuickInfoUnderlineStyle
.
Dash
->
"dash_underline"
else
"no_underline"
downcast
styles
.[
key
]
[<
Export
>]
type
internal
QuickInfoViewProvider
...
...
@@ -105,7 +79,7 @@ type internal QuickInfoViewProvider
let
inl
=
match
taggedText
with
|
:?
Layout
.
NavigableTaggedText
as
nav
when
navigation
.
IsTargetValid
nav
.
Range
->
let
h
=
SourceLink
(
run
,
ToolTip
=
nav
.
Range
.
FileName
)
let
h
=
Documents
.
Hyperlink
(
run
,
ToolTip
=
nav
.
Range
.
FileName
)
h
.
Click
.
Add
<|
navigateAndDismiss
nav
.
Range
h
:>
Documents
.
Inline
|
_
->
run
:>
_
...
...
@@ -118,6 +92,7 @@ type internal QuickInfoViewProvider
DependencyObjectExtensions
.
SetDefaultTextProperties
(
tb
,
formatMap
.
Value
)
tb
.
Inlines
.
AddRange
inlines
if
tb
.
Inlines
.
Count
=
0
then
tb
.
Visibility
<-
Visibility
.
Collapsed
tb
.
Resources
.[
typeof
<
Documents
.
Hyperlink
>]
<-
HyperlinkStyles
.
getCurrent
()
tb
:>
FrameworkElement
{
new
IDeferredQuickInfoContent
with
member
x
.
Create
()
=
createTextLinks
()
}
...
...
vsintegration/src/FSharp.UIResources/FSharp.UIResources.csproj
浏览文件 @
6082fa80
...
...
@@ -76,6 +76,10 @@
<Generator>
MSBuild:Compile
</Generator>
<SubType>
Designer
</SubType>
</Page>
<Page
Include=
"HyperlinkStyles.xaml"
>
<Generator>
MSBuild:Compile
</Generator>
<SubType>
Designer
</SubType>
</Page>
<Page
Include=
"IntelliSenseOptionControl.xaml"
>
<SubType>
Designer
</SubType>
<Generator>
MSBuild:Compile
</Generator>
...
...
vsintegration/src/FSharp.UIResources/HyperlinkStyles.xaml
0 → 100644
浏览文件 @
6082fa80
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="inherited_brush" Color="{Binding Foreground.Color, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Hyperlink}}" />
<SolidColorBrush x:Key="inherited_semi_brush" Opacity="0.28" Color="{Binding Foreground.Color, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Hyperlink}}" />
<DashStyle x:Key="dash_dashstyle" Dashes="5 5"/>
<DashStyle x:Key="dot_dashstyle" Dashes="1 5"/>
<Pen x:Key="dot_pen" DashStyle="{StaticResource dot_dashstyle}" Brush="{StaticResource inherited_brush}"/>
<Pen x:Key="solid_pen" Brush="{StaticResource inherited_semi_brush}"/>
<Pen x:Key="mouseover_pen" Brush="{StaticResource inherited_brush}"/>
<Pen x:Key="dash_pen" DashStyle="{StaticResource dash_dashstyle}" Brush="{StaticResource inherited_semi_brush}"/>
<TextDecorationCollection x:Key="solid_deco">
<TextDecoration PenOffset="1" Pen="{StaticResource solid_pen}"/>
</TextDecorationCollection>
<TextDecorationCollection x:Key="dash_deco">
<TextDecoration PenOffset="1" Pen="{StaticResource dash_pen}"/>
</TextDecorationCollection>
<TextDecorationCollection x:Key="dot_deco">
<TextDecoration PenOffset="1" Pen="{StaticResource dot_pen}"/>
</TextDecorationCollection>
<TextDecorationCollection x:Key="full_deco">
<TextDecoration PenOffset="1" Pen="{StaticResource mouseover_pen}" />
</TextDecorationCollection>
<Style x:Key="base_sourcelink" TargetType="Hyperlink" >
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="TextDecorations" Value="{StaticResource full_deco}"/>
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="solid_underline" TargetType="Hyperlink" BasedOn="{StaticResource base_sourcelink}">
<Setter Property="TextDecorations" Value="{StaticResource solid_deco}"/>
</Style>
<Style x:Key="dash_underline" TargetType="Hyperlink" BasedOn="{StaticResource base_sourcelink}">
<Setter Property="TextDecorations" Value="{StaticResource dash_deco}"/>
</Style>
<Style x:Key="dot_underline" TargetType="Hyperlink" BasedOn="{StaticResource base_sourcelink}">
<Setter Property="TextDecorations" Value="{StaticResource dot_deco}"/>
</Style>
<Style x:Key="no_underline" TargetType="Hyperlink" BasedOn="{StaticResource base_sourcelink}">
<Setter Property="TextDecorations" Value="{x:Null}"/>
</Style>
</ResourceDictionary>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录