Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
e7e2ce52
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,发现更多精彩内容 >>
提交
e7e2ce52
编写于
3月 14, 2019
作者:
I
Ian Sanders
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
https://github.com/iansan5653/vscode
上级
e156de1b
2275bfe4
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
145 addition
and
106 deletion
+145
-106
extensions/css-language-features/server/package.json
extensions/css-language-features/server/package.json
+1
-1
extensions/css-language-features/server/yarn.lock
extensions/css-language-features/server/yarn.lock
+4
-4
src/tsconfig.strictNullChecks.json
src/tsconfig.strictNullChecks.json
+2
-0
src/vs/platform/history/electron-main/historyMainService.ts
src/vs/platform/history/electron-main/historyMainService.ts
+27
-17
src/vs/workbench/api/node/extHost.protocol.ts
src/vs/workbench/api/node/extHost.protocol.ts
+1
-1
src/vs/workbench/api/node/extHostTask.ts
src/vs/workbench/api/node/extHostTask.ts
+71
-53
src/vs/workbench/api/node/extHostTerminalService.ts
src/vs/workbench/api/node/extHostTerminalService.ts
+38
-29
src/vs/workbench/api/shared/tasks.ts
src/vs/workbench/api/shared/tasks.ts
+1
-1
未找到文件。
extensions/css-language-features/server/package.json
浏览文件 @
e7e2ce52
...
...
@@ -9,7 +9,7 @@
},
"main"
:
"./out/cssServerMain"
,
"dependencies"
:
{
"vscode-css-languageservice"
:
"^4.0.0-next.
3
"
,
"vscode-css-languageservice"
:
"^4.0.0-next.
5
"
,
"vscode-languageserver"
:
"^5.3.0-next.2"
},
"devDependencies"
:
{
...
...
extensions/css-language-features/server/yarn.lock
浏览文件 @
e7e2ce52
...
...
@@ -229,10 +229,10 @@ supports-color@5.4.0:
dependencies:
has-flag "^3.0.0"
vscode-css-languageservice@^4.0.0-next.
3
:
version "4.0.0-next.
3
"
resolved "https://registry.yarnpkg.com/vscode-css-languageservice/-/vscode-css-languageservice-4.0.0-next.
3.tgz#e9529f3b4ddf95c9a3e5dc2a6d701a38280ffa98
"
integrity sha512-
/xmbWpIQLw+HZ/3LsaE2drHFSNJbM9mZ8bKR5NUiu2ZUr10WbGxX0j/GDZB3LlMmdSHQGgRQ5hTM/Ic2PuBDRw
==
vscode-css-languageservice@^4.0.0-next.
5
:
version "4.0.0-next.
5
"
resolved "https://registry.yarnpkg.com/vscode-css-languageservice/-/vscode-css-languageservice-4.0.0-next.
5.tgz#a9246d3c85c33e2878b305a93de6a2c7fef53d3b
"
integrity sha512-
ZO8mfoZjPgY+T77+frQHtlXPxt00ogPJfdOY2T8I3vT+1m32GIUKjcmgwg4sMtx3/+PYwu2SowgygrStny9JvQ
==
dependencies:
vscode-languageserver-types "^3.14.0"
vscode-nls "^4.0.0"
...
...
src/tsconfig.strictNullChecks.json
浏览文件 @
e7e2ce52
...
...
@@ -117,6 +117,8 @@
"./vs/workbench/api/node/extHostSearch.ts"
,
"./vs/workbench/api/node/extHostStatusBar.ts"
,
"./vs/workbench/api/node/extHostStorage.ts"
,
//
"./vs/workbench/api/node/extHostTask.ts"
,
"./vs/workbench/api/node/extHostTerminalService.ts"
,
"./vs/workbench/api/node/extHostTextEditor.ts"
,
"./vs/workbench/api/node/extHostTextEditors.ts"
,
"./vs/workbench/api/node/extHostTypeConverters.ts"
,
...
...
src/vs/platform/history/electron-main/historyMainService.ts
浏览文件 @
e7e2ce52
...
...
@@ -48,38 +48,44 @@ export class HistoryMainService implements IHistoryMainService {
}
addRecentlyOpened
(
newlyAdded
:
IRecent
[]):
void
{
const
mru
=
this
.
getRecentlyOpened
();
const
workspaces
:
Array
<
IRecentFolder
|
IRecentWorkspace
>
=
[];
const
files
:
IRecentFile
[]
=
[];
for
(
let
curr
of
newlyAdded
)
{
if
(
isRecentWorkspace
(
curr
))
{
if
(
!
this
.
workspacesMainService
.
isUntitledWorkspace
(
curr
.
workspace
)
&&
indexOfWorkspace
(
mru
.
workspaces
,
curr
.
workspace
)
===
-
1
)
{
mru
.
workspaces
.
unshift
(
curr
);
if
(
!
this
.
workspacesMainService
.
isUntitledWorkspace
(
curr
.
workspace
)
&&
indexOfWorkspace
(
workspaces
,
curr
.
workspace
)
===
-
1
)
{
workspaces
.
push
(
curr
);
}
}
else
if
(
isRecentFolder
(
curr
))
{
if
(
indexOfFolder
(
mru
.
workspaces
,
curr
.
folderUri
)
===
-
1
)
{
mru
.
workspaces
.
unshift
(
curr
);
if
(
indexOfFolder
(
workspaces
,
curr
.
folderUri
)
===
-
1
)
{
workspaces
.
push
(
curr
);
}
}
else
{
if
(
indexOfFile
(
mru
.
files
,
curr
.
fileUri
)
===
-
1
)
{
mru
.
files
.
unshift
(
curr
);
if
(
indexOfFile
(
files
,
curr
.
fileUri
)
===
-
1
)
{
files
.
push
(
curr
);
// Add to recent documents (Windows only, macOS later)
if
(
isWindows
&&
curr
.
fileUri
.
scheme
===
Schemas
.
file
)
{
app
.
addRecentDocument
(
curr
.
fileUri
.
fsPath
);
}
}
}
}
// Make sure its bounded
mru
.
workspaces
=
mru
.
workspaces
.
slice
(
0
,
HistoryMainService
.
MAX_TOTAL_RECENT_ENTRIES
);
mru
.
files
=
mru
.
files
.
slice
(
0
,
HistoryMainService
.
MAX_TOTAL_RECENT_ENTRIES
);
this
.
addEntriesFromStorage
(
workspaces
,
files
);
this
.
saveRecentlyOpened
(
mru
);
this
.
_onRecentlyOpenedChange
.
fire
();
if
(
workspaces
.
length
>
HistoryMainService
.
MAX_TOTAL_RECENT_ENTRIES
)
{
workspaces
.
length
=
HistoryMainService
.
MAX_TOTAL_RECENT_ENTRIES
;
}
if
(
files
.
length
>
HistoryMainService
.
MAX_TOTAL_RECENT_ENTRIES
)
{
files
.
length
=
HistoryMainService
.
MAX_TOTAL_RECENT_ENTRIES
;
}
// Schedule update to recent documents on macOS dock
if
(
isMacintosh
)
{
this
.
macOSRecentDocumentsUpdater
.
trigger
(()
=>
this
.
updateMacOSRecentDocuments
());
}
this
.
saveRecentlyOpened
({
workspaces
,
files
});
this
.
_onRecentlyOpenedChange
.
fire
();
// Schedule update to recent documents on macOS dock
if
(
isMacintosh
)
{
this
.
macOSRecentDocumentsUpdater
.
trigger
(()
=>
this
.
updateMacOSRecentDocuments
());
}
}
...
...
@@ -177,7 +183,12 @@ export class HistoryMainService implements IHistoryMainService {
}
}
}
this
.
addEntriesFromStorage
(
workspaces
,
files
);
return
{
workspaces
,
files
};
}
private
addEntriesFromStorage
(
workspaces
:
Array
<
IRecentFolder
|
IRecentWorkspace
>
,
files
:
IRecentFile
[])
{
// Get from storage
let
recents
=
this
.
getRecentlyOpenedFromStorage
();
for
(
let
recent
of
recents
.
workspaces
)
{
...
...
@@ -196,7 +207,6 @@ export class HistoryMainService implements IHistoryMainService {
files
.
push
(
recent
);
}
}
return
{
workspaces
,
files
};
}
private
getRecentlyOpenedFromStorage
():
IRecentlyOpened
{
...
...
src/vs/workbench/api/node/extHost.protocol.ts
浏览文件 @
e7e2ce52
...
...
@@ -370,7 +370,7 @@ export interface MainThreadProgressShape extends IDisposable {
}
export
interface
MainThreadTerminalServiceShape
extends
IDisposable
{
$createTerminal
(
name
?:
string
,
shellPath
?:
string
,
shellArgs
?:
string
[],
cwd
?:
string
|
UriComponents
,
env
?:
{
[
key
:
string
]:
string
},
waitOnExit
?:
boolean
,
strictEnv
?:
boolean
):
Promise
<
{
id
:
number
,
name
:
string
}
>
;
$createTerminal
(
name
?:
string
,
shellPath
?:
string
,
shellArgs
?:
string
[],
cwd
?:
string
|
UriComponents
,
env
?:
{
[
key
:
string
]:
string
|
null
},
waitOnExit
?:
boolean
,
strictEnv
?:
boolean
):
Promise
<
{
id
:
number
,
name
:
string
}
>
;
$createTerminalRenderer
(
name
:
string
):
Promise
<
number
>
;
$dispose
(
terminalId
:
number
):
void
;
$hide
(
terminalId
:
number
):
void
;
...
...
src/vs/workbench/api/node/extHostTask.ts
浏览文件 @
e7e2ce52
...
...
@@ -34,13 +34,13 @@ import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cance
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
namespace
TaskDefinitionDTO
{
export
function
from
(
value
:
vscode
.
TaskDefinition
):
TaskDefinitionDTO
{
export
function
from
(
value
:
vscode
.
TaskDefinition
):
TaskDefinitionDTO
|
undefined
{
if
(
value
===
undefined
||
value
===
null
)
{
return
undefined
;
}
return
value
;
}
export
function
to
(
value
:
TaskDefinitionDTO
):
vscode
.
TaskDefinition
{
export
function
to
(
value
:
TaskDefinitionDTO
):
vscode
.
TaskDefinition
|
undefined
{
if
(
value
===
undefined
||
value
===
null
)
{
return
undefined
;
}
...
...
@@ -49,13 +49,13 @@ namespace TaskDefinitionDTO {
}
namespace
TaskPresentationOptionsDTO
{
export
function
from
(
value
:
vscode
.
TaskPresentationOptions
):
TaskPresentationOptionsDTO
{
export
function
from
(
value
:
vscode
.
TaskPresentationOptions
):
TaskPresentationOptionsDTO
|
undefined
{
if
(
value
===
undefined
||
value
===
null
)
{
return
undefined
;
}
return
value
;
}
export
function
to
(
value
:
TaskPresentationOptionsDTO
):
vscode
.
TaskPresentationOptions
{
export
function
to
(
value
:
TaskPresentationOptionsDTO
):
vscode
.
TaskPresentationOptions
|
undefined
{
if
(
value
===
undefined
||
value
===
null
)
{
return
undefined
;
}
...
...
@@ -64,13 +64,13 @@ namespace TaskPresentationOptionsDTO {
}
namespace
ProcessExecutionOptionsDTO
{
export
function
from
(
value
:
vscode
.
ProcessExecutionOptions
):
ProcessExecutionOptionsDTO
{
export
function
from
(
value
:
vscode
.
ProcessExecutionOptions
):
ProcessExecutionOptionsDTO
|
undefined
{
if
(
value
===
undefined
||
value
===
null
)
{
return
undefined
;
}
return
value
;
}
export
function
to
(
value
:
ProcessExecutionOptionsDTO
):
vscode
.
ProcessExecutionOptions
{
export
function
to
(
value
:
ProcessExecutionOptionsDTO
):
vscode
.
ProcessExecutionOptions
|
undefined
{
if
(
value
===
undefined
||
value
===
null
)
{
return
undefined
;
}
...
...
@@ -83,7 +83,7 @@ namespace ProcessExecutionDTO {
const
candidate
=
value
as
ProcessExecutionDTO
;
return
candidate
&&
!!
candidate
.
process
;
}
export
function
from
(
value
:
vscode
.
ProcessExecution
):
ProcessExecutionDTO
{
export
function
from
(
value
:
vscode
.
ProcessExecution
):
ProcessExecutionDTO
|
undefined
{
if
(
value
===
undefined
||
value
===
null
)
{
return
undefined
;
}
...
...
@@ -96,7 +96,7 @@ namespace ProcessExecutionDTO {
}
return
result
;
}
export
function
to
(
value
:
ProcessExecutionDTO
):
types
.
ProcessExecution
{
export
function
to
(
value
:
ProcessExecutionDTO
):
types
.
ProcessExecution
|
undefined
{
if
(
value
===
undefined
||
value
===
null
)
{
return
undefined
;
}
...
...
@@ -105,13 +105,13 @@ namespace ProcessExecutionDTO {
}
namespace
ShellExecutionOptionsDTO
{
export
function
from
(
value
:
vscode
.
ShellExecutionOptions
):
ShellExecutionOptionsDTO
{
export
function
from
(
value
:
vscode
.
ShellExecutionOptions
):
ShellExecutionOptionsDTO
|
undefined
{
if
(
value
===
undefined
||
value
===
null
)
{
return
undefined
;
}
return
value
;
}
export
function
to
(
value
:
ShellExecutionOptionsDTO
):
vscode
.
ShellExecutionOptions
{
export
function
to
(
value
:
ShellExecutionOptionsDTO
):
vscode
.
ShellExecutionOptions
|
undefined
{
if
(
value
===
undefined
||
value
===
null
)
{
return
undefined
;
}
...
...
@@ -124,7 +124,7 @@ namespace ShellExecutionDTO {
const
candidate
=
value
as
ShellExecutionDTO
;
return
candidate
&&
(
!!
candidate
.
commandLine
||
!!
candidate
.
command
);
}
export
function
from
(
value
:
vscode
.
ShellExecution
):
ShellExecutionDTO
{
export
function
from
(
value
:
vscode
.
ShellExecution
):
ShellExecutionDTO
|
undefined
{
if
(
value
===
undefined
||
value
===
null
)
{
return
undefined
;
}
...
...
@@ -141,14 +141,14 @@ namespace ShellExecutionDTO {
}
return
result
;
}
export
function
to
(
value
:
ShellExecutionDTO
):
types
.
ShellExecution
{
if
(
value
===
undefined
||
value
===
null
)
{
export
function
to
(
value
:
ShellExecutionDTO
):
types
.
ShellExecution
|
undefined
{
if
(
value
===
undefined
||
value
===
null
||
(
value
.
command
===
undefined
&&
value
.
commandLine
===
undefined
)
)
{
return
undefined
;
}
if
(
value
.
commandLine
)
{
return
new
types
.
ShellExecution
(
value
.
commandLine
,
value
.
options
);
}
else
{
return
new
types
.
ShellExecution
(
value
.
command
,
value
.
args
?
value
.
args
:
[],
value
.
options
);
return
new
types
.
ShellExecution
(
value
.
command
!
,
value
.
args
?
value
.
args
:
[],
value
.
options
);
}
}
}
...
...
@@ -173,8 +173,8 @@ namespace TaskHandleDTO {
folder
=
value
.
scope
.
uri
;
}
return
{
id
:
value
.
_id
,
workspaceFolder
:
folder
id
:
value
.
_id
!
,
workspaceFolder
:
folder
!
};
}
}
...
...
@@ -195,7 +195,7 @@ namespace TaskDTO {
return
result
;
}
export
function
from
(
value
:
vscode
.
Task
,
extension
:
IExtensionDescription
):
TaskDTO
{
export
function
from
(
value
:
vscode
.
Task
,
extension
:
IExtensionDescription
):
TaskDTO
|
undefined
{
if
(
value
===
undefined
||
value
===
null
)
{
return
undefined
;
}
...
...
@@ -207,7 +207,7 @@ namespace TaskDTO {
}
else
if
((
<
vscode
.
Task2
>
value
).
execution2
&&
(
<
vscode
.
Task2
>
value
).
execution2
instanceof
types
.
CustomExecution
)
{
execution
=
CustomExecutionDTO
.
from
(
<
types
.
CustomExecution
>
(
<
vscode
.
Task2
>
value
).
execution2
);
}
const
definition
:
TaskDefinitionDTO
=
TaskDefinitionDTO
.
from
(
value
.
definition
);
const
definition
:
TaskDefinitionDTO
|
undefined
=
TaskDefinitionDTO
.
from
(
value
.
definition
);
let
scope
:
number
|
UriComponents
;
if
(
value
.
scope
)
{
if
(
typeof
value
.
scope
===
'
number
'
)
{
...
...
@@ -224,7 +224,7 @@ namespace TaskDTO {
}
const
group
=
(
value
.
group
as
types
.
TaskGroup
)
?
(
value
.
group
as
types
.
TaskGroup
).
id
:
undefined
;
const
result
:
TaskDTO
=
{
_id
:
(
value
as
types
.
Task
).
_id
,
_id
:
(
value
as
types
.
Task
).
_id
!
,
definition
,
name
:
value
.
name
,
source
:
{
...
...
@@ -232,7 +232,7 @@ namespace TaskDTO {
label
:
value
.
source
,
scope
:
scope
},
execution
,
execution
:
execution
!
,
isBackground
:
value
.
isBackground
,
group
:
group
,
presentationOptions
:
TaskPresentationOptionsDTO
.
from
(
value
.
presentationOptions
),
...
...
@@ -242,7 +242,7 @@ namespace TaskDTO {
};
return
result
;
}
export
async
function
to
(
value
:
TaskDTO
,
workspace
:
IExtHostWorkspaceProvider
):
Promise
<
types
.
Task
>
{
export
async
function
to
(
value
:
TaskDTO
|
undefined
,
workspace
:
IExtHostWorkspaceProvider
):
Promise
<
types
.
Task
|
undefined
>
{
if
(
value
===
undefined
||
value
===
null
)
{
return
undefined
;
}
...
...
@@ -252,7 +252,7 @@ namespace TaskDTO {
}
else
if
(
ShellExecutionDTO
.
is
(
value
.
execution
))
{
execution
=
ShellExecutionDTO
.
to
(
value
.
execution
);
}
const
definition
:
vscode
.
TaskDefinition
=
TaskDefinitionDTO
.
to
(
value
.
definition
);
const
definition
:
vscode
.
TaskDefinition
|
undefined
=
TaskDefinitionDTO
.
to
(
value
.
definition
);
let
scope
:
vscode
.
TaskScope
.
Global
|
vscode
.
TaskScope
.
Workspace
|
vscode
.
WorkspaceFolder
|
undefined
;
if
(
value
.
source
)
{
if
(
value
.
source
.
scope
!==
undefined
)
{
...
...
@@ -268,7 +268,7 @@ namespace TaskDTO {
if
(
!
definition
||
!
scope
)
{
return
undefined
;
}
const
result
=
new
types
.
Task
(
definition
,
scope
,
value
.
name
,
value
.
source
.
label
,
execution
,
value
.
problemMatchers
);
const
result
=
new
types
.
Task
(
definition
,
scope
,
value
.
name
!
,
value
.
source
.
label
,
execution
,
value
.
problemMatchers
);
if
(
value
.
isBackground
!==
undefined
)
{
result
.
isBackground
=
value
.
isBackground
;
}
...
...
@@ -276,7 +276,7 @@ namespace TaskDTO {
result
.
group
=
types
.
TaskGroup
.
from
(
value
.
group
);
}
if
(
value
.
presentationOptions
)
{
result
.
presentationOptions
=
TaskPresentationOptionsDTO
.
to
(
value
.
presentationOptions
);
result
.
presentationOptions
=
TaskPresentationOptionsDTO
.
to
(
value
.
presentationOptions
)
!
;
}
if
(
value
.
_id
)
{
result
.
_id
=
value
.
_id
;
...
...
@@ -286,11 +286,11 @@ namespace TaskDTO {
}
namespace
TaskFilterDTO
{
export
function
from
(
value
:
vscode
.
TaskFilter
):
TaskFilterDTO
{
export
function
from
(
value
:
vscode
.
TaskFilter
|
undefined
):
TaskFilterDTO
|
undefined
{
return
value
;
}
export
function
to
(
value
:
TaskFilterDTO
):
vscode
.
TaskFilter
{
export
function
to
(
value
:
TaskFilterDTO
):
vscode
.
TaskFilter
|
undefined
{
if
(
!
value
)
{
return
undefined
;
}
...
...
@@ -320,7 +320,11 @@ class TaskExecutionImpl implements vscode.TaskExecution {
namespace
TaskExecutionDTO
{
export
async
function
to
(
value
:
TaskExecutionDTO
,
tasks
:
ExtHostTask
,
workspaceProvider
:
IExtHostWorkspaceProvider
):
Promise
<
vscode
.
TaskExecution
>
{
return
new
TaskExecutionImpl
(
tasks
,
value
.
id
,
await
TaskDTO
.
to
(
value
.
task
,
workspaceProvider
));
const
task
=
await
TaskDTO
.
to
(
value
.
task
,
workspaceProvider
);
if
(
!
task
)
{
throw
new
Error
(
'
Unexpected: Task cannot be created.
'
);
}
return
new
TaskExecutionImpl
(
tasks
,
value
.
id
,
task
);
}
export
function
from
(
value
:
vscode
.
TaskExecution
):
TaskExecutionDTO
{
return
{
...
...
@@ -358,7 +362,7 @@ class CustomExecutionData implements IDisposable {
}
private
onDidCloseTerminal
(
terminal
:
vscode
.
Terminal
):
void
{
if
(
this
.
terminal
===
terminal
)
{
if
(
(
this
.
terminal
===
terminal
)
&&
this
.
_cancellationSource
)
{
this
.
_cancellationSource
.
cancel
();
}
}
...
...
@@ -624,27 +628,30 @@ export class ExtHostTask implements ExtHostTaskShape {
const
taskIdPromises
:
Promise
<
void
>
[]
=
[];
const
fetchPromise
=
asPromise
(()
=>
handler
.
provider
.
provideTasks
(
CancellationToken
.
None
)).
then
(
value
=>
{
const
taskDTOs
:
TaskDTO
[]
=
[];
for
(
let
task
of
value
)
{
if
(
!
task
.
definition
||
!
validTypes
[
task
.
definition
.
type
])
{
console
.
warn
(
`The task [
${
task
.
source
}
,
${
task
.
name
}
] uses an undefined task type. The task will be ignored in the future.`
);
}
const
taskDTO
:
TaskDTO
=
TaskDTO
.
from
(
task
,
handler
.
extension
);
taskDTOs
.
push
(
taskDTO
);
if
(
CustomExecutionDTO
.
is
(
taskDTO
.
execution
))
{
taskIdPromises
.
push
(
new
Promise
((
resolve
)
=>
{
// The ID is calculated on the main thread task side, so, let's call into it here.
// We need the task id's pre-computed for custom task executions because when OnDidStartTask
// is invoked, we have to be able to map it back to our data.
this
.
_proxy
.
$createTaskId
(
taskDTO
).
then
((
taskId
)
=>
{
this
.
_providedCustomExecutions
.
set
(
taskId
,
new
CustomExecutionData
(
<
vscode
.
CustomExecution
>
(
<
vscode
.
Task2
>
task
).
execution2
,
this
.
_terminalService
));
resolve
();
});
}));
if
(
value
)
{
for
(
let
task
of
value
)
{
if
(
!
task
.
definition
||
!
validTypes
[
task
.
definition
.
type
])
{
console
.
warn
(
`The task [
${
task
.
source
}
,
${
task
.
name
}
] uses an undefined task type. The task will be ignored in the future.`
);
}
const
taskDTO
:
TaskDTO
|
undefined
=
TaskDTO
.
from
(
task
,
handler
.
extension
);
if
(
taskDTO
)
{
taskDTOs
.
push
(
taskDTO
);
if
(
CustomExecutionDTO
.
is
(
taskDTO
.
execution
))
{
taskIdPromises
.
push
(
new
Promise
((
resolve
)
=>
{
// The ID is calculated on the main thread task side, so, let's call into it here.
// We need the task id's pre-computed for custom task executions because when OnDidStartTask
// is invoked, we have to be able to map it back to our data.
this
.
_proxy
.
$createTaskId
(
taskDTO
).
then
((
taskId
)
=>
{
this
.
_providedCustomExecutions
.
set
(
taskId
,
new
CustomExecutionData
(
<
vscode
.
CustomExecution
>
(
<
vscode
.
Task2
>
task
).
execution2
,
this
.
_terminalService
));
resolve
();
});
}));
}
}
}
}
return
{
tasks
:
taskDTOs
,
extension
:
handler
.
extension
...
...
@@ -664,11 +671,14 @@ export class ExtHostTask implements ExtHostTaskShape {
const
configProvider
=
await
this
.
_configurationService
.
getConfigProvider
();
const
uri
:
URI
=
URI
.
revive
(
uriComponents
);
const
result
=
{
process
:
undefined
as
string
,
process
:
<
unknown
>
undefined
as
string
,
variables
:
Object
.
create
(
null
)
};
const
workspaceFolder
=
await
this
.
_workspaceProvider
.
resolveWorkspaceFolder
(
uri
);
const
workspaceFolders
=
await
this
.
_workspaceProvider
.
getWorkspaceFolders2
();
if
(
!
workspaceFolders
||
!
workspaceFolder
)
{
throw
new
Error
(
'
Unexpected: Tasks can only be run in a workspace folder
'
);
}
const
resolver
=
new
ExtHostVariableResolverService
(
workspaceFolders
,
this
.
_editorService
,
configProvider
);
const
ws
:
IWorkspaceFolder
=
{
uri
:
workspaceFolder
.
uri
,
...
...
@@ -704,16 +714,24 @@ export class ExtHostTask implements ExtHostTaskShape {
private
async
getTaskExecution
(
execution
:
TaskExecutionDTO
|
string
,
task
?:
vscode
.
Task
):
Promise
<
TaskExecutionImpl
>
{
if
(
typeof
execution
===
'
string
'
)
{
return
this
.
_taskExecutions
.
get
(
execution
);
const
taskExecution
=
this
.
_taskExecutions
.
get
(
execution
);
if
(
!
taskExecution
)
{
throw
new
Error
(
'
Unexpected: The specified task is missing an execution
'
);
}
return
taskExecution
;
}
let
result
:
TaskExecutionImpl
=
this
.
_taskExecutions
.
get
(
execution
.
id
);
let
result
:
TaskExecutionImpl
|
undefined
=
this
.
_taskExecutions
.
get
(
execution
.
id
);
if
(
result
)
{
return
result
;
}
result
=
new
TaskExecutionImpl
(
this
,
execution
.
id
,
task
?
task
:
await
TaskDTO
.
to
(
execution
.
task
,
this
.
_workspaceProvider
));
this
.
_taskExecutions
.
set
(
execution
.
id
,
result
);
return
result
;
const
taskToCreate
=
task
?
task
:
await
TaskDTO
.
to
(
execution
.
task
,
this
.
_workspaceProvider
);
if
(
!
taskToCreate
)
{
throw
new
Error
(
'
Unexpected: Task does not exist.
'
);
}
const
createdResult
:
TaskExecutionImpl
=
new
TaskExecutionImpl
(
this
,
execution
.
id
,
taskToCreate
);
this
.
_taskExecutions
.
set
(
execution
.
id
,
createdResult
);
return
createdResult
;
}
private
customExecutionComplete
(
execution
:
TaskExecutionDTO
):
void
{
...
...
src/vs/workbench/api/node/extHostTerminalService.ts
浏览文件 @
e7e2ce52
...
...
@@ -74,9 +74,9 @@ export class BaseExtHostTerminal {
}
export
class
ExtHostTerminal
extends
BaseExtHostTerminal
implements
vscode
.
Terminal
{
private
_pidPromise
:
Promise
<
number
>
;
private
_pidPromiseComplete
:
(
value
:
number
)
=>
any
;
private
_pidPromise
:
Promise
<
number
|
undefined
>
;
private
_cols
:
number
|
undefined
;
private
_pidPromiseComplete
:
((
value
:
number
|
undefined
)
=>
any
)
|
null
;
private
_rows
:
number
|
undefined
;
private
readonly
_onData
=
new
Emitter
<
string
>
();
...
...
@@ -90,7 +90,7 @@ export class ExtHostTerminal extends BaseExtHostTerminal implements vscode.Termi
constructor
(
proxy
:
MainThreadTerminalServiceShape
,
private
_name
:
string
,
private
_name
?
:
string
,
id
?:
number
,
pid
?:
number
)
{
...
...
@@ -108,7 +108,7 @@ export class ExtHostTerminal extends BaseExtHostTerminal implements vscode.Termi
shellPath
?:
string
,
shellArgs
?:
string
[],
cwd
?:
string
|
URI
,
env
?:
{
[
key
:
string
]:
string
},
env
?:
{
[
key
:
string
]:
string
|
null
},
waitOnExit
?:
boolean
,
strictEnv
?:
boolean
):
void
{
...
...
@@ -119,7 +119,7 @@ export class ExtHostTerminal extends BaseExtHostTerminal implements vscode.Termi
}
public
get
name
():
string
{
return
this
.
_name
;
return
this
.
_name
||
''
;
}
public
set
name
(
name
:
string
)
{
...
...
@@ -127,7 +127,7 @@ export class ExtHostTerminal extends BaseExtHostTerminal implements vscode.Termi
}
public
get
dimensions
():
vscode
.
TerminalDimensions
|
undefined
{
if
(
this
.
_cols
===
undefined
&&
this
.
_rows
===
undefined
)
{
if
(
this
.
_cols
===
undefined
||
this
.
_rows
===
undefined
)
{
return
undefined
;
}
return
{
...
...
@@ -146,7 +146,7 @@ export class ExtHostTerminal extends BaseExtHostTerminal implements vscode.Termi
return
true
;
}
public
get
processId
():
Promise
<
number
>
{
public
get
processId
():
Promise
<
number
|
undefined
>
{
return
this
.
_pidPromise
;
}
...
...
@@ -165,7 +165,7 @@ export class ExtHostTerminal extends BaseExtHostTerminal implements vscode.Termi
this
.
_queueApiRequest
(
this
.
_proxy
.
$hide
,
[]);
}
public
_setProcessId
(
processId
:
number
):
void
{
public
_setProcessId
(
processId
:
number
|
undefined
):
void
{
// The event may fire 2 times when the panel is restored
if
(
this
.
_pidPromiseComplete
)
{
this
.
_pidPromiseComplete
(
processId
);
...
...
@@ -203,15 +203,15 @@ export class ExtHostTerminalRenderer extends BaseExtHostTerminal implements vsco
}
private
_dimensions
:
vscode
.
TerminalDimensions
|
undefined
;
public
get
dimensions
():
vscode
.
TerminalDimensions
{
return
this
.
_dimensions
;
}
public
set
dimensions
(
dimensions
:
vscode
.
TerminalDimensions
)
{
public
get
dimensions
():
vscode
.
TerminalDimensions
|
undefined
{
return
this
.
_dimensions
;
}
public
set
dimensions
(
dimensions
:
vscode
.
TerminalDimensions
|
undefined
)
{
this
.
_checkDisposed
();
this
.
_dimensions
=
dimensions
;
this
.
_queueApiRequest
(
this
.
_proxy
.
$terminalRendererSetDimensions
,
[
dimensions
]);
}
private
_maximumDimensions
:
vscode
.
TerminalDimensions
;
public
get
maximumDimensions
():
vscode
.
TerminalDimensions
{
private
_maximumDimensions
:
vscode
.
TerminalDimensions
|
undefined
;
public
get
maximumDimensions
():
vscode
.
TerminalDimensions
|
undefined
{
if
(
!
this
.
_maximumDimensions
)
{
return
undefined
;
}
...
...
@@ -259,20 +259,21 @@ export class ExtHostTerminalRenderer extends BaseExtHostTerminal implements vsco
if
(
this
.
_maximumDimensions
&&
this
.
_maximumDimensions
.
columns
===
columns
&&
this
.
_maximumDimensions
.
rows
===
rows
)
{
return
;
}
this
.
_maximumDimensions
=
{
columns
,
rows
};
this
.
_onDidChangeMaximumDimensions
.
fire
(
this
.
maximumDimensions
);
const
newValue
=
{
columns
,
rows
};
this
.
_maximumDimensions
=
newValue
;
this
.
_onDidChangeMaximumDimensions
.
fire
(
newValue
);
}
}
export
class
ExtHostTerminalService
implements
ExtHostTerminalServiceShape
{
private
_proxy
:
MainThreadTerminalServiceShape
;
private
_activeTerminal
:
ExtHostTerminal
;
private
_activeTerminal
:
ExtHostTerminal
|
undefined
;
private
_terminals
:
ExtHostTerminal
[]
=
[];
private
_terminalProcesses
:
{
[
id
:
number
]:
TerminalProcess
}
=
{};
private
_terminalRenderers
:
ExtHostTerminalRenderer
[]
=
[];
private
_getTerminalPromises
:
{
[
id
:
number
]:
Promise
<
ExtHostTerminal
>
}
=
{};
public
get
activeTerminal
():
ExtHostTerminal
{
return
this
.
_activeTerminal
;
}
public
get
activeTerminal
():
ExtHostTerminal
|
undefined
{
return
this
.
_activeTerminal
;
}
public
get
terminals
():
ExtHostTerminal
[]
{
return
this
.
_terminals
;
}
private
readonly
_onDidCloseTerminal
:
Emitter
<
vscode
.
Terminal
>
=
new
Emitter
<
vscode
.
Terminal
>
();
...
...
@@ -326,6 +327,9 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
}
const
terminal
=
this
.
_getTerminalById
(
id
);
if
(
!
terminal
)
{
throw
new
Error
(
`Cannot resolve terminal renderer for terminal id
${
id
}
`
);
}
const
renderer
=
new
ExtHostTerminalRenderer
(
this
.
_proxy
,
terminal
.
name
,
terminal
,
terminal
.
_id
);
this
.
_terminalRenderers
.
push
(
renderer
);
...
...
@@ -339,6 +343,7 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
if
(
original
!==
this
.
_activeTerminal
)
{
this
.
_onDidChangeActiveTerminal
.
fire
(
this
.
_activeTerminal
);
}
return
;
}
this
.
_performTerminalIdAction
(
id
,
terminal
=>
{
if
(
terminal
)
{
...
...
@@ -364,7 +369,7 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
if
(
terminal
.
setDimensions
(
cols
,
rows
))
{
this
.
_onDidChangeTerminalDimensions
.
fire
({
terminal
:
terminal
,
dimensions
:
terminal
.
dimensions
dimensions
:
terminal
.
dimensions
as
vscode
.
TerminalDimensions
});
}
}
...
...
@@ -449,8 +454,8 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
// this._configHelper.mergeDefaultShellPathAndArgs(shellLaunchConfig);
const
platformKey
=
platform
.
isWindows
?
'
windows
'
:
platform
.
isMacintosh
?
'
osx
'
:
'
linux
'
;
const
shellConfigValue
:
string
=
terminalConfig
.
get
(
`shell.
${
platformKey
}
`
);
const
shellArgsConfigValue
:
string
=
terminalConfig
.
get
(
`shellArgs.
${
platformKey
}
`
);
const
shellConfigValue
:
string
|
undefined
=
terminalConfig
.
get
(
`shell.
${
platformKey
}
`
);
const
shellArgsConfigValue
:
string
|
undefined
=
terminalConfig
.
get
(
`shellArgs.
${
platformKey
}
`
);
shellLaunchConfig
.
executable
=
shellConfigValue
;
shellLaunchConfig
.
args
=
shellArgsConfigValue
;
...
...
@@ -470,20 +475,24 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
// Merge process env with the env from config
const
env
=
{
...
process
.
env
};
terminalEnvironment
.
mergeEnvironments
(
env
,
envFromConfig
);
terminalEnvironment
.
mergeEnvironments
(
env
,
shellLaunchConfig
.
env
);
Object
.
keys
(
env
).
filter
(
k
=>
env
[
k
]
===
undefined
).
forEach
(
k
=>
{
delete
env
[
k
];
});
const
castedEnv
=
env
as
platform
.
IProcessEnvironment
;
terminalEnvironment
.
mergeEnvironments
(
castedEnv
,
envFromConfig
);
terminalEnvironment
.
mergeEnvironments
(
castedEnv
,
shellLaunchConfig
.
env
);
// Sanitize the environment, removing any undesirable VS Code and Electron environment
// variables
sanitizeProcessEnvironment
(
e
nv
,
'
VSCODE_IPC_HOOK_CLI
'
);
sanitizeProcessEnvironment
(
castedE
nv
,
'
VSCODE_IPC_HOOK_CLI
'
);
// Continue env initialization, merging in the env from the launch
// config and adding keys that are needed to create the process
terminalEnvironment
.
addTerminalEnvironmentKeys
(
env
,
pkg
.
version
,
platform
.
locale
,
terminalConfig
.
get
(
'
setLocaleVariables
'
)
);
terminalEnvironment
.
addTerminalEnvironmentKeys
(
castedEnv
,
pkg
.
version
,
platform
.
locale
,
terminalConfig
.
get
(
'
setLocaleVariables
'
)
as
boolean
);
// Fork the process and listen for messages
this
.
_logService
.
debug
(
`Terminal process launching on ext host`
,
shellLaunchConfig
,
initialCwd
,
cols
,
rows
,
e
nv
);
const
p
=
new
TerminalProcess
(
shellLaunchConfig
,
initialCwd
,
cols
,
rows
,
env
,
terminalConfig
.
get
(
'
windowsEnableConpty
'
)
);
this
.
_logService
.
debug
(
`Terminal process launching on ext host`
,
shellLaunchConfig
,
initialCwd
,
cols
,
rows
,
castedE
nv
);
const
p
=
new
TerminalProcess
(
shellLaunchConfig
,
initialCwd
,
cols
,
rows
,
castedEnv
,
terminalConfig
.
get
(
'
windowsEnableConpty
'
)
as
boolean
);
p
.
onProcessIdReady
(
pid
=>
this
.
_proxy
.
$sendProcessPid
(
id
,
pid
));
p
.
onProcessTitleChanged
(
title
=>
this
.
_proxy
.
$sendProcessTitle
(
id
,
title
));
p
.
onProcessData
(
data
=>
this
.
_proxy
.
$sendProcessData
(
id
,
data
));
...
...
@@ -560,20 +569,20 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
});
}
private
_getTerminalById
(
id
:
number
):
ExtHostTerminal
{
private
_getTerminalById
(
id
:
number
):
ExtHostTerminal
|
null
{
return
this
.
_getTerminalObjectById
(
this
.
_terminals
,
id
);
}
private
_getTerminalRendererById
(
id
:
number
):
ExtHostTerminalRenderer
{
private
_getTerminalRendererById
(
id
:
number
):
ExtHostTerminalRenderer
|
null
{
return
this
.
_getTerminalObjectById
(
this
.
_terminalRenderers
,
id
);
}
private
_getTerminalObjectById
<
T
extends
ExtHostTerminal
|
ExtHostTerminalRenderer
>
(
array
:
T
[],
id
:
number
):
T
{
private
_getTerminalObjectById
<
T
extends
ExtHostTerminal
|
ExtHostTerminalRenderer
>
(
array
:
T
[],
id
:
number
):
T
|
null
{
const
index
=
this
.
_getTerminalObjectIndexById
(
array
,
id
);
return
index
!==
null
?
array
[
index
]
:
null
;
}
private
_getTerminalObjectIndexById
<
T
extends
ExtHostTerminal
|
ExtHostTerminalRenderer
>
(
array
:
T
[],
id
:
number
):
number
{
private
_getTerminalObjectIndexById
<
T
extends
ExtHostTerminal
|
ExtHostTerminalRenderer
>
(
array
:
T
[],
id
:
number
):
number
|
null
{
let
index
:
number
|
null
=
null
;
array
.
some
((
item
,
i
)
=>
{
const
thisId
=
item
.
_id
;
...
...
src/vs/workbench/api/shared/tasks.ts
浏览文件 @
e7e2ce52
...
...
@@ -102,7 +102,7 @@ export interface TaskSetDTO {
export
interface
TaskExecutionDTO
{
id
:
string
;
task
:
TaskDTO
;
task
:
TaskDTO
|
undefined
;
}
export
interface
TaskProcessStartedDTO
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录