Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
678abfe8
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,发现更多精彩内容 >>
提交
678abfe8
编写于
9月 12, 2019
作者:
D
Daniel Imms
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove Terminal.onDidWriteData
Replaced by vscode.window.onDidWriteTerminalData Fixes #78574
上级
ebe12f58
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
8 addition
and
113 deletion
+8
-113
extensions/debug-server-ready/src/extension.ts
extensions/debug-server-ready/src/extension.ts
+5
-5
extensions/vscode-api-tests/src/singlefolder-tests/terminal.test.ts
.../vscode-api-tests/src/singlefolder-tests/terminal.test.ts
+0
-43
extensions/vscode-api-tests/src/singlefolder-tests/workspace.tasks.test.ts
...-api-tests/src/singlefolder-tests/workspace.tasks.test.ts
+1
-1
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+0
-9
src/vs/workbench/api/browser/mainThreadTerminalService.ts
src/vs/workbench/api/browser/mainThreadTerminalService.ts
+2
-28
src/vs/workbench/api/common/extHost.protocol.ts
src/vs/workbench/api/common/extHost.protocol.ts
+0
-4
src/vs/workbench/api/common/extHostTerminalService.ts
src/vs/workbench/api/common/extHostTerminalService.ts
+0
-23
未找到文件。
extensions/debug-server-ready/src/extension.ts
浏览文件 @
678abfe8
...
...
@@ -78,11 +78,11 @@ class ServerReadyDetector extends vscode.Disposable {
}
this
.
shellPid
=
undefined
;
terminals
.
forEach
(
terminal
=>
{
this
.
disposables
.
push
(
terminal
.
onDidWriteData
(
s
=>
{
this
.
detectPattern
(
s
);
this
.
disposables
.
push
(
vscode
.
window
.
onDidWriteTerminalData
(
e
=>
{
if
(
terminals
.
indexOf
(
e
.
terminal
)
!==
-
1
)
{
this
.
detectPattern
(
e
.
data
);
}
}));
});
}
detectPattern
(
s
:
string
):
void
{
...
...
extensions/vscode-api-tests/src/singlefolder-tests/terminal.test.ts
浏览文件 @
678abfe8
...
...
@@ -152,22 +152,6 @@ suite('window namespace tests', () => {
// });
suite
(
'
hideFromUser
'
,
()
=>
{
// test('should fire onDidWriteData correctly', done => {
// const terminal = window.createTerminal({ name: 'bg', hideFromUser: true });
// let data = '';
// terminal.onDidWriteData(e => {
// data += e;
// if (data.indexOf('foo') !== -1) {
// const reg3 = window.onDidCloseTerminal(() => {
// reg3.dispose();
// done();
// });
// terminal.dispose();
// }
// });
// terminal.sendText('foo');
// });
test
(
'
should be available to terminals API
'
,
done
=>
{
const
terminal
=
window
.
createTerminal
({
name
:
'
bg
'
,
hideFromUser
:
true
});
window
.
onDidOpenTerminal
(
t
=>
{
...
...
@@ -247,33 +231,6 @@ suite('window namespace tests', () => {
window
.
createTerminal
({
name
:
'
c
'
,
pty
});
});
test
(
'
should fire Terminal.onData on write
'
,
(
done
)
=>
{
const
reg1
=
window
.
onDidOpenTerminal
(
async
term
=>
{
equal
(
terminal
,
term
);
reg1
.
dispose
();
const
reg2
=
terminal
.
onDidWriteData
(
data
=>
{
equal
(
data
,
'
bar
'
);
reg2
.
dispose
();
const
reg3
=
window
.
onDidCloseTerminal
(()
=>
{
reg3
.
dispose
();
done
();
});
terminal
.
dispose
();
});
await
startPromise
;
writeEmitter
.
fire
(
'
bar
'
);
});
let
startResolve
:
()
=>
void
;
const
startPromise
:
Promise
<
void
>
=
new
Promise
<
void
>
(
r
=>
startResolve
=
r
);
const
writeEmitter
=
new
EventEmitter
<
string
>
();
const
pty
:
Pseudoterminal
=
{
onDidWrite
:
writeEmitter
.
event
,
open
:
()
=>
startResolve
(),
close
:
()
=>
{}
};
const
terminal
=
window
.
createTerminal
({
name
:
'
foo
'
,
pty
});
});
// The below tests depend on global UI state and each other
// test('should not provide dimensions on start as the terminal has not been shown yet', (done) => {
// const reg1 = window.onDidOpenTerminal(term => {
...
...
extensions/vscode-api-tests/src/singlefolder-tests/workspace.tasks.test.ts
浏览文件 @
678abfe8
...
...
@@ -21,7 +21,7 @@ suite('workspace-namespace', () => {
const
taskName
=
'
First custom task
'
;
const
reg1
=
vscode
.
window
.
onDidOpenTerminal
(
term
=>
{
reg1
.
dispose
();
const
reg2
=
term
.
onDidWrite
Data
(
e
=>
{
const
reg2
=
vscode
.
window
.
onDidWriteTerminal
Data
(
e
=>
{
reg2
.
dispose
();
assert
.
equal
(
e
,
'
testing
\r\n
'
);
term
.
dispose
();
...
...
src/vs/vscode.proposed.d.ts
浏览文件 @
678abfe8
...
...
@@ -778,15 +778,6 @@ declare module 'vscode' {
* created.
*/
readonly
dimensions
:
TerminalDimensions
|
undefined
;
/**
* Fires when the terminal's pty slave pseudo-device is written to. In other words, this
* provides access to the raw data stream from the process running within the terminal,
* including VT sequences.
*
* @deprecated Use [window.onDidWriteTerminalData](#onDidWriteTerminalData).
*/
readonly
onDidWriteData
:
Event
<
string
>
;
}
//#endregion
...
...
src/vs/workbench/api/browser/mainThreadTerminalService.ts
浏览文件 @
678abfe8
...
...
@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
IDisposable
,
DisposableStore
,
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
DisposableStore
,
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
ITerminalService
,
ITerminalInstance
,
IShellLaunchConfig
,
ITerminalProcessExtHostProxy
,
ISpawnExtHostProcessRequest
,
ITerminalDimensions
,
EXT_HOST_CREATION_DELAY
,
IAvailableShellsRequest
,
IDefaultShellAndArgsRequest
,
IStartExtensionTerminalRequest
}
from
'
vs/workbench/contrib/terminal/common/terminal
'
;
import
{
ExtHostContext
,
ExtHostTerminalServiceShape
,
MainThreadTerminalServiceShape
,
MainContext
,
IExtHostContext
,
IShellLaunchConfigDto
,
TerminalLaunchConfig
,
ITerminalDimensionsDto
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
extHostNamedCustomer
}
from
'
vs/workbench/api/common/extHostCustomers
'
;
...
...
@@ -21,7 +21,6 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape
private
readonly
_toDispose
=
new
DisposableStore
();
private
readonly
_terminalProcesses
=
new
Map
<
number
,
Promise
<
ITerminalProcessExtHostProxy
>>
();
private
readonly
_terminalProcessesReady
=
new
Map
<
number
,
(
proxy
:
ITerminalProcessExtHostProxy
)
=>
void
>
();
private
readonly
_terminalOnDidWriteDataListeners
=
new
Map
<
number
,
IDisposable
>
();
private
_dataEventTracker
:
TerminalDataEventTracker
|
undefined
;
constructor
(
...
...
@@ -131,30 +130,10 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape
}
}
/** @deprecated */
public
$registerOnDataListener
(
terminalId
:
number
):
void
{
const
terminalInstance
=
this
.
_terminalService
.
getInstanceFromId
(
terminalId
);
if
(
!
terminalInstance
)
{
return
;
}
// Listener already registered
if
(
this
.
_terminalOnDidWriteDataListeners
.
has
(
terminalId
))
{
return
;
}
// Register
const
listener
=
terminalInstance
.
onData
(
data
=>
{
this
.
_onTerminalData
(
terminalId
,
data
);
});
this
.
_terminalOnDidWriteDataListeners
.
set
(
terminalId
,
listener
);
terminalInstance
.
addDisposable
(
listener
);
}
public
$startSendingDataEvents
():
void
{
if
(
!
this
.
_dataEventTracker
)
{
this
.
_dataEventTracker
=
this
.
_instantiationService
.
createInstance
(
TerminalDataEventTracker
,
(
id
,
data
)
=>
{
this
.
_onTerminalData
2
(
id
,
data
);
this
.
_onTerminalData
(
id
,
data
);
});
}
}
...
...
@@ -170,15 +149,10 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape
this
.
_proxy
.
$acceptActiveTerminalChanged
(
terminalId
);
}
/** @deprecated */
private
_onTerminalData
(
terminalId
:
number
,
data
:
string
):
void
{
this
.
_proxy
.
$acceptTerminalProcessData
(
terminalId
,
data
);
}
private
_onTerminalData2
(
terminalId
:
number
,
data
:
string
):
void
{
this
.
_proxy
.
$acceptTerminalProcessData2
(
terminalId
,
data
);
}
private
_onTitleChanged
(
terminalId
:
number
,
name
:
string
):
void
{
this
.
_proxy
.
$acceptTerminalTitleChange
(
terminalId
,
name
);
}
...
...
src/vs/workbench/api/common/extHost.protocol.ts
浏览文件 @
678abfe8
...
...
@@ -398,8 +398,6 @@ export interface MainThreadTerminalServiceShape extends IDisposable {
$hide
(
terminalId
:
number
):
void
;
$sendText
(
terminalId
:
number
,
text
:
string
,
addNewLine
:
boolean
):
void
;
$show
(
terminalId
:
number
,
preserveFocus
:
boolean
):
void
;
/** @deprecated */
$registerOnDataListener
(
terminalId
:
number
):
void
;
$startSendingDataEvents
():
void
;
$stopSendingDataEvents
():
void
;
...
...
@@ -1154,9 +1152,7 @@ export interface ExtHostTerminalServiceShape {
$acceptTerminalOpened
(
id
:
number
,
name
:
string
):
void
;
$acceptActiveTerminalChanged
(
id
:
number
|
null
):
void
;
$acceptTerminalProcessId
(
id
:
number
,
processId
:
number
):
void
;
/** @deprecated */
$acceptTerminalProcessData
(
id
:
number
,
data
:
string
):
void
;
$acceptTerminalProcessData2
(
id
:
number
,
data
:
string
):
void
;
$acceptTerminalTitleChange
(
id
:
number
,
name
:
string
):
void
;
$acceptTerminalDimensions
(
id
:
number
,
cols
:
number
,
rows
:
number
):
void
;
$acceptTerminalMaximumDimensions
(
id
:
number
,
cols
:
number
,
rows
:
number
):
void
;
...
...
src/vs/workbench/api/common/extHostTerminalService.ts
浏览文件 @
678abfe8
...
...
@@ -97,17 +97,6 @@ export class ExtHostTerminal extends BaseExtHostTerminal implements vscode.Termi
private
_pidPromiseComplete
:
((
value
:
number
|
undefined
)
=>
any
)
|
undefined
;
private
_rows
:
number
|
undefined
;
/** @deprecated */
private
readonly
_onData
=
new
Emitter
<
string
>
();
/** @deprecated */
public
get
onDidWriteData
():
Event
<
string
>
{
// Tell the main side to start sending data if it's not already
this
.
_idPromise
.
then
(
id
=>
{
this
.
_proxy
.
$registerOnDataListener
(
id
);
});
return
this
.
_onData
.
event
;
}
public
isOpen
:
boolean
=
false
;
constructor
(
...
...
@@ -201,10 +190,6 @@ export class ExtHostTerminal extends BaseExtHostTerminal implements vscode.Termi
});
}
}
public
_fireOnData
(
data
:
string
):
void
{
this
.
_onData
.
fire
(
data
);
}
}
class
ApiRequest
{
...
...
@@ -354,15 +339,7 @@ export abstract class BaseExtHostTerminalService implements IExtHostTerminalServ
}
}
/** @deprecated */
public
async
$acceptTerminalProcessData
(
id
:
number
,
data
:
string
):
Promise
<
void
>
{
const
terminal
=
await
this
.
_getTerminalByIdEventually
(
id
);
if
(
terminal
)
{
terminal
.
_fireOnData
(
data
);
}
}
public
async
$acceptTerminalProcessData2
(
id
:
number
,
data
:
string
):
Promise
<
void
>
{
const
terminal
=
await
this
.
_getTerminalByIdEventually
(
id
);
if
(
terminal
)
{
this
.
_onDidWriteTerminalData
.
fire
({
terminal
,
data
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录