Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
42b4fcc4
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,体验更适合开发者的 AI 搜索 >>
提交
42b4fcc4
编写于
11月 20, 2017
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debt - avoid paths.relative in search
上级
1152a5c0
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
83 addition
and
69 deletion
+83
-69
src/vs/workbench/common/actions.ts
src/vs/workbench/common/actions.ts
+1
-1
src/vs/workbench/parts/search/browser/searchActions.ts
src/vs/workbench/parts/search/browser/searchActions.ts
+1
-59
src/vs/workbench/parts/search/browser/searchViewlet.ts
src/vs/workbench/parts/search/browser/searchViewlet.ts
+2
-2
src/vs/workbench/parts/search/electron-browser/media/search-dark.svg
...bench/parts/search/electron-browser/media/search-dark.svg
+0
-0
src/vs/workbench/parts/search/electron-browser/media/search.contribution.css
...rts/search/electron-browser/media/search.contribution.css
+0
-0
src/vs/workbench/parts/search/electron-browser/search.contribution.ts
...ench/parts/search/electron-browser/search.contribution.ts
+4
-3
src/vs/workbench/parts/search/electron-browser/searchActions.ts
.../workbench/parts/search/electron-browser/searchActions.ts
+71
-0
src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts
...ench/test/electron-browser/api/extHostApiCommands.test.ts
+1
-1
src/vs/workbench/test/electron-browser/quickopen.perf.integrationTest.ts
...h/test/electron-browser/quickopen.perf.integrationTest.ts
+1
-1
src/vs/workbench/test/electron-browser/textsearch.perf.integrationTest.ts
.../test/electron-browser/textsearch.perf.integrationTest.ts
+1
-1
src/vs/workbench/workbench.main.ts
src/vs/workbench/workbench.main.ts
+1
-1
未找到文件。
src/vs/workbench/common/actions.ts
浏览文件 @
42b4fcc4
...
...
@@ -57,7 +57,7 @@ Registry.add(Extensions.WorkbenchActions, new class implements IWorkbenchActionR
// menu item
// TODO@Rob slightly weird if-check required because of
// https://github.com/Microsoft/vscode/blob/master/src/vs/workbench/parts/search/browser/search.contribution.ts#L266
// https://github.com/Microsoft/vscode/blob/master/src/vs/workbench/parts/search/
electron-
browser/search.contribution.ts#L266
if
(
descriptor
.
label
)
{
const
command
=
{
...
...
src/vs/workbench/parts/search/browser/searchActions.ts
浏览文件 @
42b4fcc4
...
...
@@ -5,10 +5,7 @@
import
nls
=
require
(
'
vs/nls
'
);
import
DOM
=
require
(
'
vs/base/browser/dom
'
);
import
errors
=
require
(
'
vs/base/common/errors
'
);
import
resources
=
require
(
'
vs/base/common/resources
'
);
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
Action
}
from
'
vs/base/common/actions
'
;
import
{
IViewletService
}
from
'
vs/workbench/services/viewlet/browser/viewlet
'
;
import
{
ITree
}
from
'
vs/base/parts/tree/browser/tree
'
;
...
...
@@ -21,9 +18,7 @@ import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/edi
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
ResolvedKeybinding
,
createKeybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
ServicesAccessor
,
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IListService
}
from
'
vs/platform/list/browser/listService
'
;
import
{
explorerItemToFileResource
}
from
'
vs/workbench/parts/files/common/files
'
;
import
{
ServicesAccessor
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
OS
}
from
'
vs/base/common/platform
'
;
import
{
IContextKeyService
,
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
...
...
@@ -335,59 +330,6 @@ export class CloseReplaceAction extends Action {
}
}
export
class
FindInWorkspaceAction
extends
Action
{
public
static
ID
=
'
filesExplorer.findInWorkspace
'
;
constructor
(
@
IViewletService
private
viewletService
:
IViewletService
)
{
super
(
FindInWorkspaceAction
.
ID
,
nls
.
localize
(
'
findInWorkspace
'
,
"
Find in Workspace...
"
));
}
public
run
(
event
?:
any
):
TPromise
<
any
>
{
return
this
.
viewletService
.
openViewlet
(
Constants
.
VIEWLET_ID
,
true
).
then
(
viewlet
=>
{
(
viewlet
as
SearchViewlet
).
searchInFolder
(
null
);
});
}
}
export
class
FindInFolderAction
extends
Action
{
public
static
ID
=
'
filesExplorer.findInFolder
'
;
private
resource
:
URI
;
constructor
(
resource
:
URI
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
)
{
super
(
FindInFolderAction
.
ID
,
nls
.
localize
(
'
findInFolder
'
,
"
Find in Folder...
"
));
this
.
resource
=
resource
;
}
public
run
(
event
?:
any
):
TPromise
<
any
>
{
return
this
.
instantiationService
.
invokeFunction
.
apply
(
this
.
instantiationService
,
[
findInFolderCommand
,
this
.
resource
]);
}
}
export
const
findInFolderCommand
=
(
accessor
:
ServicesAccessor
,
resource
?:
URI
)
=>
{
const
listService
=
accessor
.
get
(
IListService
);
const
viewletService
=
accessor
.
get
(
IViewletService
);
if
(
!
URI
.
isUri
(
resource
))
{
const
focused
=
listService
.
getFocused
()
?
listService
.
getFocused
().
getFocus
()
:
void
0
;
if
(
focused
)
{
const
file
=
explorerItemToFileResource
(
focused
);
if
(
file
)
{
resource
=
file
.
isDirectory
?
file
.
resource
:
resources
.
dirname
(
file
.
resource
);
}
}
}
viewletService
.
openViewlet
(
Constants
.
VIEWLET_ID
,
true
).
then
(
viewlet
=>
{
if
(
resource
)
{
(
viewlet
as
SearchViewlet
).
searchInFolder
(
resource
);
}
}).
done
(
null
,
errors
.
onUnexpectedError
);
};
export
class
RefreshAction
extends
Action
{
constructor
(
private
viewlet
:
SearchViewlet
)
{
...
...
src/vs/workbench/parts/search/browser/searchViewlet.ts
浏览文件 @
42b4fcc4
...
...
@@ -898,7 +898,7 @@ export class SearchViewlet extends Viewlet {
}
}
public
searchInFolder
(
resource
:
URI
):
void
{
public
searchInFolder
(
resource
:
URI
,
pathToRelative
:
(
from
:
string
,
to
:
string
)
=>
string
):
void
{
let
folderPath
=
null
;
const
workspace
=
this
.
contextService
.
getWorkspace
();
if
(
resource
)
{
...
...
@@ -916,7 +916,7 @@ export class SearchViewlet extends Viewlet {
// If this root is the only one with its basename, use a relative ./ path. If there is another, use an absolute path
const
isUniqueFolder
=
workspace
.
folders
.
filter
(
folder
=>
paths
.
basename
(
folder
.
uri
.
fsPath
)
===
owningRootBasename
).
length
===
1
;
if
(
isUniqueFolder
)
{
folderPath
=
`./
${
owningRootBasename
}
/
${
paths
.
relative
(
owningFolder
.
uri
.
fsPath
,
resource
.
fsPath
)}
`
;
folderPath
=
`./
${
owningRootBasename
}
/
${
paths
.
normalize
(
pathToRelative
(
owningFolder
.
uri
.
fsPath
,
resource
.
fsPath
)
)}
`
;
}
else
{
folderPath
=
resource
.
fsPath
;
}
...
...
src/vs/workbench/parts/search/browser/media/search-dark.svg
→
src/vs/workbench/parts/search/
electron-
browser/media/search-dark.svg
浏览文件 @
42b4fcc4
文件已移动
src/vs/workbench/parts/search/browser/media/search.contribution.css
→
src/vs/workbench/parts/search/
electron-
browser/media/search.contribution.css
浏览文件 @
42b4fcc4
文件已移动
src/vs/workbench/parts/search/browser/search.contribution.ts
→
src/vs/workbench/parts/search/
electron-
browser/search.contribution.ts
浏览文件 @
42b4fcc4
...
...
@@ -48,6 +48,7 @@ import { OpenAnythingHandler } from 'vs/workbench/parts/search/browser/openAnyth
import
{
registerLanguageCommand
}
from
'
vs/editor/browser/editorExtensions
'
;
import
{
getWorkspaceSymbols
}
from
'
vs/workbench/parts/search/common/search
'
;
import
{
illegalArgument
}
from
'
vs/base/common/errors
'
;
import
{
FindInFolderAction
,
findInFolderCommand
,
FindInWorkspaceAction
}
from
'
vs/workbench/parts/search/electron-browser/searchActions
'
;
registerSingleton
(
ISearchWorkbenchService
,
SearchWorkbenchService
);
replaceContributions
();
...
...
@@ -183,7 +184,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
}
});
CommandsRegistry
.
registerCommand
(
searchActions
.
FindInFolderAction
.
ID
,
searchActions
.
findInFolderCommand
);
CommandsRegistry
.
registerCommand
(
FindInFolderAction
.
ID
,
findInFolderCommand
);
class
ExplorerViewerActionContributor
extends
ActionBarContributor
{
private
_instantiationService
:
IInstantiationService
;
...
...
@@ -216,10 +217,10 @@ class ExplorerViewerActionContributor extends ActionBarContributor {
if
(
this
.
hasSecondaryActions
(
context
))
{
let
action
:
Action
;
if
(
context
.
element
instanceof
Model
)
{
action
=
this
.
_instantiationService
.
createInstance
(
searchActions
.
FindInWorkspaceAction
);
action
=
this
.
_instantiationService
.
createInstance
(
FindInWorkspaceAction
);
}
else
{
let
fileResource
=
explorerItemToFileResource
(
context
.
element
);
action
=
this
.
_instantiationService
.
createInstance
(
searchActions
.
FindInFolderAction
,
fileResource
.
resource
);
action
=
this
.
_instantiationService
.
createInstance
(
FindInFolderAction
,
fileResource
.
resource
);
}
action
.
order
=
55
;
...
...
src/vs/workbench/parts/search/electron-browser/searchActions.ts
0 → 100644
浏览文件 @
42b4fcc4
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
nls
=
require
(
'
vs/nls
'
);
import
errors
=
require
(
'
vs/base/common/errors
'
);
import
resources
=
require
(
'
vs/base/common/resources
'
);
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
Action
}
from
'
vs/base/common/actions
'
;
import
{
IViewletService
}
from
'
vs/workbench/services/viewlet/browser/viewlet
'
;
import
{
SearchViewlet
}
from
'
vs/workbench/parts/search/browser/searchViewlet
'
;
import
*
as
Constants
from
'
vs/workbench/parts/search/common/constants
'
;
import
{
ServicesAccessor
,
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IListService
}
from
'
vs/platform/list/browser/listService
'
;
import
{
explorerItemToFileResource
}
from
'
vs/workbench/parts/files/common/files
'
;
import
{
relative
}
from
'
path
'
;
export
class
FindInFolderAction
extends
Action
{
public
static
ID
=
'
filesExplorer.findInFolder
'
;
private
resource
:
URI
;
constructor
(
resource
:
URI
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
)
{
super
(
FindInFolderAction
.
ID
,
nls
.
localize
(
'
findInFolder
'
,
"
Find in Folder...
"
));
this
.
resource
=
resource
;
}
public
run
(
event
?:
any
):
TPromise
<
any
>
{
return
this
.
instantiationService
.
invokeFunction
.
apply
(
this
.
instantiationService
,
[
findInFolderCommand
,
this
.
resource
]);
}
}
export
const
findInFolderCommand
=
(
accessor
:
ServicesAccessor
,
resource
?:
URI
)
=>
{
const
listService
=
accessor
.
get
(
IListService
);
const
viewletService
=
accessor
.
get
(
IViewletService
);
if
(
!
URI
.
isUri
(
resource
))
{
const
focused
=
listService
.
getFocused
()
?
listService
.
getFocused
().
getFocus
()
:
void
0
;
if
(
focused
)
{
const
file
=
explorerItemToFileResource
(
focused
);
if
(
file
)
{
resource
=
file
.
isDirectory
?
file
.
resource
:
resources
.
dirname
(
file
.
resource
);
}
}
}
viewletService
.
openViewlet
(
Constants
.
VIEWLET_ID
,
true
).
then
(
viewlet
=>
{
if
(
resource
)
{
(
viewlet
as
SearchViewlet
).
searchInFolder
(
resource
,
(
from
,
to
)
=>
relative
(
from
,
to
));
}
}).
done
(
null
,
errors
.
onUnexpectedError
);
};
export
class
FindInWorkspaceAction
extends
Action
{
public
static
ID
=
'
filesExplorer.findInWorkspace
'
;
constructor
(
@
IViewletService
private
viewletService
:
IViewletService
)
{
super
(
FindInWorkspaceAction
.
ID
,
nls
.
localize
(
'
findInWorkspace
'
,
"
Find in Workspace...
"
));
}
public
run
(
event
?:
any
):
TPromise
<
any
>
{
return
this
.
viewletService
.
openViewlet
(
Constants
.
VIEWLET_ID
,
true
).
then
(
viewlet
=>
{
(
viewlet
as
SearchViewlet
).
searchInFolder
(
null
,
(
from
,
to
)
=>
relative
(
from
,
to
));
});
}
}
\ No newline at end of file
src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts
浏览文件 @
42b4fcc4
...
...
@@ -31,7 +31,7 @@ import { MainContext, ExtHostContext } from 'vs/workbench/api/node/extHost.proto
import
{
ExtHostDiagnostics
}
from
'
vs/workbench/api/node/extHostDiagnostics
'
;
import
*
as
vscode
from
'
vscode
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
'
vs/workbench/parts/search/browser/search.contribution
'
;
import
'
vs/workbench/parts/search/
electron-
browser/search.contribution
'
;
const
defaultSelector
=
{
scheme
:
'
far
'
};
const
model
:
EditorCommon
.
IModel
=
EditorModel
.
createFromString
(
...
...
src/vs/workbench/test/electron-browser/quickopen.perf.integrationTest.ts
浏览文件 @
42b4fcc4
...
...
@@ -5,7 +5,7 @@
'
use strict
'
;
import
'
vs/workbench/parts/search/browser/search.contribution
'
;
// load contributions
import
'
vs/workbench/parts/search/
electron-
browser/search.contribution
'
;
// load contributions
import
*
as
assert
from
'
assert
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
createSyncDescriptor
}
from
'
vs/platform/instantiation/common/descriptors
'
;
...
...
src/vs/workbench/test/electron-browser/textsearch.perf.integrationTest.ts
浏览文件 @
42b4fcc4
...
...
@@ -5,7 +5,7 @@
'
use strict
'
;
import
'
vs/workbench/parts/search/browser/search.contribution
'
;
// load contributions
import
'
vs/workbench/parts/search/
electron-
browser/search.contribution
'
;
// load contributions
import
*
as
assert
from
'
assert
'
;
import
*
as
fs
from
'
fs
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
...
...
src/vs/workbench/workbench.main.ts
浏览文件 @
42b4fcc4
...
...
@@ -45,7 +45,7 @@ import 'vs/workbench/parts/backup/common/backup.contribution';
import
'
vs/workbench/parts/stats/node/stats.contribution
'
;
import
'
vs/workbench/parts/cache/node/cache.contribution
'
;
import
'
vs/workbench/parts/search/browser/search.contribution
'
;
import
'
vs/workbench/parts/search/
electron-
browser/search.contribution
'
;
import
'
vs/workbench/parts/search/browser/searchViewlet
'
;
// can be packaged separately
import
'
vs/workbench/parts/search/browser/openAnythingHandler
'
;
// can be packaged separately
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录