Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
b16693e3
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,发现更多精彩内容 >>
提交
b16693e3
编写于
6月 26, 2017
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adopt folder pased excludes config for history (fixes #29164)
上级
ca599712
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
48 addition
and
19 deletion
+48
-19
src/vs/workbench/services/history/browser/history.ts
src/vs/workbench/services/history/browser/history.ts
+48
-19
未找到文件。
src/vs/workbench/services/history/browser/history.ts
浏览文件 @
b16693e3
...
...
@@ -7,8 +7,8 @@
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
errors
=
require
(
'
vs/base/common/errors
'
);
import
objects
=
require
(
'
vs/base/common/objects
'
);
import
URI
from
'
vs/base/common/uri
'
;
import
objects
=
require
(
'
vs/base/common/objects
'
);
import
{
IEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IEditor
as
IBaseEditor
,
IEditorInput
,
ITextEditorOptions
,
IResourceInput
}
from
'
vs/platform/editor/common/editor
'
;
import
{
EditorInput
,
IEditorCloseEvent
,
IEditorRegistry
,
Extensions
,
toResource
,
IEditorGroup
}
from
'
vs/workbench/common/editor
'
;
...
...
@@ -29,6 +29,7 @@ import { getCodeEditor } from 'vs/editor/common/services/codeEditorService';
import
{
getExcludes
,
ISearchConfiguration
}
from
'
vs/platform/search/common/search
'
;
import
{
ParsedExpression
,
parse
,
IExpression
}
from
'
vs/base/common/glob
'
;
import
{
ICursorPositionChangedEvent
}
from
'
vs/editor/common/controller/cursorEvents
'
;
import
{
getPathLabel
}
from
"
vs/base/common/labels
"
;
/**
* Stores the selection & view state of an editor and allows to compare it to other selection states.
...
...
@@ -78,13 +79,13 @@ interface ISerializedFileHistoryEntry {
}
export
abstract
class
BaseHistoryService
{
protected
toUnbind
:
IDisposable
[];
protected
mapRootToExcludes
:
Map
<
string
,
ParsedExpression
>
;
private
mapRootToExpression
:
Map
<
string
,
IExpression
>
;
private
activeEditorListeners
:
IDisposable
[];
protected
excludes
:
ParsedExpression
;
private
lastKnownExcludesConfig
:
IExpression
;
constructor
(
protected
editorGroupService
:
IEditorGroupService
,
protected
editorService
:
IWorkbenchEditorService
,
...
...
@@ -94,25 +95,52 @@ export abstract class BaseHistoryService {
this
.
toUnbind
=
[];
this
.
activeEditorListeners
=
[];
// Editor Input Changes
this
.
mapRootToExcludes
=
new
Map
<
string
,
ParsedExpression
>
();
this
.
mapRootToExpression
=
new
Map
<
string
,
IExpression
>
();
// Listeners
this
.
toUnbind
.
push
(
this
.
editorGroupService
.
onEditorsChanged
(()
=>
this
.
onEditorsChanged
()));
this
.
toUnbind
.
push
(
this
.
configurationService
.
onDidUpdateConfiguration
(()
=>
this
.
onConfigurationChanged
()));
this
.
toUnbind
.
push
(
this
.
contextService
.
onDidChangeWorkspaceRoots
(()
=>
this
.
onDidChangeWorkspaceRoots
()));
// Configuration Changes
this
.
toUnbind
.
push
(
this
.
configurationService
.
onDidUpdateConfiguration
(()
=>
this
.
onConfigurationChanged
(
true
)));
this
.
onConfigurationChanged
();
this
.
updateExcludes
(
false
);
}
private
onConfigurationChanged
(
update
?:
boolean
):
void
{
const
excludesConfig
=
getExcludes
(
this
.
configurationService
.
getConfiguration
<
ISearchConfiguration
>
());
if
(
!
objects
.
equals
(
excludesConfig
,
this
.
lastKnownExcludesConfig
))
{
const
configChanged
=
!!
this
.
lastKnownExcludesConfig
;
private
onConfigurationChanged
():
void
{
this
.
updateExcludes
(
true
);
}
private
onDidChangeWorkspaceRoots
():
void
{
this
.
updateExcludes
(
true
);
}
this
.
lastKnownExcludesConfig
=
excludesConfig
;
this
.
excludes
=
parse
(
excludesConfig
,
{
trimForExclusions
:
true
})
;
private
updateExcludes
(
fromEvent
:
boolean
):
void
{
let
changed
=
false
;
if
(
configChanged
)
{
this
.
handleExcludesChange
();
// Parse excludes per workspace
if
(
this
.
contextService
.
hasWorkspace
())
{
this
.
contextService
.
getWorkspace2
().
roots
.
forEach
(
root
=>
{
const
rootExcludes
=
getExcludes
(
this
.
configurationService
.
getConfiguration
<
ISearchConfiguration
>
(
void
0
,
{
resource
:
root
}));
if
(
!
this
.
mapRootToExpression
.
has
(
root
.
toString
())
||
!
objects
.
equals
(
this
.
mapRootToExpression
.
get
(
root
.
toString
()),
rootExcludes
))
{
changed
=
true
;
this
.
mapRootToExcludes
.
set
(
root
.
toString
(),
parse
(
rootExcludes
,
{
trimForExclusions
:
true
}));
this
.
mapRootToExpression
.
set
(
root
.
toString
(),
objects
.
clone
(
rootExcludes
));
}
});
}
// Always set for files outside root as well
const
globalExcludes
=
getExcludes
(
this
.
configurationService
.
getConfiguration
<
ISearchConfiguration
>
());
if
(
!
this
.
mapRootToExpression
.
has
(
null
)
||
!
objects
.
equals
(
this
.
mapRootToExpression
.
get
(
null
),
globalExcludes
))
{
changed
=
true
;
this
.
mapRootToExcludes
.
set
(
null
,
parse
(
globalExcludes
,
{
trimForExclusions
:
true
}));
this
.
mapRootToExpression
.
set
(
null
,
objects
.
clone
(
globalExcludes
));
}
if
(
fromEvent
&&
changed
)
{
this
.
handleExcludesChange
();
}
}
...
...
@@ -394,9 +422,10 @@ export class HistoryService extends BaseHistoryService implements IHistoryServic
}
const
resourceInput
=
input
as
IResourceInput
;
const
relativePath
=
this
.
contextService
.
toWorkspaceRelativePath
(
resourceInput
.
resource
);
const
rootForInput
=
this
.
contextService
.
getRoot
(
resourceInput
.
resource
);
const
excludesForInput
=
this
.
mapRootToExcludes
.
get
(
rootForInput
?
rootForInput
.
toString
()
:
null
);
return
!
this
.
excludes
(
relativePath
||
resourceInput
.
resource
.
fsPath
);
return
!
excludesForInput
(
getPathLabel
(
resourceInput
.
resource
,
this
.
contextService
)
);
}
protected
handleExcludesChange
():
void
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录