Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
130a2918
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,发现更多精彩内容 >>
提交
130a2918
编写于
8月 16, 2018
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix in master #56317
上级
b00ab528
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
41 addition
and
11 deletion
+41
-11
src/vs/workbench/parts/markers/electron-browser/markersModel.ts
.../workbench/parts/markers/electron-browser/markersModel.ts
+10
-8
src/vs/workbench/parts/markers/electron-browser/markersPanelActions.ts
...nch/parts/markers/electron-browser/markersPanelActions.ts
+30
-3
src/vs/workbench/parts/markers/electron-browser/markersTreeViewer.ts
...bench/parts/markers/electron-browser/markersTreeViewer.ts
+1
-0
未找到文件。
src/vs/workbench/parts/markers/electron-browser/markersModel.ts
浏览文件 @
130a2918
...
...
@@ -15,10 +15,10 @@ import { groupBy, isFalsyOrEmpty, flatten } from 'vs/base/common/arrays';
import
{
values
}
from
'
vs/base/common/map
'
;
import
*
as
glob
from
'
vs/base/common/glob
'
;
import
*
as
strings
from
'
vs/base/common/strings
'
;
import
{
ITextModelService
}
from
'
vs/editor/common/services/resolverService
'
;
import
{
CodeAction
}
from
'
vs/editor/common/modes
'
;
import
{
getCodeActions
}
from
'
vs/editor/contrib/codeAction/codeAction
'
;
import
{
CodeActionKind
}
from
'
vs/editor/contrib/codeAction/codeActionTrigger
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
function
compareUris
(
a
:
URI
,
b
:
URI
)
{
if
(
a
.
toString
()
<
b
.
toString
())
{
...
...
@@ -48,7 +48,7 @@ export class ResourceMarkers extends NodeWithId {
constructor
(
readonly
uri
:
URI
,
private
textModelService
:
IText
ModelService
private
modelService
:
I
ModelService
)
{
super
(
uri
.
toString
());
}
...
...
@@ -72,6 +72,10 @@ export class ResourceMarkers extends NodeWithId {
}
public
async
hasFixes
(
marker
:
Marker
):
Promise
<
boolean
>
{
if
(
!
this
.
modelService
.
getModel
(
this
.
uri
))
{
// Return early, If the model is not yet created
return
false
;
}
if
(
!
this
.
_allFixesPromise
)
{
this
.
_allFixesPromise
=
this
.
_getFixes
();
}
...
...
@@ -88,11 +92,9 @@ export class ResourceMarkers extends NodeWithId {
}
private
async
_getFixes
(
range
?:
Range
):
Promise
<
CodeAction
[]
>
{
const
modelReference
=
await
this
.
textModelService
.
createModelReference
(
this
.
uri
);
if
(
modelReference
)
{
const
model
=
modelReference
.
object
.
textEditorModel
;
const
model
=
this
.
modelService
.
getModel
(
this
.
uri
);
if
(
model
)
{
const
codeActions
=
await
getCodeActions
(
model
,
range
?
range
:
model
.
getFullModelRange
(),
{
type
:
'
manual
'
,
filter
:
{
kind
:
CodeActionKind
.
QuickFix
}
});
modelReference
.
dispose
();
return
codeActions
;
}
return
[];
...
...
@@ -225,7 +227,7 @@ export class MarkersModel {
constructor
(
markers
:
IMarker
[]
=
[],
@
I
TextModelService
private
textModelService
:
IText
ModelService
@
I
ModelService
private
modelService
:
I
ModelService
)
{
this
.
_markersByResource
=
new
Map
<
string
,
ResourceMarkers
>
();
this
.
_filterOptions
=
new
FilterOptions
();
...
...
@@ -311,7 +313,7 @@ export class MarkersModel {
private
createResource
(
uri
:
URI
,
rawMarkers
:
IMarker
[]):
ResourceMarkers
{
const
markers
:
Marker
[]
=
[];
const
resource
=
new
ResourceMarkers
(
uri
,
this
.
textM
odelService
);
const
resource
=
new
ResourceMarkers
(
uri
,
this
.
m
odelService
);
this
.
updateResource
(
resource
);
rawMarkers
.
forEach
((
rawMarker
,
index
)
=>
{
...
...
src/vs/workbench/parts/markers/electron-browser/markersPanelActions.ts
浏览文件 @
130a2918
...
...
@@ -23,7 +23,7 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
import
{
attachInputBoxStyler
,
attachStylerCallback
,
attachCheckboxStyler
}
from
'
vs/platform/theme/common/styler
'
;
import
{
IMarkersWorkbenchService
}
from
'
vs/workbench/parts/markers/electron-browser/markers
'
;
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
BaseActionItem
,
ActionItem
}
from
'
vs/base/browser/ui/actionbar/actionbar
'
;
import
{
badgeBackground
,
contrastBorder
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
localize
}
from
'
vs/nls
'
;
...
...
@@ -35,6 +35,8 @@ import { applyCodeAction } from 'vs/editor/contrib/codeAction/codeActionCommands
import
{
IBulkEditService
}
from
'
vs/editor/browser/services/bulkEditService
'
;
import
{
ICommandService
}
from
'
vs/platform/commands/common/commands
'
;
import
{
IEditorService
,
ACTIVE_GROUP
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
isEqual
,
hasToIgnoreCase
}
from
'
vs/base/common/resources
'
;
export
class
ToggleMarkersPanelAction
extends
TogglePanelAction
{
...
...
@@ -280,14 +282,34 @@ export class QuickFixAction extends Action {
public
static
readonly
ID
:
string
=
'
workbench.actions.problems.quickfix
'
;
private
updated
:
boolean
=
false
;
private
disposables
:
IDisposable
[]
=
[];
constructor
(
readonly
marker
:
Marker
,
@
IBulkEditService
private
bulkEditService
:
IBulkEditService
,
@
ICommandService
private
commandService
:
ICommandService
,
@
IEditorService
private
editorService
:
IEditorService
@
IEditorService
private
editorService
:
IEditorService
,
@
IModelService
modelService
:
IModelService
)
{
super
(
QuickFixAction
.
ID
,
Messages
.
MARKERS_PANEL_ACTION_TOOLTIP_QUICKFIX
,
'
markers-panel-action-quickfix
'
,
false
);
marker
.
resourceMarkers
.
hasFixes
(
marker
).
then
(
hasFixes
=>
this
.
enabled
=
hasFixes
);
if
(
modelService
.
getModel
(
this
.
marker
.
resourceMarkers
.
uri
))
{
this
.
update
();
}
else
{
modelService
.
onModelAdded
(
model
=>
{
if
(
isEqual
(
model
.
uri
,
marker
.
resource
,
hasToIgnoreCase
(
model
.
uri
)))
{
this
.
update
();
}
},
this
,
this
.
disposables
);
}
}
private
update
():
void
{
if
(
!
this
.
updated
)
{
this
.
marker
.
resourceMarkers
.
hasFixes
(
this
.
marker
).
then
(
hasFixes
=>
this
.
enabled
=
hasFixes
);
this
.
updated
=
true
;
}
}
async
getQuickFixActions
():
Promise
<
IAction
[]
>
{
...
...
@@ -315,6 +337,11 @@ export class QuickFixAction extends Action {
},
},
ACTIVE_GROUP
).
then
(()
=>
null
);
}
dispose
():
void
{
dispose
(
this
.
disposables
);
super
.
dispose
();
}
}
export
class
QuickFixActionItem
extends
ActionItem
{
...
...
src/vs/workbench/parts/markers/electron-browser/markersTreeViewer.ts
浏览文件 @
130a2918
...
...
@@ -261,6 +261,7 @@ export class Renderer implements IRenderer {
}
else
if
(
templateId
===
Renderer
.
MARKER_TEMPLATE_ID
)
{
(
<
IMarkerTemplateData
>
templateData
).
description
.
dispose
();
(
<
IMarkerTemplateData
>
templateData
).
source
.
dispose
();
(
<
IMarkerTemplateData
>
templateData
).
actionBar
.
dispose
();
}
else
if
(
templateId
===
Renderer
.
RELATED_INFO_TEMPLATE_ID
)
{
(
<
IRelatedInformationTemplateData
>
templateData
).
description
.
dispose
();
(
<
IRelatedInformationTemplateData
>
templateData
).
resourceLabel
.
dispose
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录