Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
41a422cf
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,发现更多精彩内容 >>
提交
41a422cf
编写于
10月 08, 2017
作者:
M
Melvin Philips
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add support for macOS globalFindClipboard #11233
TODO: Add test and restrict it to OSX
上级
ede70684
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
54 addition
and
5 deletion
+54
-5
src/vs/editor/common/commonCodeEditor.ts
src/vs/editor/common/commonCodeEditor.ts
+3
-1
src/vs/editor/contrib/find/browser/find.ts
src/vs/editor/contrib/find/browser/find.ts
+4
-2
src/vs/editor/contrib/find/common/findController.ts
src/vs/editor/contrib/find/common/findController.ts
+29
-2
src/vs/platform/clipboard/common/clipboardService.ts
src/vs/platform/clipboard/common/clipboardService.ts
+10
-0
src/vs/platform/clipboard/electron-browser/clipboardService.ts
...s/platform/clipboard/electron-browser/clipboardService.ts
+8
-0
未找到文件。
src/vs/editor/common/commonCodeEditor.ts
浏览文件 @
41a422cf
...
...
@@ -9,6 +9,7 @@ import Event, { Emitter } from 'vs/base/common/event';
import
{
Disposable
,
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
ServicesAccessor
,
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IClipboardService
}
from
'
vs/platform/clipboard/common/clipboardService
'
;
import
{
ServiceCollection
}
from
'
vs/platform/instantiation/common/serviceCollection
'
;
import
{
IContextKey
,
IContextKeyServiceTarget
,
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
CommonEditorConfiguration
}
from
'
vs/editor/common/config/commonEditorConfig
'
;
...
...
@@ -120,7 +121,8 @@ export abstract class CommonCodeEditor extends Disposable implements editorCommo
domElement
:
IContextKeyServiceTarget
,
options
:
editorOptions
.
IEditorOptions
,
instantiationService
:
IInstantiationService
,
contextKeyService
:
IContextKeyService
contextKeyService
:
IContextKeyService
,
clipboardService
:
IClipboardService
)
{
super
();
this
.
domElement
=
domElement
;
...
...
src/vs/editor/contrib/find/browser/find.ts
浏览文件 @
41a422cf
...
...
@@ -14,6 +14,7 @@ import { FindOptionsWidget } from 'vs/editor/contrib/find/browser/findOptionsWid
import
{
CommonFindController
,
FindStartFocusAction
,
IFindStartOptions
}
from
'
vs/editor/contrib/find/common/findController
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
IClipboardService
}
from
'
vs/platform/clipboard/common/clipboardService
'
;
@
editorContribution
export
class
FindController
extends
CommonFindController
implements
IFindController
{
...
...
@@ -27,9 +28,10 @@ export class FindController extends CommonFindController implements IFindControl
@
IContextKeyService
contextKeyService
:
IContextKeyService
,
@
IKeybindingService
keybindingService
:
IKeybindingService
,
@
IThemeService
themeService
:
IThemeService
,
@
IStorageService
storageService
:
IStorageService
@
IStorageService
storageService
:
IStorageService
,
@
IClipboardService
clipBoardService
:
IClipboardService
)
{
super
(
editor
,
contextKeyService
,
storageService
);
super
(
editor
,
contextKeyService
,
storageService
,
clipBoardService
);
this
.
_widget
=
this
.
_register
(
new
FindWidget
(
editor
,
this
,
this
.
_state
,
contextViewService
,
keybindingService
,
contextKeyService
,
themeService
));
this
.
_findOptionsWidget
=
this
.
_register
(
new
FindOptionsWidget
(
editor
,
this
.
_state
,
keybindingService
,
themeService
));
...
...
src/vs/editor/contrib/find/common/findController.ts
浏览文件 @
41a422cf
...
...
@@ -18,6 +18,7 @@ import { getSelectionSearchString } from 'vs/editor/contrib/find/common/find';
import
{
Delayer
}
from
'
vs/base/common/async
'
;
import
{
EditorContextKeys
}
from
'
vs/editor/common/editorContextKeys
'
;
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
import
{
IClipboardService
}
from
'
vs/platform/clipboard/common/clipboardService
'
;
export
const
enum
FindStartFocusAction
{
NoFocusChange
,
...
...
@@ -48,16 +49,18 @@ export class CommonFindController extends Disposable implements editorCommon.IEd
protected
_updateHistoryDelayer
:
Delayer
<
void
>
;
private
_model
:
FindModelBoundToEditorModel
;
private
_storageService
:
IStorageService
;
private
_clipboardService
:
IClipboardService
;
public
static
get
(
editor
:
editorCommon
.
ICommonCodeEditor
):
CommonFindController
{
return
editor
.
getContribution
<
CommonFindController
>
(
CommonFindController
.
ID
);
}
constructor
(
editor
:
editorCommon
.
ICommonCodeEditor
,
@
IContextKeyService
contextKeyService
:
IContextKeyService
,
@
IStorageService
storageService
:
IStorageService
)
{
constructor
(
editor
:
editorCommon
.
ICommonCodeEditor
,
@
IContextKeyService
contextKeyService
:
IContextKeyService
,
@
IStorageService
storageService
:
IStorageService
,
@
IClipboardService
clipBoardService
:
IClipboardService
)
{
super
();
this
.
_editor
=
editor
;
this
.
_findWidgetVisible
=
CONTEXT_FIND_WIDGET_VISIBLE
.
bindTo
(
contextKeyService
);
this
.
_storageService
=
storageService
;
this
.
_clipboardService
=
clipBoardService
;
this
.
_updateHistoryDelayer
=
new
Delayer
<
void
>
(
500
);
this
.
_currentHistoryNavigator
=
new
HistoryNavigator
<
string
>
();
...
...
@@ -301,6 +304,14 @@ export class CommonFindController extends Disposable implements editorCommon.IEd
}
return
true
;
}
public
showGlobalBufferTerm
():
string
{
return
this
.
_clipboardService
.
readFindText
();
}
public
setGlobalBufferTerm
(
text
:
string
)
{
this
.
_clipboardService
.
writeFindText
(
text
);
}
}
@
editorAction
...
...
@@ -332,6 +343,8 @@ export class StartFindAction extends EditorAction {
shouldFocus
:
FindStartFocusAction
.
FocusFindInput
,
shouldAnimate
:
true
});
controller
.
setGlobalBufferTerm
(
getSelectionSearchString
(
editor
));
}
}
}
...
...
@@ -371,7 +384,21 @@ export class NextMatchFindAction extends MatchFindAction {
}
protected
_run
(
controller
:
CommonFindController
):
boolean
{
return
controller
.
moveToNextMatch
();
let
selectionSearchString
=
controller
.
showGlobalBufferTerm
();
if
(
controller
.
getState
().
searchString
===
selectionSearchString
)
{
return
controller
.
moveToNextMatch
();
}
if
(
selectionSearchString
)
{
controller
.
setSearchString
(
selectionSearchString
);
controller
.
start
({
forceRevealReplace
:
false
,
seedSearchStringFromSelection
:
false
,
shouldFocus
:
FindStartFocusAction
.
NoFocusChange
,
shouldAnimate
:
true
});
return
true
;
}
return
false
;
}
}
...
...
src/vs/platform/clipboard/common/clipboardService.ts
浏览文件 @
41a422cf
...
...
@@ -17,4 +17,14 @@ export interface IClipboardService {
* Writes text to the system clipboard.
*/
writeText
(
text
:
string
):
void
;
/**
* Reads text from the system find pasteboard.
*/
readFindText
():
string
;
/**
* Writes text to the system find pasteboard.
*/
writeFindText
(
text
:
string
):
void
;
}
\ No newline at end of file
src/vs/platform/clipboard/electron-browser/clipboardService.ts
浏览文件 @
41a422cf
...
...
@@ -15,4 +15,12 @@ export class ClipboardService implements IClipboardService {
public
writeText
(
text
:
string
):
void
{
clipboard
.
writeText
(
text
);
}
public
readFindText
():
string
{
return
clipboard
.
readFindText
();
}
public
writeFindText
(
text
:
string
):
void
{
clipboard
.
writeFindText
(
text
);
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录