Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
1580cd18
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,发现更多精彩内容 >>
提交
1580cd18
编写于
10月 08, 2018
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
first version of simple clipboard API, #217
上级
e2027598
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
79 addition
and
0 deletion
+79
-0
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+13
-0
src/vs/workbench/api/electron-browser/extensionHost.contribution.ts
...kbench/api/electron-browser/extensionHost.contribution.ts
+1
-0
src/vs/workbench/api/electron-browser/mainThreadClipboard.ts
src/vs/workbench/api/electron-browser/mainThreadClipboard.ts
+27
-0
src/vs/workbench/api/node/extHost.api.impl.ts
src/vs/workbench/api/node/extHost.api.impl.ts
+6
-0
src/vs/workbench/api/node/extHost.protocol.ts
src/vs/workbench/api/node/extHost.protocol.ts
+6
-0
src/vs/workbench/api/node/extHostClipboard.ts
src/vs/workbench/api/node/extHostClipboard.ts
+26
-0
未找到文件。
src/vs/vscode.proposed.d.ts
浏览文件 @
1580cd18
...
@@ -11,6 +11,19 @@ declare module 'vscode' {
...
@@ -11,6 +11,19 @@ declare module 'vscode' {
export
function
sampleFunction
():
Thenable
<
any
>
;
export
function
sampleFunction
():
Thenable
<
any
>
;
}
}
//#region Joh - clipboard https://github.com/Microsoft/vscode/issues/217
export
interface
Clipboard
{
readText
():
Promise
<
string
>
;
writeText
(
value
:
string
):
Promise
<
void
>
;
}
export
namespace
env
{
export
const
clipboard
:
Clipboard
;
}
//#endregion
//#region Joh - read/write in chunks
//#region Joh - read/write in chunks
export
interface
FileSystemProvider
{
export
interface
FileSystemProvider
{
...
...
src/vs/workbench/api/electron-browser/extensionHost.contribution.ts
浏览文件 @
1580cd18
...
@@ -15,6 +15,7 @@ import { LanguageConfigurationFileHandler } from 'vs/workbench/parts/codeEditor/
...
@@ -15,6 +15,7 @@ import { LanguageConfigurationFileHandler } from 'vs/workbench/parts/codeEditor/
// --- mainThread participants
// --- mainThread participants
import
'
vs/workbench/api/node/apiCommands
'
;
import
'
vs/workbench/api/node/apiCommands
'
;
import
'
./mainThreadClipboard
'
;
import
'
./mainThreadCommands
'
;
import
'
./mainThreadCommands
'
;
import
'
./mainThreadConfiguration
'
;
import
'
./mainThreadConfiguration
'
;
import
'
./mainThreadDebugService
'
;
import
'
./mainThreadDebugService
'
;
...
...
src/vs/workbench/api/electron-browser/mainThreadClipboard.ts
0 → 100644
浏览文件 @
1580cd18
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
clipboard
}
from
'
electron
'
;
import
{
extHostNamedCustomer
}
from
'
vs/workbench/api/electron-browser/extHostCustomers
'
;
import
{
MainContext
,
MainThreadClipboardShape
}
from
'
../node/extHost.protocol
'
;
@
extHostNamedCustomer
(
MainContext
.
MainThreadClipboard
)
export
class
MainThreadCommands
implements
MainThreadClipboardShape
{
dispose
():
void
{
// nothing
}
$readText
():
Promise
<
string
>
{
return
Promise
.
resolve
(
clipboard
.
readText
());
}
$writeText
(
value
:
string
):
Promise
<
void
>
{
clipboard
.
writeText
(
value
);
return
undefined
;
}
}
src/vs/workbench/api/node/extHost.api.impl.ts
浏览文件 @
1580cd18
...
@@ -61,6 +61,7 @@ import { ExtHostComments } from './extHostComments';
...
@@ -61,6 +61,7 @@ import { ExtHostComments } from './extHostComments';
import
{
ExtHostSearch
}
from
'
./extHostSearch
'
;
import
{
ExtHostSearch
}
from
'
./extHostSearch
'
;
import
{
ExtHostUrls
}
from
'
./extHostUrls
'
;
import
{
ExtHostUrls
}
from
'
./extHostUrls
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
ExtHostClipboard
}
from
'
vs/workbench/api/node/extHostClipboard
'
;
export
interface
IExtensionApiFactory
{
export
interface
IExtensionApiFactory
{
(
extension
:
IExtensionDescription
):
typeof
vscode
;
(
extension
:
IExtensionDescription
):
typeof
vscode
;
...
@@ -134,6 +135,7 @@ export function createApiFactory(
...
@@ -134,6 +135,7 @@ export function createApiFactory(
rpcProtocol
.
assertRegistered
(
expected
);
rpcProtocol
.
assertRegistered
(
expected
);
// Other instances
// Other instances
const
extHostClipboard
=
new
ExtHostClipboard
(
rpcProtocol
);
const
extHostMessageService
=
new
ExtHostMessageService
(
rpcProtocol
);
const
extHostMessageService
=
new
ExtHostMessageService
(
rpcProtocol
);
const
extHostDialogs
=
new
ExtHostDialogs
(
rpcProtocol
);
const
extHostDialogs
=
new
ExtHostDialogs
(
rpcProtocol
);
const
extHostStatusBar
=
new
ExtHostStatusBar
(
rpcProtocol
);
const
extHostStatusBar
=
new
ExtHostStatusBar
(
rpcProtocol
);
...
@@ -237,6 +239,10 @@ export function createApiFactory(
...
@@ -237,6 +239,10 @@ export function createApiFactory(
get
onDidChangeLogLevel
()
{
get
onDidChangeLogLevel
()
{
checkProposedApiEnabled
(
extension
);
checkProposedApiEnabled
(
extension
);
return
extHostLogService
.
onDidChangeLogLevel
;
return
extHostLogService
.
onDidChangeLogLevel
;
},
get
clipboard
():
vscode
.
Clipboard
{
checkProposedApiEnabled
(
extension
);
return
extHostClipboard
;
}
}
});
});
...
...
src/vs/workbench/api/node/extHost.protocol.ts
浏览文件 @
1580cd18
...
@@ -86,6 +86,11 @@ export interface IMainContext extends IRPCProtocol {
...
@@ -86,6 +86,11 @@ export interface IMainContext extends IRPCProtocol {
// --- main thread
// --- main thread
export
interface
MainThreadClipboardShape
extends
IDisposable
{
$readText
():
Promise
<
string
>
;
$writeText
(
value
:
string
):
Promise
<
void
>
;
}
export
interface
MainThreadCommandsShape
extends
IDisposable
{
export
interface
MainThreadCommandsShape
extends
IDisposable
{
$registerCommand
(
id
:
string
):
void
;
$registerCommand
(
id
:
string
):
void
;
$unregisterCommand
(
id
:
string
):
void
;
$unregisterCommand
(
id
:
string
):
void
;
...
@@ -1014,6 +1019,7 @@ export interface ExtHostCommentsShape {
...
@@ -1014,6 +1019,7 @@ export interface ExtHostCommentsShape {
// --- proxy identifiers
// --- proxy identifiers
export
const
MainContext
=
{
export
const
MainContext
=
{
MainThreadClipboard
:
<
ProxyIdentifier
<
MainThreadClipboardShape
>>
createMainId
<
MainThreadClipboardShape
>
(
'
MainThreadClipboard
'
),
MainThreadCommands
:
<
ProxyIdentifier
<
MainThreadCommandsShape
>>
createMainId
<
MainThreadCommandsShape
>
(
'
MainThreadCommands
'
),
MainThreadCommands
:
<
ProxyIdentifier
<
MainThreadCommandsShape
>>
createMainId
<
MainThreadCommandsShape
>
(
'
MainThreadCommands
'
),
MainThreadComments
:
createMainId
<
MainThreadCommentsShape
>
(
'
MainThreadComments
'
),
MainThreadComments
:
createMainId
<
MainThreadCommentsShape
>
(
'
MainThreadComments
'
),
MainThreadConfiguration
:
createMainId
<
MainThreadConfigurationShape
>
(
'
MainThreadConfiguration
'
),
MainThreadConfiguration
:
createMainId
<
MainThreadConfigurationShape
>
(
'
MainThreadConfiguration
'
),
...
...
src/vs/workbench/api/node/extHostClipboard.ts
0 → 100644
浏览文件 @
1580cd18
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
IMainContext
,
MainContext
,
MainThreadClipboardShape
}
from
'
vs/workbench/api/node/extHost.protocol
'
;
import
*
as
vscode
from
'
vscode
'
;
export
class
ExtHostClipboard
implements
vscode
.
Clipboard
{
private
readonly
_proxy
:
MainThreadClipboardShape
;
constructor
(
mainContext
:
IMainContext
)
{
this
.
_proxy
=
mainContext
.
getProxy
(
MainContext
.
MainThreadClipboard
);
}
readText
():
Promise
<
string
>
{
return
this
.
_proxy
.
$readText
();
}
writeText
(
value
:
string
):
Promise
<
void
>
{
return
this
.
_proxy
.
$writeText
(
value
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录