Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
5b73233f
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5b73233f
编写于
7月 22, 2020
作者:
R
Rachel Macfarlane
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add option to hide account icon in activity bar, fixes #97167
上级
c33dfcf3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
65 addition
and
10 deletion
+65
-10
src/vs/workbench/browser/parts/activitybar/activitybarActions.ts
...workbench/browser/parts/activitybar/activitybarActions.ts
+14
-1
src/vs/workbench/browser/parts/activitybar/activitybarPart.ts
...vs/workbench/browser/parts/activitybar/activitybarPart.ts
+51
-9
未找到文件。
src/vs/workbench/browser/parts/activitybar/activitybarActions.ts
浏览文件 @
5b73233f
...
...
@@ -33,6 +33,7 @@ import { ContextSubMenu } from 'vs/base/browser/contextmenu';
import
{
IAuthenticationService
}
from
'
vs/workbench/services/authentication/browser/authenticationService
'
;
import
{
AuthenticationSession
}
from
'
vs/editor/common/modes
'
;
import
{
IWorkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/common/environmentService
'
;
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
export
class
ViewContainerActivityAction
extends
ActivityAction
{
...
...
@@ -98,6 +99,8 @@ export class ViewContainerActivityAction extends ActivityAction {
}
}
export
const
ACCOUNTS_VISIBILITY_PREFERENCE_KEY
=
'
workbench.activity.showAccounts
'
;
export
class
AccountsActionViewItem
extends
ActivityActionViewItem
{
constructor
(
action
:
ActivityAction
,
...
...
@@ -107,7 +110,8 @@ export class AccountsActionViewItem extends ActivityActionViewItem {
@
IMenuService
protected
menuService
:
IMenuService
,
@
IContextKeyService
private
readonly
contextKeyService
:
IContextKeyService
,
@
IAuthenticationService
private
readonly
authenticationService
:
IAuthenticationService
,
@
IWorkbenchEnvironmentService
private
readonly
environmentService
:
IWorkbenchEnvironmentService
@
IWorkbenchEnvironmentService
private
readonly
environmentService
:
IWorkbenchEnvironmentService
,
@
IStorageService
private
readonly
storageService
:
IStorageService
)
{
super
(
action
,
{
draggable
:
false
,
colors
,
icon
:
true
},
themeService
);
}
...
...
@@ -190,6 +194,15 @@ export class AccountsActionViewItem extends ActivityActionViewItem {
}
});
if
(
menus
.
length
)
{
menus
.
push
(
new
Separator
());
}
menus
.
push
(
new
Action
(
'
hide
'
,
nls
.
localize
(
'
hide
'
,
"
Hide
"
),
undefined
,
true
,
_
=>
{
this
.
storageService
.
store
(
ACCOUNTS_VISIBILITY_PREFERENCE_KEY
,
false
,
StorageScope
.
GLOBAL
);
return
Promise
.
resolve
();
}));
return
menus
;
}
...
...
src/vs/workbench/browser/parts/activitybar/activitybarPart.ts
浏览文件 @
5b73233f
...
...
@@ -5,10 +5,10 @@
import
'
vs/css!./media/activitybarpart
'
;
import
*
as
nls
from
'
vs/nls
'
;
import
{
ActionsOrientation
,
ActionBar
}
from
'
vs/base/browser/ui/actionbar/actionbar
'
;
import
{
ActionsOrientation
,
ActionBar
,
Separator
}
from
'
vs/base/browser/ui/actionbar/actionbar
'
;
import
{
GLOBAL_ACTIVITY_ID
,
IActivity
,
ACCOUNTS_ACTIIVTY_ID
}
from
'
vs/workbench/common/activity
'
;
import
{
Part
}
from
'
vs/workbench/browser/part
'
;
import
{
GlobalActivityActionViewItem
,
ViewContainerActivityAction
,
PlaceHolderToggleCompositePinnedAction
,
PlaceHolderViewContainerActivityAction
,
AccountsActionViewItem
,
HomeAction
,
HomeActionViewItem
}
from
'
vs/workbench/browser/parts/activitybar/activitybarActions
'
;
import
{
GlobalActivityActionViewItem
,
ViewContainerActivityAction
,
PlaceHolderToggleCompositePinnedAction
,
PlaceHolderViewContainerActivityAction
,
AccountsActionViewItem
,
HomeAction
,
HomeActionViewItem
,
ACCOUNTS_VISIBILITY_PREFERENCE_KEY
}
from
'
vs/workbench/browser/parts/activitybar/activitybarActions
'
;
import
{
IBadge
,
NumberBadge
}
from
'
vs/workbench/services/activity/common/activity
'
;
import
{
IWorkbenchLayoutService
,
Parts
}
from
'
vs/workbench/services/layout/browser/layoutService
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
...
...
@@ -75,7 +75,7 @@ export class ActivitybarPart extends Part implements IActivityBarService {
static
readonly
PINNED_VIEW_CONTAINERS
=
'
workbench.activity.pinnedViewlets2
'
;
private
static
readonly
PLACEHOLDER_VIEW_CONTAINERS
=
'
workbench.activity.placeholderViewlets
'
;
private
static
readonly
HOME_BAR_VISIBILITY_PREFERENCE
=
'
workbench.activity.showHomeIndicator
'
;
private
static
readonly
ACCOUNTS_ACTION_INDEX
=
0
;
//#region IView
readonly
minimumWidth
:
number
=
48
;
...
...
@@ -164,6 +164,18 @@ export class ActivitybarPart extends Part implements IActivityBarService {
actions
.
push
(
this
.
instantiationService
.
createInstance
(
ToggleMenuBarAction
,
ToggleMenuBarAction
.
ID
,
menuBarVisibility
===
'
compact
'
?
nls
.
localize
(
'
hideMenu
'
,
"
Hide Menu
"
)
:
nls
.
localize
(
'
showMenu
'
,
"
Show Menu
"
)));
}
const
toggleAccountsVisibilityAction
=
new
Action
(
'
toggleAccountsVisibility
'
,
nls
.
localize
(
'
accounts
'
,
"
Accounts
"
),
undefined
,
true
,
async
()
=>
{
this
.
accountsVisibilityPreference
=
!
this
.
accountsVisibilityPreference
;
}
);
toggleAccountsVisibilityAction
.
checked
=
!!
this
.
accountsActivityAction
;
actions
.
push
(
toggleAccountsVisibilityAction
);
actions
.
push
(
new
Separator
());
actions
.
push
(
new
Action
(
ToggleActivityBarVisibilityAction
.
ID
,
nls
.
localize
(
'
hideActivitBar
'
,
"
Hide Activity Bar
"
),
...
...
@@ -587,17 +599,35 @@ export class ActivitybarPart extends Part implements IActivityBarService {
cssClass
:
Codicon
.
settingsGear
.
classNames
});
this
.
accountsActivityAction
=
new
ActivityAction
({
id
:
'
workbench.actions.accounts
'
,
name
:
nls
.
localize
(
'
accounts
'
,
"
Accounts
"
),
cssClass
:
Codicon
.
account
.
classNames
});
if
(
this
.
accountsVisibilityPreference
)
{
this
.
accountsActivityAction
=
new
ActivityAction
({
id
:
'
workbench.actions.accounts
'
,
name
:
nls
.
localize
(
'
accounts
'
,
"
Accounts
"
),
cssClass
:
Codicon
.
account
.
classNames
});
this
.
globalActivityActionBar
.
push
(
this
.
accountsActivityAction
);
this
.
globalActivityActionBar
.
push
(
this
.
accountsActivityAction
,
{
index
:
ActivitybarPart
.
ACCOUNTS_ACTION_INDEX
});
}
this
.
globalActivityActionBar
.
push
(
this
.
globalActivityAction
);
}
private
toggleAccountsActivity
()
{
if
(
this
.
globalActivityActionBar
)
{
if
(
this
.
accountsActivityAction
)
{
this
.
globalActivityActionBar
.
pull
(
ActivitybarPart
.
ACCOUNTS_ACTION_INDEX
);
this
.
accountsActivityAction
=
undefined
;
}
else
{
this
.
accountsActivityAction
=
new
ActivityAction
({
id
:
'
workbench.actions.accounts
'
,
name
:
nls
.
localize
(
'
accounts
'
,
"
Accounts
"
),
cssClass
:
Codicon
.
account
.
classNames
});
this
.
globalActivityActionBar
.
push
(
this
.
accountsActivityAction
,
{
index
:
ActivitybarPart
.
ACCOUNTS_ACTION_INDEX
});
}
}
}
private
getCompositeActions
(
compositeId
:
string
):
{
activityAction
:
ViewContainerActivityAction
,
pinnedAction
:
ToggleCompositePinnedAction
}
{
let
compositeActions
=
this
.
compositeActions
.
get
(
compositeId
);
if
(
!
compositeActions
)
{
...
...
@@ -827,6 +857,10 @@ export class ActivitybarPart extends Part implements IActivityBarService {
if
(
e
.
key
===
ActivitybarPart
.
HOME_BAR_VISIBILITY_PREFERENCE
&&
e
.
scope
===
StorageScope
.
GLOBAL
)
{
this
.
onDidChangeHomeBarVisibility
();
}
if
(
e
.
key
===
ACCOUNTS_VISIBILITY_PREFERENCE_KEY
&&
e
.
scope
===
StorageScope
.
GLOBAL
)
{
this
.
toggleAccountsActivity
();
}
}
private
saveCachedViewContainers
():
void
{
...
...
@@ -964,6 +998,14 @@ export class ActivitybarPart extends Part implements IActivityBarService {
this
.
storageService
.
store
(
ActivitybarPart
.
HOME_BAR_VISIBILITY_PREFERENCE
,
value
,
StorageScope
.
GLOBAL
);
}
private
get
accountsVisibilityPreference
():
boolean
{
return
this
.
storageService
.
getBoolean
(
ACCOUNTS_VISIBILITY_PREFERENCE_KEY
,
StorageScope
.
GLOBAL
,
true
);
}
private
set
accountsVisibilityPreference
(
value
:
boolean
)
{
this
.
storageService
.
store
(
ACCOUNTS_VISIBILITY_PREFERENCE_KEY
,
value
,
StorageScope
.
GLOBAL
);
}
private
migrateFromOldCachedViewContainersValue
():
void
{
const
value
=
this
.
storageService
.
get
(
'
workbench.activity.pinnedViewlets
'
,
StorageScope
.
GLOBAL
);
if
(
value
!==
undefined
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录