Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
306235b1
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,发现更多精彩内容 >>
未验证
提交
306235b1
编写于
5月 08, 2020
作者:
R
Rob Lourens
提交者:
GitHub
5月 08, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #91982 from microsoft/roblou/settingsTooltip
Add tooltip to settings editor tabs
上级
b82e5905
1f2874c7
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
24 addition
and
15 deletion
+24
-15
src/vs/workbench/contrib/preferences/browser/preferencesWidgets.ts
...rkbench/contrib/preferences/browser/preferencesWidgets.ts
+18
-10
src/vs/workbench/services/configuration/common/configurationEditingService.ts
...vices/configuration/common/configurationEditingService.ts
+4
-4
src/vs/workbench/services/preferences/browser/preferencesService.ts
...kbench/services/preferences/browser/preferencesService.ts
+1
-1
src/vs/workbench/services/preferences/common/preferences.ts
src/vs/workbench/services/preferences/common/preferences.ts
+1
-0
未找到文件。
src/vs/workbench/contrib/preferences/browser/preferencesWidgets.ts
浏览文件 @
306235b1
...
...
@@ -32,7 +32,7 @@ import { ICssStyleCollector, IColorTheme, IThemeService, registerThemingParticip
import
{
IWorkspaceContextService
,
IWorkspaceFolder
,
WorkbenchState
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
PANEL_ACTIVE_TITLE_BORDER
,
PANEL_ACTIVE_TITLE_FOREGROUND
,
PANEL_INACTIVE_TITLE_FOREGROUND
}
from
'
vs/workbench/common/theme
'
;
import
{
IWorkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/common/environmentService
'
;
import
{
ISettingsGroup
}
from
'
vs/workbench/services/preferences/common/preferences
'
;
import
{
ISettingsGroup
,
IPreferencesService
}
from
'
vs/workbench/services/preferences/common/preferences
'
;
import
{
EditorOption
}
from
'
vs/editor/common/config/editorOptions
'
;
import
{
isEqual
}
from
'
vs/base/common/resources
'
;
import
{
registerIcon
,
Codicon
}
from
'
vs/base/common/codicons
'
;
...
...
@@ -310,7 +310,8 @@ export class FolderSettingsActionViewItem extends BaseActionViewItem {
constructor
(
action
:
IAction
,
@
IWorkspaceContextService
private
readonly
contextService
:
IWorkspaceContextService
,
@
IContextMenuService
private
readonly
contextMenuService
:
IContextMenuService
@
IContextMenuService
private
readonly
contextMenuService
:
IContextMenuService
,
@
IPreferencesService
private
readonly
preferencesService
:
IPreferencesService
,
)
{
super
(
null
,
action
);
const
workspace
=
this
.
contextService
.
getWorkspace
();
...
...
@@ -400,14 +401,14 @@ export class FolderSettingsActionViewItem extends BaseActionViewItem {
}
}
private
update
():
void
{
private
async
update
():
Promise
<
void
>
{
let
total
=
0
;
this
.
_folderSettingCounts
.
forEach
(
n
=>
total
+=
n
);
const
workspace
=
this
.
contextService
.
getWorkspace
();
if
(
this
.
_folder
)
{
this
.
labelElement
.
textContent
=
this
.
_folder
.
name
;
this
.
anchorElement
.
title
=
this
.
_folder
.
name
;
this
.
anchorElement
.
title
=
(
await
this
.
preferencesService
.
getEditableSettingsURI
(
ConfigurationTarget
.
WORKSPACE_FOLDER
,
this
.
_folder
.
uri
))?.
fsPath
||
''
;
const
detailsText
=
this
.
labelWithCount
(
this
.
_action
.
label
,
total
);
this
.
detailsElement
.
textContent
=
detailsText
;
DOM
.
toggleClass
(
this
.
dropDownElement
,
'
hide
'
,
workspace
.
folders
.
length
===
1
||
!
this
.
_action
.
checked
);
...
...
@@ -418,6 +419,7 @@ export class FolderSettingsActionViewItem extends BaseActionViewItem {
this
.
anchorElement
.
title
=
this
.
_action
.
label
;
DOM
.
removeClass
(
this
.
dropDownElement
,
'
hide
'
);
}
DOM
.
toggleClass
(
this
.
anchorElement
,
'
checked
'
,
this
.
_action
.
checked
);
DOM
.
toggleClass
(
this
.
container
,
'
disabled
'
,
!
this
.
_action
.
enabled
);
}
...
...
@@ -487,7 +489,8 @@ export class SettingsTargetsWidget extends Widget {
@
IWorkspaceContextService
private
readonly
contextService
:
IWorkspaceContextService
,
@
IInstantiationService
private
readonly
instantiationService
:
IInstantiationService
,
@
IWorkbenchEnvironmentService
private
readonly
environmentService
:
IWorkbenchEnvironmentService
,
@
ILabelService
private
readonly
labelService
:
ILabelService
@
ILabelService
private
readonly
labelService
:
ILabelService
,
@
IPreferencesService
private
readonly
preferencesService
:
IPreferencesService
,
)
{
super
();
this
.
options
=
options
||
{};
...
...
@@ -506,17 +509,21 @@ export class SettingsTargetsWidget extends Widget {
}));
this
.
userLocalSettings
=
new
Action
(
'
userSettings
'
,
localize
(
'
userSettings
'
,
"
User
"
),
'
.settings-tab
'
,
true
,
()
=>
this
.
updateTarget
(
ConfigurationTarget
.
USER_LOCAL
));
this
.
userLocalSettings
.
tooltip
=
this
.
userLocalSettings
.
label
;
this
.
preferencesService
.
getEditableSettingsURI
(
ConfigurationTarget
.
USER_LOCAL
).
then
(
uri
=>
{
// Don't wait to create UI on resolving remote
this
.
userLocalSettings
.
tooltip
=
uri
?.
fsPath
||
''
;
});
const
remoteAuthority
=
this
.
environmentService
.
configuration
.
remoteAuthority
;
const
hostLabel
=
remoteAuthority
&&
this
.
labelService
.
getHostLabel
(
REMOTE_HOST_SCHEME
,
remoteAuthority
);
const
remoteSettingsLabel
=
localize
(
'
userSettingsRemote
'
,
"
Remote
"
)
+
(
hostLabel
?
` [
${
hostLabel
}
]`
:
''
);
this
.
userRemoteSettings
=
new
Action
(
'
userSettingsRemote
'
,
remoteSettingsLabel
,
'
.settings-tab
'
,
true
,
()
=>
this
.
updateTarget
(
ConfigurationTarget
.
USER_REMOTE
));
this
.
userRemoteSettings
.
tooltip
=
this
.
userRemoteSettings
.
label
;
this
.
preferencesService
.
getEditableSettingsURI
(
ConfigurationTarget
.
USER_REMOTE
).
then
(
uri
=>
{
this
.
userRemoteSettings
.
tooltip
=
uri
?.
fsPath
||
''
;
});
this
.
workspaceSettings
=
new
Action
(
'
workspaceSettings
'
,
localize
(
'
workspaceSettings
'
,
"
Workspace
"
),
'
.settings-tab
'
,
false
,
()
=>
this
.
updateTarget
(
ConfigurationTarget
.
WORKSPACE
));
this
.
workspaceSettings
.
tooltip
=
this
.
workspaceSettings
.
label
;
const
folderSettingsAction
=
new
Action
(
'
folderSettings
'
,
localize
(
'
folderSettings
'
,
"
Folder
"
),
'
.settings-tab
'
,
false
,
(
folder
:
IWorkspaceFolder
|
null
)
=>
this
.
updateTarget
(
folder
?
folder
.
uri
:
ConfigurationTarget
.
USER_LOCAL
));
...
...
@@ -586,13 +593,14 @@ export class SettingsTargetsWidget extends Widget {
return
Promise
.
resolve
(
undefined
);
}
private
update
():
void
{
private
async
update
():
Promise
<
void
>
{
DOM
.
toggleClass
(
this
.
settingsSwitcherBar
.
domNode
,
'
empty-workbench
'
,
this
.
contextService
.
getWorkbenchState
()
===
WorkbenchState
.
EMPTY
);
this
.
userRemoteSettings
.
enabled
=
!!
(
this
.
options
.
enableRemoteSettings
&&
this
.
environmentService
.
configuration
.
remoteAuthority
);
this
.
workspaceSettings
.
enabled
=
this
.
contextService
.
getWorkbenchState
()
!==
WorkbenchState
.
EMPTY
;
this
.
folderSettings
.
getAction
().
enabled
=
this
.
contextService
.
getWorkbenchState
()
===
WorkbenchState
.
WORKSPACE
&&
this
.
contextService
.
getWorkspace
().
folders
.
length
>
0
;
}
this
.
workspaceSettings
.
tooltip
=
(
await
this
.
preferencesService
.
getEditableSettingsURI
(
ConfigurationTarget
.
WORKSPACE
))?.
fsPath
||
''
;
}
}
export
interface
SearchOptions
extends
IInputOptions
{
...
...
src/vs/workbench/services/configuration/common/configurationEditingService.ts
浏览文件 @
306235b1
...
...
@@ -543,7 +543,7 @@ export class ConfigurationEditingService {
const
standaloneConfigurationMap
=
target
===
EditableConfigurationTarget
.
USER_LOCAL
?
USER_STANDALONE_CONFIGURATIONS
:
WORKSPACE_STANDALONE_CONFIGURATIONS
;
const
standaloneConfigurationKeys
=
Object
.
keys
(
standaloneConfigurationMap
);
for
(
const
key
of
standaloneConfigurationKeys
)
{
const
resource
=
this
.
getConfigurationFileResource
(
target
,
config
,
standaloneConfigurationMap
[
key
],
overrides
.
resource
);
const
resource
=
this
.
getConfigurationFileResource
(
target
,
standaloneConfigurationMap
[
key
],
overrides
.
resource
);
// Check for prefix
if
(
config
.
key
===
key
)
{
...
...
@@ -563,10 +563,10 @@ export class ConfigurationEditingService {
let
key
=
config
.
key
;
let
jsonPath
=
overrides
.
overrideIdentifier
?
[
keyFromOverrideIdentifier
(
overrides
.
overrideIdentifier
),
key
]
:
[
key
];
if
(
target
===
EditableConfigurationTarget
.
USER_LOCAL
||
target
===
EditableConfigurationTarget
.
USER_REMOTE
)
{
return
{
key
,
jsonPath
,
value
:
config
.
value
,
resource
:
withNullAsUndefined
(
this
.
getConfigurationFileResource
(
target
,
config
,
''
,
null
)),
target
};
return
{
key
,
jsonPath
,
value
:
config
.
value
,
resource
:
withNullAsUndefined
(
this
.
getConfigurationFileResource
(
target
,
''
,
null
)),
target
};
}
const
resource
=
this
.
getConfigurationFileResource
(
target
,
config
,
FOLDER_SETTINGS_PATH
,
overrides
.
resource
);
const
resource
=
this
.
getConfigurationFileResource
(
target
,
FOLDER_SETTINGS_PATH
,
overrides
.
resource
);
if
(
this
.
isWorkspaceConfigurationResource
(
resource
))
{
jsonPath
=
[
'
settings
'
,
...
jsonPath
];
}
...
...
@@ -578,7 +578,7 @@ export class ConfigurationEditingService {
return
!!
(
workspace
.
configuration
&&
resource
&&
workspace
.
configuration
.
fsPath
===
resource
.
fsPath
);
}
private
getConfigurationFileResource
(
target
:
EditableConfigurationTarget
,
config
:
IConfigurationValue
,
relativePath
:
string
,
resource
:
URI
|
null
|
undefined
):
URI
|
null
{
private
getConfigurationFileResource
(
target
:
EditableConfigurationTarget
,
relativePath
:
string
,
resource
:
URI
|
null
|
undefined
):
URI
|
null
{
if
(
target
===
EditableConfigurationTarget
.
USER_LOCAL
)
{
if
(
relativePath
)
{
return
resources
.
joinPath
(
resources
.
dirname
(
this
.
environmentService
.
settingsResource
),
relativePath
);
...
...
src/vs/workbench/services/preferences/browser/preferencesService.ts
浏览文件 @
306235b1
...
...
@@ -518,7 +518,7 @@ export class PreferencesService extends Disposable implements IPreferencesServic
return
this
.
_defaultUserSettingsContentModel
;
}
p
rivate
async
getEditableSettingsURI
(
configurationTarget
:
ConfigurationTarget
,
resource
?:
URI
):
Promise
<
URI
|
null
>
{
p
ublic
async
getEditableSettingsURI
(
configurationTarget
:
ConfigurationTarget
,
resource
?:
URI
):
Promise
<
URI
|
null
>
{
switch
(
configurationTarget
)
{
case
ConfigurationTarget
.
USER
:
case
ConfigurationTarget
.
USER_LOCAL
:
...
...
src/vs/workbench/services/preferences/common/preferences.ts
浏览文件 @
306235b1
...
...
@@ -207,6 +207,7 @@ export interface IPreferencesService {
switchSettings
(
target
:
ConfigurationTarget
,
resource
:
URI
,
jsonEditor
?:
boolean
):
Promise
<
void
>
;
openGlobalKeybindingSettings
(
textual
:
boolean
):
Promise
<
void
>
;
openDefaultKeybindingsFile
():
Promise
<
IEditorPane
|
undefined
>
;
getEditableSettingsURI
(
configurationTarget
:
ConfigurationTarget
,
resource
?:
URI
):
Promise
<
URI
|
null
>
;
}
export
function
getSettingsTargetName
(
target
:
ConfigurationTarget
,
resource
:
URI
,
workspaceContextService
:
IWorkspaceContextService
):
string
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录