Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
28cb90be
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
28cb90be
编写于
6月 12, 2020
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore - ES6, use for-of instead of forEach
上级
a1feacf5
变更
19
隐藏空白更改
内联
并排
Showing
19 changed file
with
75 addition
and
97 deletion
+75
-97
src/vs/base/common/event.ts
src/vs/base/common/event.ts
+3
-3
src/vs/editor/contrib/codelens/codeLensCache.ts
src/vs/editor/contrib/codelens/codeLensCache.ts
+2
-2
src/vs/editor/contrib/gotoSymbol/peek/referencesWidget.ts
src/vs/editor/contrib/gotoSymbol/peek/referencesWidget.ts
+9
-11
src/vs/editor/contrib/gotoSymbol/symbolNavigation.ts
src/vs/editor/contrib/gotoSymbol/symbolNavigation.ts
+1
-1
src/vs/editor/contrib/snippet/snippetSession.ts
src/vs/editor/contrib/snippet/snippetSession.ts
+11
-15
src/vs/editor/contrib/suggest/suggestMemory.ts
src/vs/editor/contrib/suggest/suggestMemory.ts
+1
-5
src/vs/platform/instantiation/common/serviceCollection.ts
src/vs/platform/instantiation/common/serviceCollection.ts
+0
-4
src/vs/workbench/api/browser/mainThreadCommands.ts
src/vs/workbench/api/browser/mainThreadCommands.ts
+2
-2
src/vs/workbench/api/browser/mainThreadDocumentContentProviders.ts
...rkbench/api/browser/mainThreadDocumentContentProviders.ts
+3
-3
src/vs/workbench/api/browser/mainThreadDocumentsAndEditors.ts
...vs/workbench/api/browser/mainThreadDocumentsAndEditors.ts
+2
-2
src/vs/workbench/api/browser/mainThreadFileSystem.ts
src/vs/workbench/api/browser/mainThreadFileSystem.ts
+1
-1
src/vs/workbench/api/common/extHostCodeInsets.ts
src/vs/workbench/api/common/extHostCodeInsets.ts
+2
-2
src/vs/workbench/api/common/extHostCommands.ts
src/vs/workbench/api/common/extHostCommands.ts
+2
-2
src/vs/workbench/api/common/extHostDiagnostics.ts
src/vs/workbench/api/common/extHostDiagnostics.ts
+6
-6
src/vs/workbench/api/common/extHostDocumentsAndEditors.ts
src/vs/workbench/api/common/extHostDocumentsAndEditors.ts
+1
-3
src/vs/workbench/contrib/bulkEdit/browser/bulkEditPreview.ts
src/vs/workbench/contrib/bulkEdit/browser/bulkEditPreview.ts
+9
-15
src/vs/workbench/contrib/bulkEdit/browser/bulkEditTree.ts
src/vs/workbench/contrib/bulkEdit/browser/bulkEditTree.ts
+12
-12
src/vs/workbench/contrib/snippets/browser/snippetsService.ts
src/vs/workbench/contrib/snippets/browser/snippetsService.ts
+6
-6
src/vs/workbench/services/bulkEdit/browser/bulkEditService.ts
...vs/workbench/services/bulkEdit/browser/bulkEditService.ts
+2
-2
未找到文件。
src/vs/base/common/event.ts
浏览文件 @
28cb90be
...
...
@@ -440,14 +440,14 @@ class LeakageMonitor {
this
.
_warnCountdown
=
threshold
*
0.5
;
// find most frequent listener and print warning
let
topStack
:
string
;
let
topStack
:
string
|
undefined
;
let
topCount
:
number
=
0
;
this
.
_stacks
.
forEach
((
count
,
stack
)
=>
{
for
(
const
[
stack
,
count
]
of
this
.
_stacks
)
{
if
(
!
topStack
||
topCount
<
count
)
{
topStack
=
stack
;
topCount
=
count
;
}
}
);
}
console
.
warn
(
`[
${
this
.
name
}
] potential listener LEAK detected, having
${
listenerCount
}
listeners already. MOST frequent listener (
${
topCount
}
):`
);
console
.
warn
(
topStack
!
);
...
...
src/vs/editor/contrib/codelens/codeLensCache.ts
浏览文件 @
28cb90be
...
...
@@ -96,7 +96,7 @@ export class CodeLensCache implements ICodeLensCache {
private
_serialize
():
string
{
const
data
:
Record
<
string
,
ISerializedCacheData
>
=
Object
.
create
(
null
);
this
.
_cache
.
forEach
((
value
,
key
)
=>
{
for
(
const
[
key
,
value
]
of
this
.
_cache
)
{
const
lines
=
new
Set
<
number
>
();
for
(
const
d
of
value
.
data
.
lenses
)
{
lines
.
add
(
d
.
symbol
.
range
.
startLineNumber
);
...
...
@@ -105,7 +105,7 @@ export class CodeLensCache implements ICodeLensCache {
lineCount
:
value
.
lineCount
,
lines
:
[...
lines
.
values
()]
};
}
);
}
return
JSON
.
stringify
(
data
);
}
...
...
src/vs/editor/contrib/gotoSymbol/peek/referencesWidget.ts
浏览文件 @
28cb90be
...
...
@@ -111,19 +111,21 @@ class DecorationsManager implements IDisposable {
return
;
}
this
.
_decorations
.
forEach
((
reference
,
decorationId
)
=>
{
for
(
let
[
decorationId
,
reference
]
of
this
.
_decorations
)
{
const
newRange
=
model
.
getDecorationRange
(
decorationId
);
if
(
!
newRange
)
{
return
;
continue
;
}
let
ignore
=
false
;
if
(
Range
.
equalsRange
(
newRange
,
reference
.
range
))
{
return
;
continue
;
}
else
if
(
Range
.
spansMultipleLines
(
newRange
))
{
}
if
(
Range
.
spansMultipleLines
(
newRange
))
{
ignore
=
true
;
}
else
{
...
...
@@ -141,7 +143,7 @@ class DecorationsManager implements IDisposable {
}
else
{
reference
.
range
=
newRange
;
}
}
);
}
for
(
let
i
=
0
,
len
=
toRemove
.
length
;
i
<
len
;
i
++
)
{
this
.
_decorations
.
delete
(
toRemove
[
i
]);
...
...
@@ -150,11 +152,7 @@ class DecorationsManager implements IDisposable {
}
removeDecorations
():
void
{
let
toRemove
:
string
[]
=
[];
this
.
_decorations
.
forEach
((
value
,
key
)
=>
{
toRemove
.
push
(
key
);
});
this
.
_editor
.
deltaDecorations
(
toRemove
,
[]);
this
.
_editor
.
deltaDecorations
([...
this
.
_decorations
.
keys
()],
[]);
this
.
_decorations
.
clear
();
}
}
...
...
src/vs/editor/contrib/gotoSymbol/symbolNavigation.ts
浏览文件 @
28cb90be
...
...
@@ -198,7 +198,7 @@ class EditorState {
dispose
():
void
{
this
.
_disposables
.
dispose
();
this
.
_onDidChange
.
dispose
();
this
.
_listener
.
forEach
(
dispose
);
dispose
(
this
.
_listener
.
values
()
);
}
private
_onDidAddEditor
(
editor
:
ICodeEditor
):
void
{
...
...
src/vs/editor/contrib/snippet/snippetSession.ts
浏览文件 @
28cb90be
...
...
@@ -64,9 +64,7 @@ export class OneSnippet {
dispose
():
void
{
if
(
this
.
_placeholderDecorations
)
{
let
toRemove
:
string
[]
=
[];
this
.
_placeholderDecorations
.
forEach
(
handle
=>
toRemove
.
push
(
handle
));
this
.
_editor
.
deltaDecorations
(
toRemove
,
[]);
this
.
_editor
.
deltaDecorations
([...
this
.
_placeholderDecorations
.
values
()],
[]);
}
this
.
_placeholderGroups
.
length
=
0
;
}
...
...
@@ -169,11 +167,11 @@ export class OneSnippet {
// change stickness to never grow when typing at its edges
// so that in-active tabstops never grow
this
.
_placeholderDecorations
!
.
forEach
((
id
,
placeholder
)
=>
{
for
(
const
[
placeholder
,
id
]
of
this
.
_placeholderDecorations
!
)
{
if
(
!
activePlaceholders
.
has
(
placeholder
))
{
accessor
.
changeDecorationOptions
(
id
,
placeholder
.
isFinalTabstop
?
OneSnippet
.
_decor
.
inactiveFinal
:
OneSnippet
.
_decor
.
inactive
);
}
}
);
}
return
selections
;
})
!
;
...
...
@@ -304,14 +302,14 @@ export class OneSnippet {
public
getEnclosingRange
():
Range
|
undefined
{
let
result
:
Range
|
undefined
;
const
model
=
this
.
_editor
.
getModel
();
this
.
_placeholderDecorations
!
.
forEach
((
decorationId
)
=>
{
for
(
const
decorationId
of
this
.
_placeholderDecorations
!
.
values
())
{
const
placeholderRange
=
withNullAsUndefined
(
model
.
getDecorationRange
(
decorationId
));
if
(
!
result
)
{
result
=
placeholderRange
;
}
else
{
result
=
result
.
plusRange
(
placeholderRange
!
);
}
}
);
}
return
result
;
}
}
...
...
@@ -600,8 +598,7 @@ export class SnippetSession {
// that contain at least one selection. for all remaining snippets
// the same placeholder (and their ranges) must be used.
if
(
allPossibleSelections
.
size
===
0
)
{
possibleSelections
.
forEach
((
ranges
,
index
)
=>
{
for
(
const
[
index
,
ranges
]
of
possibleSelections
)
{
ranges
.
sort
(
Range
.
compareRangesUsingStarts
);
for
(
const
selection
of
selections
)
{
if
(
ranges
[
0
].
containsRange
(
selection
))
{
...
...
@@ -609,7 +606,7 @@ export class SnippetSession {
break
;
}
}
}
);
}
}
if
(
allPossibleSelections
.
size
===
0
)
{
...
...
@@ -630,11 +627,10 @@ export class SnippetSession {
// selection
selections
.
sort
(
Range
.
compareRangesUsingStarts
);
allPossibleSelections
.
forEach
((
ranges
,
index
)
=>
{
for
(
let
[
index
,
ranges
]
of
allPossibleSelections
)
{
if
(
ranges
.
length
!==
selections
.
length
)
{
allPossibleSelections
.
delete
(
index
);
return
;
continue
;
}
ranges
.
sort
(
Range
.
compareRangesUsingStarts
);
...
...
@@ -642,10 +638,10 @@ export class SnippetSession {
for
(
let
i
=
0
;
i
<
ranges
.
length
;
i
++
)
{
if
(
!
ranges
[
i
].
containsRange
(
selections
[
i
]))
{
allPossibleSelections
.
delete
(
index
);
return
;
continue
;
}
}
}
);
}
// from all possible selections we have deleted those
// that don't match with the current selection. if we don't
...
...
src/vs/editor/contrib/suggest/suggestMemory.ts
浏览文件 @
28cb90be
...
...
@@ -132,11 +132,7 @@ export class LRUMemory extends Memory {
}
toJSON
():
object
{
let
data
:
[
string
,
MemItem
][]
=
[];
this
.
_cache
.
forEach
((
value
,
key
)
=>
{
data
.
push
([
key
,
value
]);
});
return
data
;
return
this
.
_cache
.
toJSON
();
}
fromJSON
(
data
:
[
string
,
MemItem
][]):
void
{
...
...
src/vs/platform/instantiation/common/serviceCollection.ts
浏览文件 @
28cb90be
...
...
@@ -22,10 +22,6 @@ export class ServiceCollection {
return
result
;
}
forEach
(
callback
:
(
id
:
ServiceIdentifier
<
any
>
,
instanceOrDescriptor
:
any
)
=>
any
):
void
{
this
.
_entries
.
forEach
((
value
,
key
)
=>
callback
(
key
,
value
));
}
has
(
id
:
ServiceIdentifier
<
any
>
):
boolean
{
return
this
.
_entries
.
has
(
id
);
}
...
...
src/vs/workbench/api/browser/mainThreadCommands.ts
浏览文件 @
28cb90be
...
...
@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import
{
ICommandService
,
CommandsRegistry
,
ICommandHandlerDescription
}
from
'
vs/platform/commands/common/commands
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
ExtHostContext
,
MainThreadCommandsShape
,
ExtHostCommandsShape
,
MainContext
,
IExtHostContext
}
from
'
../common/extHost.protocol
'
;
import
{
extHostNamedCustomer
}
from
'
vs/workbench/api/common/extHostCustomers
'
;
import
{
revive
}
from
'
vs/base/common/marshalling
'
;
...
...
@@ -28,7 +28,7 @@ export class MainThreadCommands implements MainThreadCommandsShape {
}
dispose
()
{
this
.
_commandRegistrations
.
forEach
(
value
=>
value
.
dispose
());
dispose
(
this
.
_commandRegistrations
.
values
());
this
.
_commandRegistrations
.
clear
();
this
.
_generateCommandsDocumentationRegistration
.
dispose
();
...
...
src/vs/workbench/api/browser/mainThreadDocumentContentProviders.ts
浏览文件 @
28cb90be
...
...
@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
URI
,
UriComponents
}
from
'
vs/base/common/uri
'
;
import
{
EditOperation
}
from
'
vs/editor/common/core/editOperation
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
...
...
@@ -35,8 +35,8 @@ export class MainThreadDocumentContentProviders implements MainThreadDocumentCon
}
dispose
():
void
{
this
.
_resourceContentProvider
.
forEach
(
p
=>
p
.
dispose
());
this
.
_pendingUpdate
.
forEach
(
source
=>
source
.
dispose
());
dispose
(
this
.
_resourceContentProvider
.
values
());
dispose
(
this
.
_pendingUpdate
.
values
());
}
$registerTextContentProvider
(
handle
:
number
,
scheme
:
string
):
void
{
...
...
src/vs/workbench/api/browser/mainThreadDocumentsAndEditors.ts
浏览文件 @
28cb90be
...
...
@@ -266,11 +266,11 @@ class MainThreadDocumentAndEditorStateComputer {
}
if
(
candidate
)
{
editors
.
forEach
(
snapshot
=>
{
for
(
const
snapshot
of
editors
.
values
())
{
if
(
candidate
===
snapshot
.
editor
)
{
activeEditor
=
snapshot
.
id
;
}
}
);
}
}
}
...
...
src/vs/workbench/api/browser/mainThreadFileSystem.ts
浏览文件 @
28cb90be
...
...
@@ -25,7 +25,7 @@ export class MainThreadFileSystem implements MainThreadFileSystemShape {
}
dispose
():
void
{
this
.
_fileProvider
.
forEach
(
value
=>
value
.
dispose
());
dispose
(
this
.
_fileProvider
.
values
());
this
.
_fileProvider
.
clear
();
}
...
...
src/vs/workbench/api/common/extHostCodeInsets.ts
浏览文件 @
28cb90be
...
...
@@ -28,11 +28,11 @@ export class ExtHostEditorInsets implements ExtHostEditorInsetsShape {
// dispose editor inset whenever the hosting editor goes away
this
.
_disposables
.
add
(
_editors
.
onDidChangeVisibleTextEditors
(()
=>
{
const
visibleEditor
=
_editors
.
getVisibleTextEditors
();
this
.
_insets
.
forEach
(
value
=>
{
for
(
const
value
of
this
.
_insets
.
values
())
{
if
(
visibleEditor
.
indexOf
(
value
.
editor
)
<
0
)
{
value
.
inset
.
dispose
();
// will remove from `this._insets`
}
}
);
}
}));
}
...
...
src/vs/workbench/api/common/extHostCommands.ts
浏览文件 @
28cb90be
...
...
@@ -204,12 +204,12 @@ export class ExtHostCommands implements ExtHostCommandsShape {
$getContributedCommandHandlerDescriptions
():
Promise
<
{
[
id
:
string
]:
string
|
ICommandHandlerDescription
}
>
{
const
result
:
{
[
id
:
string
]:
string
|
ICommandHandlerDescription
}
=
Object
.
create
(
null
);
this
.
_commands
.
forEach
((
command
,
id
)
=>
{
for
(
let
[
id
,
command
]
of
this
.
_commands
)
{
let
{
description
}
=
command
;
if
(
description
)
{
result
[
id
]
=
description
;
}
}
);
}
return
Promise
.
resolve
(
result
);
}
}
...
...
src/vs/workbench/api/common/extHostDiagnostics.ts
浏览文件 @
28cb90be
...
...
@@ -173,9 +173,9 @@ export class DiagnosticCollection implements vscode.DiagnosticCollection {
forEach
(
callback
:
(
uri
:
URI
,
diagnostics
:
ReadonlyArray
<
vscode
.
Diagnostic
>
,
collection
:
DiagnosticCollection
)
=>
any
,
thisArg
?:
any
):
void
{
this
.
_checkDisposed
();
this
.
_data
.
forEach
((
value
,
uri
)
=>
{
for
(
let
uri
of
this
.
_data
.
keys
())
{
callback
.
apply
(
thisArg
,
[
uri
,
this
.
get
(
uri
),
this
]);
}
);
}
}
get
(
uri
:
URI
):
ReadonlyArray
<
vscode
.
Diagnostic
>
{
...
...
@@ -307,7 +307,7 @@ export class ExtHostDiagnostics implements ExtHostDiagnosticsShape {
}
else
{
const
index
=
new
Map
<
string
,
number
>
();
const
res
:
[
vscode
.
Uri
,
vscode
.
Diagnostic
[]][]
=
[];
this
.
_collections
.
forEach
(
collection
=>
{
for
(
const
collection
of
this
.
_collections
.
values
())
{
collection
.
forEach
((
uri
,
diagnostics
)
=>
{
let
idx
=
index
.
get
(
uri
.
toString
());
if
(
typeof
idx
===
'
undefined
'
)
{
...
...
@@ -317,18 +317,18 @@ export class ExtHostDiagnostics implements ExtHostDiagnosticsShape {
}
res
[
idx
][
1
]
=
res
[
idx
][
1
].
concat
(...
diagnostics
);
});
}
);
}
return
res
;
}
}
private
_getDiagnostics
(
resource
:
vscode
.
Uri
):
ReadonlyArray
<
vscode
.
Diagnostic
>
{
let
res
:
vscode
.
Diagnostic
[]
=
[];
this
.
_collections
.
forEach
(
collection
=>
{
for
(
let
collection
of
this
.
_collections
.
values
())
{
if
(
collection
.
has
(
resource
))
{
res
=
res
.
concat
(
collection
.
get
(
resource
));
}
}
);
}
return
res
;
}
...
...
src/vs/workbench/api/common/extHostDocumentsAndEditors.ts
浏览文件 @
28cb90be
...
...
@@ -152,9 +152,7 @@ export class ExtHostDocumentsAndEditors implements ExtHostDocumentsAndEditorsSha
}
allEditors
():
ExtHostTextEditor
[]
{
const
result
:
ExtHostTextEditor
[]
=
[];
this
.
_editors
.
forEach
(
data
=>
result
.
push
(
data
));
return
result
;
return
[...
this
.
_editors
.
values
()];
}
}
...
...
src/vs/workbench/contrib/bulkEdit/browser/bulkEditPreview.ts
浏览文件 @
28cb90be
...
...
@@ -248,15 +248,15 @@ export class BulkFileOperations {
for
(
let
file
of
this
.
fileOperations
)
{
if
(
file
.
type
!==
BulkFileOperationType
.
TextEdit
)
{
let
checked
=
true
;
f
ile
.
originalEdits
.
forEach
(
edit
=>
{
f
or
(
const
edit
of
file
.
originalEdits
.
values
())
{
if
(
WorkspaceFileEdit
.
is
(
edit
))
{
checked
=
checked
&&
this
.
checked
.
isChecked
(
edit
);
}
}
);
}
if
(
!
checked
)
{
f
ile
.
originalEdits
.
forEach
(
edit
=>
{
f
or
(
const
edit
of
file
.
originalEdits
.
values
())
{
this
.
checked
.
updateChecked
(
edit
,
checked
);
}
);
}
}
}
}
...
...
@@ -305,8 +305,7 @@ export class BulkFileOperations {
const
result
:
IIdentifiedSingleEditOperation
[]
=
[];
let
ignoreAll
=
false
;
file
.
originalEdits
.
forEach
(
edit
=>
{
for
(
const
edit
of
file
.
originalEdits
.
values
())
{
if
(
WorkspaceTextEdit
.
is
(
edit
))
{
if
(
this
.
checked
.
isChecked
(
edit
))
{
result
.
push
(
EditOperation
.
replaceMove
(
Range
.
lift
(
edit
.
edit
.
range
),
edit
.
edit
.
text
));
...
...
@@ -316,7 +315,7 @@ export class BulkFileOperations {
// UNCHECKED WorkspaceFileEdit disables all text edits
ignoreAll
=
true
;
}
}
);
}
if
(
ignoreAll
)
{
return
[];
...
...
@@ -332,16 +331,11 @@ export class BulkFileOperations {
}
getUriOfEdit
(
edit
:
WorkspaceFileEdit
|
WorkspaceTextEdit
):
URI
{
for
(
let
file
of
this
.
fileOperations
)
{
let
found
=
false
;
file
.
originalEdits
.
forEach
(
value
=>
{
if
(
!
found
&&
value
===
edit
)
{
found
=
true
;
for
(
const
value
of
file
.
originalEdits
.
values
())
{
if
(
value
===
edit
)
{
return
file
.
uri
;
}
});
if
(
found
)
{
return
file
.
uri
;
}
}
throw
new
Error
(
'
invalid edit
'
);
...
...
src/vs/workbench/contrib/bulkEdit/browser/bulkEditTree.ts
浏览文件 @
28cb90be
...
...
@@ -61,22 +61,22 @@ export class FileElement implements ICheckable {
}
// multiple file edits -> reflect single state
this
.
edit
.
originalEdits
.
forEach
(
edit
=>
{
for
(
let
edit
of
this
.
edit
.
originalEdits
.
values
())
{
if
(
WorkspaceFileEdit
.
is
(
edit
))
{
checked
=
checked
&&
model
.
checked
.
isChecked
(
edit
);
}
}
);
}
// multiple categories and text change -> read all elements
if
(
this
.
parent
instanceof
CategoryElement
&&
this
.
edit
.
type
===
BulkFileOperationType
.
TextEdit
)
{
for
(
let
category
of
model
.
categories
)
{
for
(
let
file
of
category
.
fileOperations
)
{
if
(
file
.
uri
.
toString
()
===
this
.
edit
.
uri
.
toString
())
{
f
ile
.
originalEdits
.
forEach
(
edit
=>
{
f
or
(
const
edit
of
file
.
originalEdits
.
values
())
{
if
(
WorkspaceFileEdit
.
is
(
edit
))
{
checked
=
checked
&&
model
.
checked
.
isChecked
(
edit
);
}
}
);
}
}
}
}
...
...
@@ -87,18 +87,18 @@ export class FileElement implements ICheckable {
setChecked
(
value
:
boolean
):
void
{
let
model
=
this
.
parent
instanceof
CategoryElement
?
this
.
parent
.
parent
:
this
.
parent
;
this
.
edit
.
originalEdits
.
forEach
(
edit
=>
{
for
(
const
edit
of
this
.
edit
.
originalEdits
.
values
())
{
model
.
checked
.
updateChecked
(
edit
,
value
);
}
);
}
// multiple categories and file change -> update all elements
if
(
this
.
parent
instanceof
CategoryElement
&&
this
.
edit
.
type
!==
BulkFileOperationType
.
TextEdit
)
{
for
(
let
category
of
model
.
categories
)
{
for
(
let
file
of
category
.
fileOperations
)
{
if
(
file
.
uri
.
toString
()
===
this
.
edit
.
uri
.
toString
())
{
f
ile
.
originalEdits
.
forEach
(
edit
=>
{
f
or
(
const
edit
of
file
.
originalEdits
.
values
())
{
model
.
checked
.
updateChecked
(
edit
,
value
);
}
);
}
}
}
}
...
...
@@ -112,11 +112,11 @@ export class FileElement implements ICheckable {
for
(
let
category
of
model
.
categories
)
{
for
(
let
file
of
category
.
fileOperations
)
{
if
(
file
.
uri
.
toString
()
===
this
.
edit
.
uri
.
toString
())
{
f
ile
.
originalEdits
.
forEach
(
edit
=>
{
f
or
(
const
edit
of
file
.
originalEdits
.
values
())
{
if
(
WorkspaceFileEdit
.
is
(
edit
))
{
checked
=
checked
&&
model
.
checked
.
isChecked
(
edit
);
}
}
);
}
}
}
}
...
...
@@ -154,11 +154,11 @@ export class TextEditElement implements ICheckable {
// make sure parent is checked when this element is checked...
if
(
value
)
{
this
.
parent
.
edit
.
originalEdits
.
forEach
(
edit
=>
{
for
(
const
edit
of
this
.
parent
.
edit
.
originalEdits
.
values
())
{
if
(
WorkspaceFileEdit
.
is
(
edit
))
{
(
<
BulkFileOperations
>
model
).
checked
.
updateChecked
(
edit
,
value
);
}
}
);
}
}
}
...
...
src/vs/workbench/contrib/snippets/browser/snippetsService.ts
浏览文件 @
28cb90be
...
...
@@ -174,12 +174,12 @@ class SnippetsService implements ISnippetsService {
const
languageIdentifier
=
this
.
_modeService
.
getLanguageIdentifier
(
languageId
);
if
(
languageIdentifier
)
{
const
langName
=
languageIdentifier
.
language
;
this
.
_files
.
forEach
(
file
=>
{
for
(
const
file
of
this
.
_files
.
values
())
{
promises
.
push
(
file
.
load
()
.
then
(
file
=>
file
.
select
(
langName
,
result
))
.
catch
(
err
=>
this
.
_logService
.
error
(
err
,
file
.
location
.
toString
()))
);
}
);
}
}
return
Promise
.
all
(
promises
).
then
(()
=>
result
);
});
...
...
@@ -190,12 +190,12 @@ class SnippetsService implements ISnippetsService {
const
languageIdentifier
=
this
.
_modeService
.
getLanguageIdentifier
(
languageId
);
if
(
languageIdentifier
)
{
const
langName
=
languageIdentifier
.
language
;
this
.
_files
.
forEach
(
file
=>
{
for
(
const
file
of
this
.
_files
.
values
())
{
// kick off loading (which is a noop in case it's already loaded)
// and optimistically collect snippets
file
.
load
().
catch
(
err
=>
{
/*ignore*/
});
file
.
select
(
langName
,
result
);
}
);
}
}
return
result
;
}
...
...
@@ -205,11 +205,11 @@ class SnippetsService implements ISnippetsService {
private
_initExtensionSnippets
():
void
{
snippetExt
.
point
.
setHandler
(
extensions
=>
{
this
.
_files
.
forEach
((
value
,
key
)
=>
{
for
(
let
[
key
,
value
]
of
this
.
_files
)
{
if
(
value
.
source
===
SnippetSource
.
Extension
)
{
this
.
_files
.
delete
(
key
);
}
}
);
}
for
(
const
extension
of
extensions
)
{
for
(
const
contribution
of
extension
.
value
)
{
...
...
src/vs/workbench/services/bulkEdit/browser/bulkEditService.ts
浏览文件 @
28cb90be
...
...
@@ -165,7 +165,7 @@ class BulkEditModel implements IDisposable {
this
.
_tasks
=
[];
const
promises
:
Promise
<
any
>
[]
=
[];
this
.
_edits
.
forEach
((
value
,
key
)
=>
{
for
(
let
[
key
,
value
]
of
this
.
_edits
)
{
const
promise
=
this
.
_textModelResolverService
.
createModelReference
(
URI
.
parse
(
key
)).
then
(
async
ref
=>
{
let
task
:
ModelEditTask
;
let
makeMinimal
=
false
;
...
...
@@ -195,7 +195,7 @@ class BulkEditModel implements IDisposable {
this
.
_progress
.
report
(
undefined
);
});
promises
.
push
(
promise
);
}
);
}
await
Promise
.
all
(
promises
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录