Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
733b894d
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
733b894d
编写于
2月 04, 2019
作者:
J
Joey Robichaud
提交者:
GitHub
2月 04, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Default enhanced colors to on and no longer check experiment flights (#32960)
上级
86f3ee93
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
10 addition
and
29 deletion
+10
-29
src/VisualStudio/Core/Def/Implementation/Experimentation/EnhancedColorExperiment.cs
...Implementation/Experimentation/EnhancedColorExperiment.cs
+10
-29
未找到文件。
src/VisualStudio/Core/Def/Implementation/Experimentation/EnhancedColorExperiment.cs
浏览文件 @
733b894d
...
...
@@ -10,7 +10,6 @@
using
Microsoft.CodeAnalysis.Classification
;
using
Microsoft.CodeAnalysis.Editor
;
using
Microsoft.CodeAnalysis.Editor.Shared.Utilities
;
using
Microsoft.CodeAnalysis.Experiments
;
using
Microsoft.VisualStudio.PlatformUI
;
using
Microsoft.VisualStudio.Settings
;
using
Microsoft.VisualStudio.Shell
;
...
...
@@ -26,28 +25,22 @@ namespace Microsoft.VisualStudio.LanguageServices.Experimentation
[
TextViewRole
(
PredefinedTextViewRoles
.
Analyzable
)]
internal
class
EnhancedColorExperiment
:
ForegroundThreadAffinitizedObject
,
IWpfTextViewConnectionListener
,
IDisposable
{
private
const
string
UseEnhancedColorsFlight
=
"UseEnhancedColors"
;
private
const
string
StopEnhancedColorsFlight
=
"StopEnhancedColors"
;
private
const
string
UseEnhancedColorsSetting
=
"WindowManagement.Options.UseEnhancedColorsForManagedLanguages"
;
private
readonly
IExperimentationService
_experimentationService
;
private
readonly
IServiceProvider
_serviceProvider
;
private
EnhancedColorApplier
_colorApplier
;
private
ISettingsManager
_settingsManager
;
private
bool
_isDisposed
=
false
;
private
bool
_inUseEnhancedColorsFlight
;
private
bool
_inStopEnhancedColorsFlight
;
private
bool
_hasTextViewOpened
;
[
ImportingConstructor
]
[
Obsolete
]
private
EnhancedColorExperiment
(
IThreadingContext
threadingContext
,
[
Import
(
typeof
(
SVsServiceProvider
))]
IServiceProvider
serviceProvider
,
VisualStudioExperimentationService
experimentationService
)
private
EnhancedColorExperiment
(
IThreadingContext
threadingContext
,
[
Import
(
typeof
(
SVsServiceProvider
))]
IServiceProvider
serviceProvider
)
:
base
(
threadingContext
)
{
_serviceProvider
=
serviceProvider
;
_experimentationService
=
experimentationService
;
}
public
void
Dispose
()
...
...
@@ -66,21 +59,11 @@ public void SubjectBuffersConnected(IWpfTextView textView, ConnectionReason reas
_hasTextViewOpened
=
true
;
_colorApplier
=
new
EnhancedColorApplier
(
_serviceProvider
);
// Check which experimental flights we are in
_inUseEnhancedColorsFlight
=
_experimentationService
.
IsExperimentEnabled
(
UseEnhancedColorsFlight
);
_inStopEnhancedColorsFlight
=
_experimentationService
.
IsExperimentEnabled
(
StopEnhancedColorsFlight
);
_settingsManager
=
(
ISettingsManager
)
_serviceProvider
.
GetService
(
typeof
(
SVsSettingsPersistenceManager
));
// Do not hook settings changed if we have stopped the experiment.
// We will simply remove the enhanced colors if they are applied.
if
(!
_inStopEnhancedColorsFlight
)
{
// We need to update the theme whenever the Preview Setting changes or the VS Theme changes.
_settingsManager
.
GetSubset
(
UseEnhancedColorsSetting
).
SettingChangedAsync
+=
UseEnhancedColorsSettingChangedAsync
;
VSColorTheme
.
ThemeChanged
+=
VSColorTheme_ThemeChanged
;
}
// We need to update the theme whenever the Preview Setting changes or the VS Theme changes.
_settingsManager
.
GetSubset
(
UseEnhancedColorsSetting
).
SettingChangedAsync
+=
UseEnhancedColorsSettingChangedAsync
;
VSColorTheme
.
ThemeChanged
+=
VSColorTheme_ThemeChanged
;
VsTaskLibraryHelper
.
CreateAndStartTask
(
VsTaskLibraryHelper
.
ServiceInstance
,
VsTaskRunContext
.
UIThreadIdlePriority
,
UpdateThemeColors
);
}
...
...
@@ -117,15 +100,13 @@ private void UpdateThemeColors()
var
useEnhancedColorsSetting
=
_settingsManager
.
GetValueOrDefault
(
UseEnhancedColorsSetting
,
defaultValue
:
0
);
// useEnhancedColorsSetting
// 0 -> use value from flight.
// 1 -> always use enhanced colors (unless the kill flight is active).
// -1 -> never use enhanced colors.
var
inEnhancedFlightOrOptIn
=
_inUseEnhancedColorsFlight
||
useEnhancedColorsSetting
==
1
;
var
inStopFlightOrOptOut
=
_inStopEnhancedColorsFlight
||
useEnhancedColorsSetting
==
-
1
;
// 0 -> use enhanced colors.
// 1 -> use enhanced colors.
// -1 -> don't use enhanced colors.
// Try to set colors appropriately. We will only set colors if the user
// has not customized colors and we consider ourselves the color owner.
if
(
!
inStopFlightOrOptOut
&&
inEnhancedFlightOrOptIn
)
if
(
useEnhancedColorsSetting
!=
-
1
)
{
_colorApplier
.
TrySetEnhancedColors
(
currentThemeId
);
}
...
...
@@ -246,7 +227,7 @@ public void TrySetEnhancedColors(Guid themeId)
UpdateColorItem
(
colorItemMap
,
ClassificationTypeNames
.
OperatorOverloaded
,
DarkThemeMethodYellow
);
UpdateColorItem
(
colorItemMap
,
ClassificationTypeNames
.
ControlKeyword
,
DarkThemeControlKeywordPurple
);
UpdateColorItem
(
colorItemMap
,
ClassificationTypeNames
.
StructName
,
DarkThemeStructMint
);
UpdateColorItem
(
colorItemMap
,
ClassificationTypeNames
.
StaticSymbol
,
DefaultForegroundColor
,
DefaultBackgroundColor
,
isBold
:
true
);
UpdateColorItem
(
colorItemMap
,
ClassificationTypeNames
.
StaticSymbol
,
DefaultForegroundColor
,
DefaultBackgroundColor
);
}
else
{
...
...
@@ -257,7 +238,7 @@ public void TrySetEnhancedColors(Guid themeId)
UpdateColorItem
(
colorItemMap
,
ClassificationTypeNames
.
ExtensionMethodName
,
LightThemeMethodYellow
);
UpdateColorItem
(
colorItemMap
,
ClassificationTypeNames
.
OperatorOverloaded
,
LightThemeMethodYellow
);
UpdateColorItem
(
colorItemMap
,
ClassificationTypeNames
.
ControlKeyword
,
LightThemeControlKeywordPurple
);
UpdateColorItem
(
colorItemMap
,
ClassificationTypeNames
.
StaticSymbol
,
DefaultForegroundColor
,
DefaultBackgroundColor
,
isBold
:
true
);
UpdateColorItem
(
colorItemMap
,
ClassificationTypeNames
.
StaticSymbol
,
DefaultForegroundColor
,
DefaultBackgroundColor
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录