Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
1ef4a75f
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,发现更多精彩内容 >>
提交
1ef4a75f
编写于
7月 18, 2019
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Replace IDisposable with DisposableStore in a few more simple cases
上级
b61980c3
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
27 addition
and
31 deletion
+27
-31
src/vs/editor/contrib/find/findModel.ts
src/vs/editor/contrib/find/findModel.ts
+8
-9
src/vs/editor/contrib/gotoError/gotoError.ts
src/vs/editor/contrib/gotoError/gotoError.ts
+5
-6
src/vs/platform/telemetry/common/telemetryService.ts
src/vs/platform/telemetry/common/telemetryService.ts
+3
-3
src/vs/workbench/api/common/extHostSCM.ts
src/vs/workbench/api/common/extHostSCM.ts
+1
-3
src/vs/workbench/contrib/files/common/explorerService.ts
src/vs/workbench/contrib/files/common/explorerService.ts
+10
-10
未找到文件。
src/vs/editor/contrib/find/findModel.ts
浏览文件 @
1ef4a75f
...
...
@@ -5,7 +5,7 @@
import
{
RunOnceScheduler
,
TimeoutTimer
}
from
'
vs/base/common/async
'
;
import
{
KeyCode
,
KeyMod
}
from
'
vs/base/common/keyCodes
'
;
import
{
IDisposable
,
dispos
e
}
from
'
vs/base/common/lifecycle
'
;
import
{
dispose
,
DisposableStor
e
}
from
'
vs/base/common/lifecycle
'
;
import
{
IActiveCodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
ReplaceCommand
,
ReplaceCommandThatPreservesSelection
}
from
'
vs/editor/common/commands/replaceCommand
'
;
import
{
CursorChangeReason
,
ICursorPositionChangedEvent
}
from
'
vs/editor/common/controller/cursorEvents
'
;
...
...
@@ -71,7 +71,7 @@ export class FindModelBoundToEditorModel {
private
readonly
_editor
:
IActiveCodeEditor
;
private
readonly
_state
:
FindReplaceState
;
private
_toDispose
:
IDisposable
[]
;
private
readonly
_toDispose
=
new
DisposableStore
()
;
private
readonly
_decorations
:
FindDecorations
;
private
_ignoreModelContentChanged
:
boolean
;
private
readonly
_startSearchingTimer
:
TimeoutTimer
;
...
...
@@ -82,17 +82,16 @@ export class FindModelBoundToEditorModel {
constructor
(
editor
:
IActiveCodeEditor
,
state
:
FindReplaceState
)
{
this
.
_editor
=
editor
;
this
.
_state
=
state
;
this
.
_toDispose
=
[];
this
.
_isDisposed
=
false
;
this
.
_startSearchingTimer
=
new
TimeoutTimer
();
this
.
_decorations
=
new
FindDecorations
(
editor
);
this
.
_toDispose
.
push
(
this
.
_decorations
);
this
.
_toDispose
.
add
(
this
.
_decorations
);
this
.
_updateDecorationsScheduler
=
new
RunOnceScheduler
(()
=>
this
.
research
(
false
),
100
);
this
.
_toDispose
.
push
(
this
.
_updateDecorationsScheduler
);
this
.
_toDispose
.
add
(
this
.
_updateDecorationsScheduler
);
this
.
_toDispose
.
push
(
this
.
_editor
.
onDidChangeCursorPosition
((
e
:
ICursorPositionChangedEvent
)
=>
{
this
.
_toDispose
.
add
(
this
.
_editor
.
onDidChangeCursorPosition
((
e
:
ICursorPositionChangedEvent
)
=>
{
if
(
e
.
reason
===
CursorChangeReason
.
Explicit
||
e
.
reason
===
CursorChangeReason
.
Undo
...
...
@@ -103,7 +102,7 @@ export class FindModelBoundToEditorModel {
}));
this
.
_ignoreModelContentChanged
=
false
;
this
.
_toDispose
.
push
(
this
.
_editor
.
onDidChangeModelContent
((
e
)
=>
{
this
.
_toDispose
.
add
(
this
.
_editor
.
onDidChangeModelContent
((
e
)
=>
{
if
(
this
.
_ignoreModelContentChanged
)
{
return
;
}
...
...
@@ -115,7 +114,7 @@ export class FindModelBoundToEditorModel {
this
.
_updateDecorationsScheduler
.
schedule
();
}));
this
.
_toDispose
.
push
(
this
.
_state
.
onFindReplaceStateChange
((
e
)
=>
this
.
_onStateChanged
(
e
)));
this
.
_toDispose
.
add
(
this
.
_state
.
onFindReplaceStateChange
((
e
)
=>
this
.
_onStateChanged
(
e
)));
this
.
research
(
false
,
this
.
_state
.
searchScope
);
}
...
...
@@ -123,7 +122,7 @@ export class FindModelBoundToEditorModel {
public
dispose
():
void
{
this
.
_isDisposed
=
true
;
dispose
(
this
.
_startSearchingTimer
);
this
.
_toDispose
=
dispose
(
this
.
_toDispose
);
this
.
_toDispose
.
dispose
(
);
}
private
_onStateChanged
(
e
:
FindReplaceStateChangedEvent
):
void
{
...
...
src/vs/editor/contrib/gotoError/gotoError.ts
浏览文件 @
1ef4a75f
...
...
@@ -6,7 +6,7 @@
import
*
as
nls
from
'
vs/nls
'
;
import
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
KeyCode
,
KeyMod
}
from
'
vs/base/common/keyCodes
'
;
import
{
IDisposable
,
dispose
,
DisposableStore
}
from
'
vs/base/common/lifecycle
'
;
import
{
DisposableStore
}
from
'
vs/base/common/lifecycle
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
RawContextKey
,
IContextKey
,
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IMarker
,
IMarkerService
,
MarkerSeverity
}
from
'
vs/platform/markers/common/markers
'
;
...
...
@@ -32,7 +32,7 @@ class MarkerModel {
private
readonly
_editor
:
ICodeEditor
;
private
_markers
:
IMarker
[];
private
_nextIdx
:
number
;
private
_toUnbind
:
IDisposable
[]
;
private
readonly
_toUnbind
=
new
DisposableStore
()
;
private
_ignoreSelectionChange
:
boolean
;
private
readonly
_onCurrentMarkerChanged
:
Emitter
<
IMarker
|
undefined
>
;
private
readonly
_onMarkerSetChanged
:
Emitter
<
MarkerModel
>
;
...
...
@@ -41,15 +41,14 @@ class MarkerModel {
this
.
_editor
=
editor
;
this
.
_markers
=
[];
this
.
_nextIdx
=
-
1
;
this
.
_toUnbind
=
[];
this
.
_ignoreSelectionChange
=
false
;
this
.
_onCurrentMarkerChanged
=
new
Emitter
<
IMarker
>
();
this
.
_onMarkerSetChanged
=
new
Emitter
<
MarkerModel
>
();
this
.
setMarkers
(
markers
);
// listen on editor
this
.
_toUnbind
.
push
(
this
.
_editor
.
onDidDispose
(()
=>
this
.
dispose
()));
this
.
_toUnbind
.
push
(
this
.
_editor
.
onDidChangeCursorPosition
(()
=>
{
this
.
_toUnbind
.
add
(
this
.
_editor
.
onDidDispose
(()
=>
this
.
dispose
()));
this
.
_toUnbind
.
add
(
this
.
_editor
.
onDidChangeCursorPosition
(()
=>
{
if
(
this
.
_ignoreSelectionChange
)
{
return
;
}
...
...
@@ -190,7 +189,7 @@ class MarkerModel {
}
public
dispose
():
void
{
this
.
_toUnbind
=
dispose
(
this
.
_toUnbind
);
this
.
_toUnbind
.
dispose
(
);
}
}
...
...
src/vs/platform/telemetry/common/telemetryService.ts
浏览文件 @
1ef4a75f
...
...
@@ -10,7 +10,7 @@ import { ITelemetryAppender } from 'vs/platform/telemetry/common/telemetryUtils'
import
{
optional
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IConfigurationRegistry
,
Extensions
}
from
'
vs/platform/configuration/common/configurationRegistry
'
;
import
{
IDisposable
,
dispos
e
}
from
'
vs/base/common/lifecycle
'
;
import
{
DisposableStor
e
}
from
'
vs/base/common/lifecycle
'
;
import
{
cloneAndChange
,
mixin
}
from
'
vs/base/common/objects
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
ClassifiedEvent
,
StrictPropertyCheck
,
GDPRClassification
}
from
'
vs/platform/telemetry/common/gdprTypings
'
;
...
...
@@ -35,7 +35,7 @@ export class TelemetryService implements ITelemetryService {
private
_userOptIn
:
boolean
;
private
_enabled
:
boolean
;
private
_disposables
:
IDisposable
[]
=
[]
;
private
readonly
_disposables
=
new
DisposableStore
()
;
private
_cleanupPatterns
:
RegExp
[]
=
[];
constructor
(
...
...
@@ -113,7 +113,7 @@ export class TelemetryService implements ITelemetryService {
}
dispose
():
void
{
this
.
_disposables
=
dispose
(
this
.
_disposables
);
this
.
_disposables
.
dispose
(
);
}
publicLog
(
eventName
:
string
,
data
?:
ITelemetryData
,
anonymizeFilePaths
?:
boolean
):
Promise
<
any
>
{
...
...
src/vs/workbench/api/common/extHostSCM.ts
浏览文件 @
1ef4a75f
...
...
@@ -6,7 +6,7 @@
import
{
URI
,
UriComponents
}
from
'
vs/base/common/uri
'
;
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
debounce
}
from
'
vs/base/common/decorators
'
;
import
{
dispose
,
IDisposable
,
DisposableStore
,
MutableDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
DisposableStore
,
MutableDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
asPromise
}
from
'
vs/base/common/async
'
;
import
{
ExtHostCommands
}
from
'
vs/workbench/api/common/extHostCommands
'
;
import
{
MainContext
,
MainThreadSCMShape
,
SCMRawResource
,
SCMRawResourceSplice
,
SCMRawResourceSplices
,
IMainContext
,
ExtHostSCMShape
,
CommandDto
}
from
'
./extHost.protocol
'
;
...
...
@@ -263,7 +263,6 @@ class ExtHostSourceControlResourceGroup implements vscode.SourceControlResourceG
}
readonly
handle
=
ExtHostSourceControlResourceGroup
.
_handlePool
++
;
private
_disposables
:
IDisposable
[]
=
[];
constructor
(
private
_proxy
:
MainThreadSCMShape
,
...
...
@@ -353,7 +352,6 @@ class ExtHostSourceControlResourceGroup implements vscode.SourceControlResourceG
dispose
():
void
{
this
.
_proxy
.
$unregisterGroup
(
this
.
_sourceControlHandle
,
this
.
handle
);
this
.
_disposables
=
dispose
(
this
.
_disposables
);
this
.
_onDidDispose
.
fire
();
}
}
...
...
src/vs/workbench/contrib/files/common/explorerService.ts
浏览文件 @
1ef4a75f
...
...
@@ -5,7 +5,7 @@
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IDisposable
,
dispos
e
}
from
'
vs/base/common/lifecycle
'
;
import
{
DisposableStor
e
}
from
'
vs/base/common/lifecycle
'
;
import
{
IExplorerService
,
IEditableData
,
IFilesConfiguration
,
SortOrder
,
SortOrderConfiguration
}
from
'
vs/workbench/contrib/files/common/files
'
;
import
{
ExplorerItem
,
ExplorerModel
}
from
'
vs/workbench/contrib/files/common/explorerModel
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
...
...
@@ -36,7 +36,7 @@ export class ExplorerService implements IExplorerService {
private
_onDidChangeEditable
=
new
Emitter
<
ExplorerItem
>
();
private
_onDidSelectResource
=
new
Emitter
<
{
resource
?:
URI
,
reveal
?:
boolean
}
>
();
private
_onDidCopyItems
=
new
Emitter
<
{
items
:
ExplorerItem
[],
cut
:
boolean
,
previouslyCutItems
:
ExplorerItem
[]
|
undefined
}
>
();
private
disposables
:
IDisposable
[]
=
[]
;
private
readonly
disposables
=
new
DisposableStore
()
;
private
editable
:
{
stat
:
ExplorerItem
,
data
:
IEditableData
}
|
undefined
;
private
_sortOrder
:
SortOrder
;
private
cutItems
:
ExplorerItem
[]
|
undefined
;
...
...
@@ -88,18 +88,18 @@ export class ExplorerService implements IExplorerService {
(
root
?:
URI
)
=>
getFileEventsExcludes
(
this
.
configurationService
,
root
),
(
event
:
IConfigurationChangeEvent
)
=>
event
.
affectsConfiguration
(
FILES_EXCLUDE_CONFIG
)
);
this
.
disposables
.
push
(
fileEventsFilter
);
this
.
disposables
.
add
(
fileEventsFilter
);
return
fileEventsFilter
;
}
@
memoize
get
model
():
ExplorerModel
{
const
model
=
new
ExplorerModel
(
this
.
contextService
);
this
.
disposables
.
push
(
model
);
this
.
disposables
.
push
(
this
.
fileService
.
onAfterOperation
(
e
=>
this
.
onFileOperation
(
e
)));
this
.
disposables
.
push
(
this
.
fileService
.
onFileChanges
(
e
=>
this
.
onFileChanges
(
e
)));
this
.
disposables
.
push
(
this
.
configurationService
.
onDidChangeConfiguration
(
e
=>
this
.
onConfigurationUpdated
(
this
.
configurationService
.
getValue
<
IFilesConfiguration
>
())));
this
.
disposables
.
push
(
this
.
fileService
.
onDidChangeFileSystemProviderRegistrations
(
e
=>
{
this
.
disposables
.
add
(
model
);
this
.
disposables
.
add
(
this
.
fileService
.
onAfterOperation
(
e
=>
this
.
onFileOperation
(
e
)));
this
.
disposables
.
add
(
this
.
fileService
.
onFileChanges
(
e
=>
this
.
onFileChanges
(
e
)));
this
.
disposables
.
add
(
this
.
configurationService
.
onDidChangeConfiguration
(
e
=>
this
.
onConfigurationUpdated
(
this
.
configurationService
.
getValue
<
IFilesConfiguration
>
())));
this
.
disposables
.
add
(
this
.
fileService
.
onDidChangeFileSystemProviderRegistrations
(
e
=>
{
if
(
e
.
added
&&
this
.
fileSystemProviderSchemes
.
has
(
e
.
scheme
))
{
// A file system provider got re-registered, we should update all file stats since they might change (got read-only)
this
.
model
.
roots
.
forEach
(
r
=>
r
.
forgetChildren
());
...
...
@@ -108,7 +108,7 @@ export class ExplorerService implements IExplorerService {
this
.
fileSystemProviderSchemes
.
add
(
e
.
scheme
);
}
}));
this
.
disposables
.
push
(
model
.
onDidChangeRoots
(()
=>
this
.
_onDidChangeRoots
.
fire
()));
this
.
disposables
.
add
(
model
.
onDidChangeRoots
(()
=>
this
.
_onDidChangeRoots
.
fire
()));
return
model
;
}
...
...
@@ -380,6 +380,6 @@ export class ExplorerService implements IExplorerService {
}
dispose
():
void
{
dispose
(
this
.
disposables
);
this
.
disposables
.
dispose
(
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录