Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
a1c30438
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a1c30438
编写于
8月 28, 2018
作者:
R
Rob Lourens
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix #57348 - fix input box suggest widget theming
上级
b704eb3a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
53 addition
and
34 deletion
+53
-34
src/vs/workbench/parts/codeEditor/browser/suggestEnabledInput.ts
...workbench/parts/codeEditor/browser/suggestEnabledInput.ts
+44
-22
src/vs/workbench/parts/extensions/electron-browser/extensionsViewlet.ts
...ch/parts/extensions/electron-browser/extensionsViewlet.ts
+3
-6
src/vs/workbench/parts/preferences/browser/settingsEditor2.ts
...vs/workbench/parts/preferences/browser/settingsEditor2.ts
+6
-6
未找到文件。
src/vs/workbench/parts/codeEditor/browser/suggestEnabledInput.ts
浏览文件 @
a1c30438
...
...
@@ -5,30 +5,32 @@
'
use strict
'
;
import
'
vs/css!./media/suggestEnabledInput
'
;
import
{
$
,
addClass
,
append
,
removeClass
,
Dimension
}
from
'
vs/base/browser/dom
'
;
import
{
$
,
addClass
,
append
,
Dimension
,
removeClass
}
from
'
vs/base/browser/dom
'
;
import
{
Widget
}
from
'
vs/base/browser/ui/widget
'
;
import
{
Color
}
from
'
vs/base/common/color
'
;
import
{
chain
,
Emitter
,
Event
}
from
'
vs/base/common/event
'
;
import
{
KeyCode
}
from
'
vs/base/common/keyCodes
'
;
import
{
IDisposable
,
dispos
e
}
from
'
vs/base/common/lifecycle
'
;
import
{
dispose
,
IDisposabl
e
}
from
'
vs/base/common/lifecycle
'
;
import
{
isMacintosh
}
from
'
vs/base/common/platform
'
;
import
uri
from
'
vs/base/common/uri
'
;
import
'
vs/css!./media/suggestEnabledInput
'
;
import
{
CodeEditorWidget
}
from
'
vs/editor/browser/widget/codeEditorWidget
'
;
import
{
IEditorOptions
}
from
'
vs/editor/common/config/editorOptions
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
ITextModel
}
from
'
vs/editor/common/model
'
;
import
*
as
modes
from
'
vs/editor/common/modes
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
ContextMenuController
}
from
'
vs/editor/contrib/contextmenu/contextmenu
'
;
import
{
SnippetController2
}
from
'
vs/editor/contrib/snippet/snippetController2
'
;
import
{
SuggestController
}
from
'
vs/editor/contrib/suggest/suggestController
'
;
import
{
IContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
inputBackground
,
inputBorder
,
inputForeground
,
inputPlaceholderForeground
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
ColorIdentifier
,
inputBackground
,
inputBorder
,
inputForeground
,
inputPlaceholderForeground
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
attachStyler
,
IStyleOverrides
,
IThemable
}
from
'
vs/platform/theme/common/styler
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
Component
}
from
'
vs/workbench/common/component
'
;
import
{
MenuPreventer
}
from
'
vs/workbench/parts/codeEditor/browser/menuPreventer
'
;
import
{
getSimpleEditorOptions
}
from
'
vs/workbench/parts/codeEditor/browser/simpleEditorOptions
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
ITextModel
}
from
'
vs/editor/common/model
'
;
import
{
IContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
interface
SuggestResultsProvider
{
/**
...
...
@@ -68,7 +70,29 @@ interface SuggestEnabledInputOptions {
focusContextKey
?:
IContextKey
<
boolean
>
;
}
export
class
SuggestEnabledInput
extends
Component
{
export
interface
ISuggestEnabledInputStyleOverrides
extends
IStyleOverrides
{
inputBackground
?:
ColorIdentifier
;
inputForeground
?:
ColorIdentifier
;
inputBorder
?:
ColorIdentifier
;
inputPlaceholderForeground
?:
ColorIdentifier
;
}
type
ISuggestEnabledInputStyles
=
{
[
P
in
keyof
ISuggestEnabledInputStyleOverrides
]:
Color
;
};
export
function
attachSuggestEnabledInputBoxStyler
(
widget
:
IThemable
,
themeService
:
IThemeService
,
style
?:
ISuggestEnabledInputStyleOverrides
):
IDisposable
{
return
attachStyler
(
themeService
,
{
inputBackground
:
(
style
&&
style
.
inputBackground
)
||
inputBackground
,
inputForeground
:
(
style
&&
style
.
inputForeground
)
||
inputForeground
,
inputBorder
:
(
style
&&
style
.
inputBorder
)
||
inputBorder
,
inputPlaceholderForeground
:
(
style
&&
style
.
inputPlaceholderForeground
)
||
inputPlaceholderForeground
,
}
as
ISuggestEnabledInputStyleOverrides
,
widget
);
}
export
class
SuggestEnabledInput
extends
Widget
implements
IThemable
{
private
_onShouldFocusResults
=
new
Emitter
<
void
>
();
readonly
onShouldFocusResults
:
Event
<
void
>
=
this
.
_onShouldFocusResults
.
event
;
...
...
@@ -91,11 +115,10 @@ export class SuggestEnabledInput extends Component {
ariaLabel
:
string
,
resourceHandle
:
string
,
options
:
SuggestEnabledInputOptions
,
@
IThemeService
themeService
:
IThemeService
,
@
IInstantiationService
instantiationService
:
IInstantiationService
,
@
IModelService
modelService
:
IModelService
,
)
{
super
(
id
,
themeService
);
super
();
this
.
stylingContainer
=
append
(
parent
,
$
(
'
.suggest-input-container
'
));
this
.
placeholderText
=
append
(
this
.
stylingContainer
,
$
(
'
.suggest-input-placeholder
'
,
null
,
options
.
placeholderText
||
''
));
...
...
@@ -178,21 +201,20 @@ export class SuggestEnabledInput extends Component {
}
public
updateStyles
():
void
{
super
.
updateStyles
();
this
.
stylingContainer
.
style
.
backgroundColor
=
this
.
getColor
(
inputBackground
);
this
.
stylingContainer
.
style
.
color
=
this
.
getColor
(
inputForeground
);
this
.
placeholderText
.
style
.
color
=
this
.
getColor
(
inputPlaceholderForeground
);
public
style
(
colors
:
ISuggestEnabledInputStyles
):
void
{
this
.
stylingContainer
.
style
.
backgroundColor
=
colors
.
inputBackground
&&
colors
.
inputBackground
.
toString
();
this
.
stylingContainer
.
style
.
color
=
colors
.
inputForeground
&&
colors
.
inputForeground
.
toString
();
this
.
placeholderText
.
style
.
color
=
colors
.
inputPlaceholderForeground
&&
colors
.
inputPlaceholderForeground
.
toString
();
const
inputBorderColor
=
this
.
getColor
(
inputBorder
);
this
.
stylingContainer
.
style
.
borderWidth
=
'
1px
'
;
this
.
stylingContainer
.
style
.
borderStyle
=
'
solid
'
;
this
.
stylingContainer
.
style
.
borderColor
=
inputBorderColor
||
'
transparent
'
;
this
.
stylingContainer
.
style
.
borderColor
=
colors
.
inputBorder
?
colors
.
inputBorder
.
toString
()
:
'
transparent
'
;
le
t
cursor
=
this
.
stylingContainer
.
getElementsByClassName
(
'
cursor
'
)[
0
]
as
HTMLDivElement
;
cons
t
cursor
=
this
.
stylingContainer
.
getElementsByClassName
(
'
cursor
'
)[
0
]
as
HTMLDivElement
;
if
(
cursor
)
{
cursor
.
style
.
backgroundColor
=
this
.
getColor
(
inputForeground
);
cursor
.
style
.
backgroundColor
=
colors
.
inputForeground
&&
colors
.
inputForeground
.
toString
(
);
}
}
...
...
src/vs/workbench/parts/extensions/electron-browser/extensionsViewlet.ts
浏览文件 @
a1c30438
...
...
@@ -55,7 +55,7 @@ import { ExtensionsWorkbenchService } from 'vs/workbench/parts/extensions/node/e
import
{
SyncDescriptor
}
from
'
vs/platform/instantiation/common/descriptors
'
;
import
{
SingleServerExtensionManagementServerService
}
from
'
vs/workbench/services/extensions/node/extensionManagementServerService
'
;
import
{
Query
}
from
'
vs/workbench/parts/extensions/common/extensionQuery
'
;
import
{
SuggestEnabledInput
}
from
'
vs/workbench/parts/codeEditor/browser/suggestEnabledInput
'
;
import
{
SuggestEnabledInput
,
attachSuggestEnabledInputBoxStyler
}
from
'
vs/workbench/parts/codeEditor/browser/suggestEnabledInput
'
;
interface
SearchInputEvent
extends
Event
{
target
:
HTMLInputElement
;
...
...
@@ -323,6 +323,8 @@ export class ExtensionsViewlet extends ViewContainerViewlet implements IExtensio
provideResults
:
(
query
)
=>
Query
.
suggestions
(
query
)
},
placeholder
,
'
extensions:searchinput
'
,
{
placeholderText
:
placeholder
});
this
.
disposables
.
push
(
attachSuggestEnabledInputBoxStyler
(
this
.
searchBox
,
this
.
themeService
));
this
.
disposables
.
push
(
this
.
searchBox
);
const
_searchChange
=
new
Emitter
<
string
>
();
...
...
@@ -338,11 +340,6 @@ export class ExtensionsViewlet extends ViewContainerViewlet implements IExtensio
return
super
.
create
(
this
.
extensionsBox
);
}
public
updateStyles
():
void
{
super
.
updateStyles
();
this
.
searchBox
.
updateStyles
();
}
setVisible
(
visible
:
boolean
):
TPromise
<
void
>
{
const
isVisibilityChanged
=
this
.
isVisible
()
!==
visible
;
return
super
.
setVisible
(
visible
).
then
(()
=>
{
...
...
src/vs/workbench/parts/preferences/browser/settingsEditor2.ts
浏览文件 @
a1c30438
...
...
@@ -34,7 +34,7 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
import
{
BaseEditor
}
from
'
vs/workbench/browser/parts/editor/baseEditor
'
;
import
{
EditorOptions
,
IEditor
}
from
'
vs/workbench/common/editor
'
;
import
{
ResourceEditorModel
}
from
'
vs/workbench/common/editor/resourceEditorModel
'
;
import
{
SuggestEnabledInput
}
from
'
vs/workbench/parts/codeEditor/browser/suggestEnabledInput
'
;
import
{
SuggestEnabledInput
,
attachSuggestEnabledInputBoxStyler
}
from
'
vs/workbench/parts/codeEditor/browser/suggestEnabledInput
'
;
import
{
PreferencesEditor
}
from
'
vs/workbench/parts/preferences/browser/preferencesEditor
'
;
import
{
SettingsTarget
,
SettingsTargetsWidget
}
from
'
vs/workbench/parts/preferences/browser/preferencesWidgets
'
;
import
{
commonlyUsedData
,
tocData
}
from
'
vs/workbench/parts/preferences/browser/settingsLayout
'
;
...
...
@@ -46,6 +46,7 @@ import { IEditorGroup } from 'vs/workbench/services/group/common/editorGroupsSer
import
{
IPreferencesService
,
ISearchResult
,
ISettingsEditorModel
}
from
'
vs/workbench/services/preferences/common/preferences
'
;
import
{
SettingsEditor2Input
}
from
'
vs/workbench/services/preferences/common/preferencesEditorInput
'
;
import
{
DefaultSettingsEditorModel
}
from
'
vs/workbench/services/preferences/common/preferencesModels
'
;
import
{
settingsTextInputBorder
}
from
'
vs/workbench/parts/preferences/browser/settingsWidgets
'
;
const
$
=
DOM
.
$
;
...
...
@@ -242,6 +243,10 @@ export class SettingsEditor2 extends BaseEditor {
// TODO: Aria-live
}));
this
.
_register
(
attachSuggestEnabledInputBoxStyler
(
this
.
searchWidget
,
this
.
themeService
,
{
inputBorder
:
settingsTextInputBorder
}));
this
.
countElement
=
DOM
.
append
(
searchContainer
,
DOM
.
$
(
'
.settings-count-widget
'
));
this
.
_register
(
attachStylerCallback
(
this
.
themeService
,
{
badgeBackground
,
contrastBorder
,
badgeForeground
},
colors
=>
{
const
background
=
colors
.
badgeBackground
?
colors
.
badgeBackground
.
toString
()
:
null
;
...
...
@@ -1021,11 +1026,6 @@ export class SettingsEditor2 extends BaseEditor {
this
.
settingsTreeRenderer
.
updateWidth
(
dimension
.
width
);
}
public
updateStyles
():
void
{
super
.
updateStyles
();
this
.
searchWidget
.
updateStyles
();
}
setVisible
(
visible
:
boolean
,
group
?:
IEditorGroup
):
TPromise
<
void
>
{
if
(
visible
)
{
this
.
searchWidget
.
focus
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录