Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
74d8f8d7
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,发现更多精彩内容 >>
未验证
提交
74d8f8d7
编写于
7月 16, 2019
作者:
D
Daniel Imms
提交者:
GitHub
7月 16, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #77472 from microsoft/aeschli/showTerminalRecommendations
Recommend WSL when using wsl.exe as shell
上级
0a8ca638
7a8e27f2
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
56 addition
and
6 deletion
+56
-6
src/vs/workbench/contrib/extensions/electron-browser/extensionTipsService.ts
...ntrib/extensions/electron-browser/extensionTipsService.ts
+2
-1
src/vs/workbench/contrib/terminal/browser/terminalConfigHelper.ts
...orkbench/contrib/terminal/browser/terminalConfigHelper.ts
+52
-5
src/vs/workbench/contrib/terminal/browser/terminalProcessManager.ts
...kbench/contrib/terminal/browser/terminalProcessManager.ts
+1
-0
src/vs/workbench/contrib/terminal/common/terminal.ts
src/vs/workbench/contrib/terminal/common/terminal.ts
+1
-0
未找到文件。
src/vs/workbench/contrib/extensions/electron-browser/extensionTipsService.ts
浏览文件 @
74d8f8d7
...
...
@@ -913,7 +913,8 @@ export class ExtensionTipsService extends Disposable implements IExtensionTipsSe
windowsPath
=
windowsPath
.
replace
(
'
%USERPROFILE%
'
,
process
.
env
[
'
USERPROFILE
'
]
!
)
.
replace
(
'
%ProgramFiles(x86)%
'
,
process
.
env
[
'
ProgramFiles(x86)
'
]
!
)
.
replace
(
'
%ProgramFiles%
'
,
process
.
env
[
'
ProgramFiles
'
]
!
)
.
replace
(
'
%APPDATA%
'
,
process
.
env
[
'
APPDATA
'
]
!
);
.
replace
(
'
%APPDATA%
'
,
process
.
env
[
'
APPDATA
'
]
!
)
.
replace
(
'
%WINDIR%
'
,
process
.
env
[
'
WINDIR
'
]
!
);
promises
.
push
(
findExecutable
(
exeName
,
windowsPath
));
}
else
{
promises
.
push
(
findExecutable
(
exeName
,
join
(
'
/usr/local/bin
'
,
exeName
)));
...
...
src/vs/workbench/contrib/terminal/browser/terminalConfigHelper.ts
浏览文件 @
74d8f8d7
...
...
@@ -8,12 +8,15 @@ import * as platform from 'vs/base/common/platform';
import
{
EDITOR_FONT_DEFAULTS
,
IEditorOptions
}
from
'
vs/editor/common/config/editorOptions
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
import
{
ITerminalConfiguration
,
ITerminalFont
,
IS_WORKSPACE_SHELL_ALLOWED_STORAGE_KEY
,
TERMINAL_CONFIG_SECTION
,
DEFAULT_LETTER_SPACING
,
DEFAULT_LINE_HEIGHT
,
MINIMUM_LETTER_SPACING
,
LinuxDistro
}
from
'
vs/workbench/contrib/terminal/common/terminal
'
;
import
{
ITerminalConfiguration
,
ITerminalFont
,
IS_WORKSPACE_SHELL_ALLOWED_STORAGE_KEY
,
TERMINAL_CONFIG_SECTION
,
DEFAULT_LETTER_SPACING
,
DEFAULT_LINE_HEIGHT
,
MINIMUM_LETTER_SPACING
,
LinuxDistro
,
IShellLaunchConfig
}
from
'
vs/workbench/contrib/terminal/common/terminal
'
;
import
Severity
from
'
vs/base/common/severity
'
;
import
{
Terminal
as
XTermTerminal
}
from
'
xterm
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
IBrowserTerminalConfigHelper
}
from
'
vs/workbench/contrib/terminal/browser/terminal
'
;
import
{
Emitter
,
Event
}
from
'
vs/base/common/event
'
;
import
{
basename
}
from
'
vs/base/common/path
'
;
import
{
IExtensionManagementService
}
from
'
vs/platform/extensionManagement/common/extensionManagement
'
;
import
{
ExtensionType
}
from
'
vs/platform/extensions/common/extensions
'
;
const
MINIMUM_FONT_SIZE
=
6
;
const
MAXIMUM_FONT_SIZE
=
25
;
...
...
@@ -35,7 +38,7 @@ export class TerminalConfigHelper implements IBrowserTerminalConfigHelper {
public
constructor
(
private
readonly
_linuxDistro
:
LinuxDistro
,
@
IConfigurationService
private
readonly
_configurationService
:
IConfigurationService
,
@
I
ConfigurationService
private
readonly
_workspaceConfigurationService
:
IConfiguration
Service
,
@
I
ExtensionManagementService
private
readonly
_extensionManagementService
:
IExtensionManagement
Service
,
@
INotificationService
private
readonly
_notificationService
:
INotificationService
,
@
IStorageService
private
readonly
_storageService
:
IStorageService
)
{
...
...
@@ -174,9 +177,9 @@ export class TerminalConfigHelper implements IBrowserTerminalConfigHelper {
public
checkWorkspaceShellPermissions
(
osOverride
:
platform
.
OperatingSystem
=
platform
.
OS
):
boolean
{
// Check whether there is a workspace setting
const
platformKey
=
osOverride
===
platform
.
OperatingSystem
.
Windows
?
'
windows
'
:
osOverride
===
platform
.
OperatingSystem
.
Macintosh
?
'
osx
'
:
'
linux
'
;
const
shellConfigValue
=
this
.
_
workspaceC
onfigurationService
.
inspect
<
string
>
(
`terminal.integrated.shell.
${
platformKey
}
`
);
const
shellArgsConfigValue
=
this
.
_
workspaceC
onfigurationService
.
inspect
<
string
[]
>
(
`terminal.integrated.shellArgs.
${
platformKey
}
`
);
const
envConfigValue
=
this
.
_
workspaceC
onfigurationService
.
inspect
<
{
[
key
:
string
]:
string
}
>
(
`terminal.integrated.env.
${
platformKey
}
`
);
const
shellConfigValue
=
this
.
_
c
onfigurationService
.
inspect
<
string
>
(
`terminal.integrated.shell.
${
platformKey
}
`
);
const
shellArgsConfigValue
=
this
.
_
c
onfigurationService
.
inspect
<
string
[]
>
(
`terminal.integrated.shellArgs.
${
platformKey
}
`
);
const
envConfigValue
=
this
.
_
c
onfigurationService
.
inspect
<
{
[
key
:
string
]:
string
}
>
(
`terminal.integrated.env.
${
platformKey
}
`
);
// Check if workspace setting exists and whether it's whitelisted
let
isWorkspaceShellAllowed
:
boolean
|
undefined
=
false
;
...
...
@@ -244,4 +247,48 @@ export class TerminalConfigHelper implements IBrowserTerminalConfigHelper {
}
return
r
;
}
private
readonly
NO_RECOMMENDATIONS_KEY
=
'
terminalConfigHelper/launchRecommendationsIgnore
'
;
private
recommendationsShown
=
false
;
public
async
showRecommendations
(
shellLaunchConfig
:
IShellLaunchConfig
):
Promise
<
void
>
{
if
(
this
.
recommendationsShown
)
{
return
;
}
this
.
recommendationsShown
=
true
;
if
(
platform
.
isWindows
&&
shellLaunchConfig
.
executable
&&
basename
(
shellLaunchConfig
.
executable
).
toLowerCase
()
===
'
wsl.exe
'
)
{
if
(
this
.
_storageService
.
getBoolean
(
this
.
NO_RECOMMENDATIONS_KEY
,
StorageScope
.
WORKSPACE
,
false
))
{
return
;
}
if
(
!
await
this
.
isExtensionInstalled
(
'
ms-vscode-remote.remote-wsl
'
))
{
this
.
_notificationService
.
prompt
(
Severity
.
Info
,
nls
.
localize
(
'
useWslExtension.title
'
,
"
Check out the 'Visual Studio Code Remote - WSL' extension for a great development experience in WSL. Click [here]({0}) to learn more.
"
,
'
https://go.microsoft.com/fwlink/?linkid=2097212
'
),
[
{
label
:
nls
.
localize
(
'
doNotShowAgain
'
,
"
Don't Show Again
"
),
run
:
()
=>
{
this
.
_storageService
.
store
(
this
.
NO_RECOMMENDATIONS_KEY
,
true
,
StorageScope
.
WORKSPACE
);
}
}
],
{
sticky
:
true
}
);
}
}
}
private
isExtensionInstalled
(
id
:
string
):
Promise
<
boolean
>
{
return
this
.
_extensionManagementService
.
getInstalled
(
ExtensionType
.
User
).
then
(
extensions
=>
{
return
extensions
.
some
(
e
=>
e
.
identifier
.
id
===
id
);
});
}
}
src/vs/workbench/contrib/terminal/browser/terminalProcessManager.ts
浏览文件 @
74d8f8d7
...
...
@@ -209,6 +209,7 @@ export class TerminalProcessManager implements ITerminalProcessManager {
const
initialCwd
=
terminalEnvironment
.
getCwd
(
shellLaunchConfig
,
this
.
_environmentService
.
userHome
,
activeWorkspaceRootUri
,
this
.
_configHelper
.
config
.
cwd
);
const
envFromConfigValue
=
this
.
_workspaceConfigurationService
.
inspect
<
ITerminalEnvironment
|
undefined
>
(
`terminal.integrated.env.
${
platformKey
}
`
);
const
isWorkspaceShellAllowed
=
this
.
_configHelper
.
checkWorkspaceShellPermissions
();
this
.
_configHelper
.
showRecommendations
(
shellLaunchConfig
);
const
baseEnv
=
this
.
_configHelper
.
config
.
inheritEnv
?
process
.
env
as
platform
.
IProcessEnvironment
:
await
this
.
_terminalInstanceService
.
getMainProcessParentEnv
();
const
env
=
terminalEnvironment
.
createTerminalEnvironment
(
shellLaunchConfig
,
lastActiveWorkspace
,
envFromConfigValue
,
this
.
_configurationResolverService
,
isWorkspaceShellAllowed
,
this
.
_productService
.
version
,
this
.
_configHelper
.
config
.
setLocaleVariables
,
baseEnv
);
...
...
src/vs/workbench/contrib/terminal/common/terminal.ts
浏览文件 @
74d8f8d7
...
...
@@ -122,6 +122,7 @@ export interface ITerminalConfigHelper {
/** Sets whether a workspace shell configuration is allowed or not */
setWorkspaceShellAllowed
(
isAllowed
:
boolean
):
void
;
checkWorkspaceShellPermissions
(
osOverride
?:
OperatingSystem
):
boolean
;
showRecommendations
(
shellLaunchConfig
:
IShellLaunchConfig
):
void
;
}
export
interface
ITerminalFont
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录