Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
01a874ac
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,发现更多精彩内容 >>
未验证
提交
01a874ac
编写于
7月 27, 2021
作者:
M
Megan Rogge
提交者:
GitHub
7月 27, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update default profile in dropdown when set to contributed one (#129619)
上级
762f213a
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
40 addition
and
12 deletion
+40
-12
src/vs/workbench/contrib/terminal/browser/terminal.ts
src/vs/workbench/contrib/terminal/browser/terminal.ts
+2
-0
src/vs/workbench/contrib/terminal/browser/terminalEditor.ts
src/vs/workbench/contrib/terminal/browser/terminalEditor.ts
+12
-5
src/vs/workbench/contrib/terminal/browser/terminalService.ts
src/vs/workbench/contrib/terminal/browser/terminalService.ts
+14
-2
src/vs/workbench/contrib/terminal/browser/terminalView.ts
src/vs/workbench/contrib/terminal/browser/terminalView.ts
+12
-5
未找到文件。
src/vs/workbench/contrib/terminal/browser/terminal.ts
浏览文件 @
01a874ac
...
...
@@ -184,6 +184,8 @@ export interface ITerminalService extends ITerminalInstanceHost {
getDefaultInstanceHost
():
ITerminalInstanceHost
;
getInstanceHost
(
target
:
TerminalLocation
|
undefined
):
ITerminalInstanceHost
;
getFindHost
(
instance
?:
ITerminalInstance
):
ITerminalFindHost
;
getDefaultProfileName
():
string
;
}
/**
...
...
src/vs/workbench/contrib/terminal/browser/terminalEditor.ts
浏览文件 @
01a874ac
...
...
@@ -219,7 +219,12 @@ export class TerminalEditor extends EditorPane {
const
dropdownActions
:
IAction
[]
=
[];
const
submenuActions
:
IAction
[]
=
[];
const
defaultProfileName
=
this
.
_terminalProfileResolverService
.
defaultProfileName
;
let
defaultProfileName
;
try
{
defaultProfileName
=
this
.
_terminalService
.
getDefaultProfileName
();
}
catch
(
e
)
{
defaultProfileName
=
this
.
_terminalProfileResolverService
.
defaultProfileName
;
}
for
(
const
p
of
profiles
)
{
const
isDefault
=
p
.
profileName
===
defaultProfileName
;
const
options
:
IMenuActionOptions
=
{
...
...
@@ -239,19 +244,21 @@ export class TerminalEditor extends EditorPane {
}
for
(
const
contributed
of
this
.
_terminalContributionService
.
terminalProfiles
)
{
dropdownActions
.
push
(
new
Action
(
TerminalCommandId
.
NewWithProfile
,
contributed
.
title
.
replace
(
/
[\n\r\t]
/g
,
''
),
undefined
,
true
,
()
=>
this
.
_terminalService
.
createTerminal
({
const
isDefault
=
contributed
.
title
===
defaultProfileName
;
const
title
=
isDefault
?
localize
(
'
defaultTerminalProfile
'
,
"
{0} (Default)
"
,
contributed
.
title
.
replace
(
/
[\n\r\t]
/g
,
''
))
:
contributed
.
title
.
replace
(
/
[\n\r\t]
/g
,
''
);
dropdownActions
.
push
(
new
Action
(
TerminalCommandId
.
NewWithProfile
,
title
,
undefined
,
true
,
()
=>
this
.
_terminalService
.
createTerminal
({
config
:
{
extensionIdentifier
:
contributed
.
extensionIdentifier
,
id
:
contributed
.
id
,
title
:
contributed
.
title
.
replace
(
/
[\n\r\t]
/g
,
''
)
title
},
target
:
TerminalLocation
.
Editor
})));
submenuActions
.
push
(
new
Action
(
TerminalCommandId
.
NewWithProfile
,
contributed
.
title
.
replace
(
/
[\n\r\t]
/g
,
''
)
,
undefined
,
true
,
()
=>
this
.
_terminalService
.
createTerminal
({
submenuActions
.
push
(
new
Action
(
TerminalCommandId
.
NewWithProfile
,
title
,
undefined
,
true
,
()
=>
this
.
_terminalService
.
createTerminal
({
config
:
{
extensionIdentifier
:
contributed
.
extensionIdentifier
,
id
:
contributed
.
id
,
title
:
contributed
.
title
.
replace
(
/
[\n\r\t]
/g
,
''
)
title
},
forceSplit
:
true
,
target
:
TerminalLocation
.
Editor
...
...
src/vs/workbench/contrib/terminal/browser/terminalService.ts
浏览文件 @
01a874ac
...
...
@@ -64,8 +64,10 @@ export class TerminalService implements ITerminalService {
private
_processSupportContextKey
:
IContextKey
<
boolean
>
;
private
readonly
_localTerminalService
?:
ILocalTerminalService
;
private
readonly
_primaryOffProcessTerminalService
?:
IOffProcessTerminalService
;
private
_defaultProfileName
?:
string
;
private
_profilesReadyBarrier
:
AutoOpenBarrier
;
private
_availableProfiles
:
ITerminalProfile
[]
|
undefined
;
private
_contributedProfiles
:
IExtensionTerminalProfile
[]
|
undefined
;
private
_configHelper
:
TerminalConfigHelper
;
private
_remoteTerminalsInitPromise
:
Promise
<
void
>
|
undefined
;
private
_localTerminalsInitPromise
:
Promise
<
void
>
|
undefined
;
...
...
@@ -485,8 +487,10 @@ export class TerminalService implements ITerminalService {
private
async
_refreshAvailableProfiles
():
Promise
<
void
>
{
const
result
=
await
this
.
_detectProfiles
();
const
profilesChanged
=
!
equals
(
result
,
this
.
_availableProfiles
);
if
(
profilesChanged
)
{
const
contributedProfilesChanged
=
!
equals
(
this
.
_terminalContributionService
.
terminalProfiles
,
this
.
_contributedProfiles
);
if
(
profilesChanged
||
contributedProfilesChanged
)
{
this
.
_availableProfiles
=
result
;
this
.
_contributedProfiles
=
Array
.
from
(
this
.
_terminalContributionService
.
terminalProfiles
);
this
.
_onDidChangeAvailableProfiles
.
fire
(
this
.
_availableProfiles
);
this
.
_profilesReadyBarrier
.
open
();
await
this
.
_refreshPlatformConfig
(
result
);
...
...
@@ -504,7 +508,15 @@ export class TerminalService implements ITerminalService {
return
this
.
_availableProfiles
||
[];
}
const
platform
=
await
this
.
_getPlatformKey
();
return
this
.
_primaryOffProcessTerminalService
?.
getProfiles
(
this
.
_configurationService
.
getValue
(
`
${
TerminalSettingPrefix
.
Profiles
}${
platform
}
`
),
this
.
_configurationService
.
getValue
(
`
${
TerminalSettingPrefix
.
DefaultProfile
}${
platform
}
`
),
includeDetectedProfiles
);
this
.
_defaultProfileName
=
this
.
_configurationService
.
getValue
(
`
${
TerminalSettingPrefix
.
DefaultProfile
}${
platform
}
`
);
return
this
.
_primaryOffProcessTerminalService
?.
getProfiles
(
this
.
_configurationService
.
getValue
(
`
${
TerminalSettingPrefix
.
Profiles
}${
platform
}
`
),
this
.
_defaultProfileName
,
includeDetectedProfiles
);
}
getDefaultProfileName
():
string
{
if
(
!
this
.
_defaultProfileName
)
{
throw
new
Error
(
'
no default profile
'
);
}
return
this
.
_defaultProfileName
;
}
private
_onBeforeShutdown
(
reason
:
ShutdownReason
):
boolean
|
Promise
<
boolean
>
{
...
...
src/vs/workbench/contrib/terminal/browser/terminalView.ts
浏览文件 @
01a874ac
...
...
@@ -232,7 +232,12 @@ export class TerminalViewPane extends ViewPane {
const
dropdownActions
:
IAction
[]
=
[];
const
submenuActions
:
IAction
[]
=
[];
const
defaultProfileName
=
this
.
_terminalProfileResolverService
.
defaultProfileName
;
let
defaultProfileName
;
try
{
defaultProfileName
=
this
.
_terminalService
.
getDefaultProfileName
();
}
catch
(
e
)
{
defaultProfileName
=
this
.
_terminalProfileResolverService
.
defaultProfileName
;
}
for
(
const
p
of
profiles
)
{
const
isDefault
=
p
.
profileName
===
defaultProfileName
;
const
options
:
IMenuActionOptions
=
{
...
...
@@ -252,19 +257,21 @@ export class TerminalViewPane extends ViewPane {
}
for
(
const
contributed
of
this
.
_terminalContributionService
.
terminalProfiles
)
{
dropdownActions
.
push
(
new
Action
(
TerminalCommandId
.
NewWithProfile
,
contributed
.
title
.
replace
(
/
[\n\r\t]
/g
,
''
),
undefined
,
true
,
()
=>
this
.
_terminalService
.
createTerminal
({
const
isDefault
=
contributed
.
title
===
defaultProfileName
;
const
title
=
isDefault
?
nls
.
localize
(
'
defaultTerminalProfile
'
,
"
{0} (Default)
"
,
contributed
.
title
.
replace
(
/
[\n\r\t]
/g
,
''
))
:
contributed
.
title
.
replace
(
/
[\n\r\t]
/g
,
''
);
dropdownActions
.
push
(
new
Action
(
TerminalCommandId
.
NewWithProfile
,
title
,
undefined
,
true
,
()
=>
this
.
_terminalService
.
createTerminal
({
config
:
{
extensionIdentifier
:
contributed
.
extensionIdentifier
,
id
:
contributed
.
id
,
title
:
contributed
.
title
.
replace
(
/
[\n\r\t]
/g
,
''
)
title
},
forceSplit
:
false
})));
submenuActions
.
push
(
new
Action
(
TerminalCommandId
.
NewWithProfile
,
contributed
.
title
.
replace
(
/
[\n\r\t]
/g
,
''
)
,
undefined
,
true
,
()
=>
this
.
_terminalService
.
createTerminal
({
submenuActions
.
push
(
new
Action
(
TerminalCommandId
.
NewWithProfile
,
title
,
undefined
,
true
,
()
=>
this
.
_terminalService
.
createTerminal
({
config
:
{
extensionIdentifier
:
contributed
.
extensionIdentifier
,
id
:
contributed
.
id
,
title
:
contributed
.
title
.
replace
(
/
[\n\r\t]
/g
,
''
)
title
},
forceSplit
:
true
})));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录