Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
a4a726c8
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,发现更多精彩内容 >>
提交
a4a726c8
编写于
9月 04, 2018
作者:
R
Rob Lourens
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix #57775
上级
a87194fc
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
41 addition
and
12 deletion
+41
-12
src/vs/workbench/parts/search/common/searchModel.ts
src/vs/workbench/parts/search/common/searchModel.ts
+18
-4
src/vs/workbench/services/search/node/searchService.ts
src/vs/workbench/services/search/node/searchService.ts
+23
-8
未找到文件。
src/vs/workbench/parts/search/common/searchModel.ts
浏览文件 @
a4a726c8
...
...
@@ -230,10 +230,7 @@ export class FileMatch extends Disposable {
private
updateMatches
(
matches
:
FindMatch
[],
modelChange
:
boolean
)
{
matches
.
forEach
(
m
=>
{
const
textSearchResult
=
new
TextSearchResult
(
this
.
_model
.
getLineContent
(
m
.
range
.
startLineNumber
),
new
Range
(
m
.
range
.
startLineNumber
-
1
,
m
.
range
.
startColumn
-
1
,
m
.
range
.
startLineNumber
-
1
,
m
.
range
.
endColumn
-
1
),
this
.
_previewOptions
);
const
textSearchResult
=
editorMatchToTextSearchResult
(
m
,
this
.
_model
,
this
.
_previewOptions
);
const
match
=
new
Match
(
this
,
textSearchResult
);
if
(
!
this
.
_removedMatches
.
has
(
match
.
id
()))
{
...
...
@@ -986,3 +983,20 @@ export class RangeHighlightDecorations implements IDisposable {
isWholeLine
:
true
});
}
/**
* While search doesn't support multiline matches, collapse editor matches to a single line
*/
export
function
editorMatchToTextSearchResult
(
match
:
FindMatch
,
model
:
ITextModel
,
previewOptions
:
ITextSearchPreviewOptions
):
TextSearchResult
{
let
endLineNumber
=
match
.
range
.
endLineNumber
-
1
;
let
endCol
=
match
.
range
.
endColumn
-
1
;
if
(
match
.
range
.
endLineNumber
!==
match
.
range
.
startLineNumber
)
{
endLineNumber
=
match
.
range
.
startLineNumber
-
1
;
endCol
=
model
.
getLineLength
(
match
.
range
.
startLineNumber
);
}
return
new
TextSearchResult
(
model
.
getLineContent
(
match
.
range
.
startLineNumber
),
new
Range
(
match
.
range
.
startLineNumber
-
1
,
match
.
range
.
startColumn
-
1
,
endLineNumber
,
endCol
),
previewOptions
);
}
src/vs/workbench/services/search/node/searchService.ts
浏览文件 @
a4a726c8
...
...
@@ -6,6 +6,8 @@
import
{
getPathFromAmdModule
}
from
'
vs/base/common/amd
'
;
import
*
as
arrays
from
'
vs/base/common/arrays
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
canceled
}
from
'
vs/base/common/errors
'
;
import
{
Event
}
from
'
vs/base/common/event
'
;
import
{
Disposable
,
IDisposable
,
toDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
ResourceMap
,
values
}
from
'
vs/base/common/map
'
;
...
...
@@ -18,20 +20,19 @@ import { TPromise } from 'vs/base/common/winjs.base';
import
*
as
pfs
from
'
vs/base/node/pfs
'
;
import
{
getNextTickChannel
}
from
'
vs/base/parts/ipc/node/ipc
'
;
import
{
Client
,
IIPCOptions
}
from
'
vs/base/parts/ipc/node/ipc.cp
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
FindMatch
,
ITextModel
}
from
'
vs/editor/common/model
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IDebugParams
,
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
FileMatch
,
ICachedSearchStats
,
IFileMatch
,
IF
olderQuery
,
IProgress
,
ISearchComplete
,
ISearchConfiguration
,
ISearchEngineStats
,
ISearchProgressItem
,
ISearchQuery
,
ISearchResultProvider
,
ISearchService
,
pathIncludedInQuery
,
QueryType
,
SearchProviderType
,
IFileSearchStats
,
TextSearchResult
}
from
'
vs/platform/search/common/search
'
;
import
{
FileMatch
,
ICachedSearchStats
,
IFileMatch
,
IF
ileSearchStats
,
IFolderQuery
,
IProgress
,
ISearchComplete
,
ISearchConfiguration
,
ISearchEngineStats
,
ISearchProgressItem
,
ISearchQuery
,
ISearchResultProvider
,
ISearchService
,
ITextSearchPreviewOptions
,
pathIncludedInQuery
,
QueryType
,
SearchProviderType
,
TextSearchResult
}
from
'
vs/platform/search/common/search
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IExtensionService
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
import
{
IUntitledEditorService
}
from
'
vs/workbench/services/untitled/common/untitledEditorService
'
;
import
{
IRawSearch
,
IRawSearchService
,
ISerializedFileMatch
,
ISerializedSearchComplete
,
ISerializedSearchProgressItem
,
isSerializedSearchComplete
,
isSerializedSearchSuccess
}
from
'
./search
'
;
import
{
ISearchChannel
,
SearchChannelClient
}
from
'
./searchIpc
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
canceled
}
from
'
vs/base/common/errors
'
;
export
class
SearchService
extends
Disposable
implements
ISearchService
{
public
_serviceBrand
:
any
;
...
...
@@ -363,10 +364,7 @@ export class SearchService extends Disposable implements ISearchService {
localResults
.
set
(
resource
,
fileMatch
);
matches
.
forEach
((
match
)
=>
{
fileMatch
.
matches
.
push
(
new
TextSearchResult
(
model
.
getLineContent
(
match
.
range
.
startLineNumber
),
new
Range
(
match
.
range
.
startLineNumber
-
1
,
match
.
range
.
startColumn
-
1
,
match
.
range
.
startLineNumber
-
1
,
match
.
range
.
endColumn
-
1
),
query
.
previewOptions
));
fileMatch
.
matches
.
push
(
editorMatchToTextSearchResult
(
match
,
model
,
query
.
previewOptions
));
});
}
else
{
localResults
.
set
(
resource
,
null
);
...
...
@@ -576,3 +574,20 @@ export class DiskSearch implements ISearchResultProvider {
return
this
.
raw
.
clearCache
(
cacheKey
);
}
}
/**
* While search doesn't support multiline matches, collapse editor matches to a single line
*/
function
editorMatchToTextSearchResult
(
match
:
FindMatch
,
model
:
ITextModel
,
previewOptions
:
ITextSearchPreviewOptions
):
TextSearchResult
{
let
endLineNumber
=
match
.
range
.
endLineNumber
-
1
;
let
endCol
=
match
.
range
.
endColumn
-
1
;
if
(
match
.
range
.
endLineNumber
!==
match
.
range
.
startLineNumber
)
{
endLineNumber
=
match
.
range
.
startLineNumber
-
1
;
endCol
=
model
.
getLineLength
(
match
.
range
.
startLineNumber
);
}
return
new
TextSearchResult
(
model
.
getLineContent
(
match
.
range
.
startLineNumber
),
new
Range
(
match
.
range
.
startLineNumber
-
1
,
match
.
range
.
startColumn
-
1
,
endLineNumber
,
endCol
),
previewOptions
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录