Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
192e15b6
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(gitcode.net)2024年7月9日维护升级公告
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
192e15b6
编写于
8月 12, 2019
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove support for markdown message in tree view, only support plain string
上级
3ff362c0
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
20 addition
and
74 deletion
+20
-74
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+1
-1
src/vs/workbench/api/browser/mainThreadTreeViews.ts
src/vs/workbench/api/browser/mainThreadTreeViews.ts
+1
-2
src/vs/workbench/api/common/extHost.protocol.ts
src/vs/workbench/api/common/extHost.protocol.ts
+1
-1
src/vs/workbench/api/common/extHostTreeViews.ts
src/vs/workbench/api/common/extHostTreeViews.ts
+8
-5
src/vs/workbench/browser/parts/views/customView.ts
src/vs/workbench/browser/parts/views/customView.ts
+8
-63
src/vs/workbench/common/views.ts
src/vs/workbench/common/views.ts
+1
-2
未找到文件。
src/vs/vscode.proposed.d.ts
浏览文件 @
192e15b6
...
...
@@ -1012,7 +1012,7 @@ declare module 'vscode' {
/**
* An optional human-readable message that will be rendered in the view.
*/
message
?:
string
|
MarkdownString
;
message
?:
string
;
}
...
...
src/vs/workbench/api/browser/mainThreadTreeViews.ts
浏览文件 @
192e15b6
...
...
@@ -10,7 +10,6 @@ import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers';
import
{
distinct
}
from
'
vs/base/common/arrays
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
isUndefinedOrNull
,
isNumber
}
from
'
vs/base/common/types
'
;
import
{
IMarkdownString
}
from
'
vs/base/common/htmlContent
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
@
extHostNamedCustomer
(
MainContext
.
MainThreadTreeViews
)
...
...
@@ -63,7 +62,7 @@ export class MainThreadTreeViews extends Disposable implements MainThreadTreeVie
return
Promise
.
resolve
();
}
$setMessage
(
treeViewId
:
string
,
message
:
string
|
IMarkdownString
):
void
{
$setMessage
(
treeViewId
:
string
,
message
:
string
):
void
{
const
viewer
=
this
.
getTreeView
(
treeViewId
);
if
(
viewer
)
{
viewer
.
message
=
message
;
...
...
src/vs/workbench/api/common/extHost.protocol.ts
浏览文件 @
192e15b6
...
...
@@ -245,7 +245,7 @@ export interface MainThreadTreeViewsShape extends IDisposable {
$registerTreeViewDataProvider
(
treeViewId
:
string
,
options
:
{
showCollapseAll
:
boolean
}):
void
;
$refresh
(
treeViewId
:
string
,
itemsToRefresh
?:
{
[
treeItemHandle
:
string
]:
ITreeItem
}):
Promise
<
void
>
;
$reveal
(
treeViewId
:
string
,
treeItem
:
ITreeItem
,
parentChain
:
ITreeItem
[],
options
:
IRevealOptions
):
Promise
<
void
>
;
$setMessage
(
treeViewId
:
string
,
message
:
string
|
IMarkdownString
):
void
;
$setMessage
(
treeViewId
:
string
,
message
:
string
):
void
;
}
export
interface
MainThreadDownloadServiceShape
extends
IDisposable
{
...
...
src/vs/workbench/api/common/extHostTreeViews.ts
浏览文件 @
192e15b6
...
...
@@ -13,7 +13,7 @@ import { ExtHostTreeViewsShape, MainThreadTreeViewsShape } from './extHost.proto
import
{
ITreeItem
,
TreeViewItemHandleArg
,
ITreeItemLabel
,
IRevealOptions
}
from
'
vs/workbench/common/views
'
;
import
{
ExtHostCommands
,
CommandsConverter
}
from
'
vs/workbench/api/common/extHostCommands
'
;
import
{
asPromise
}
from
'
vs/base/common/async
'
;
import
{
TreeItemCollapsibleState
,
ThemeIcon
,
MarkdownString
}
from
'
vs/workbench/api/common/extHostTypes
'
;
import
{
TreeItemCollapsibleState
,
ThemeIcon
}
from
'
vs/workbench/api/common/extHostTypes
'
;
import
{
isUndefinedOrNull
,
isString
}
from
'
vs/base/common/types
'
;
import
{
equals
,
coalesce
}
from
'
vs/base/common/arrays
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
...
...
@@ -81,7 +81,10 @@ export class ExtHostTreeViews implements ExtHostTreeViewsShape {
get
visible
()
{
return
treeView
.
visible
;
},
get
onDidChangeVisibility
()
{
return
treeView
.
onDidChangeVisibility
;
},
get
message
()
{
return
treeView
.
message
;
},
set
message
(
message
:
string
|
MarkdownString
)
{
checkProposedApiEnabled
(
extension
);
treeView
.
message
=
message
;
},
set
message
(
message
:
string
)
{
checkProposedApiEnabled
(
extension
);
treeView
.
message
=
message
;
},
reveal
:
(
element
:
T
,
options
?:
IRevealOptions
):
Promise
<
void
>
=>
{
return
treeView
.
reveal
(
element
,
options
);
},
...
...
@@ -250,12 +253,12 @@ class ExtHostTreeView<T> extends Disposable {
.
then
(
treeNode
=>
this
.
proxy
.
$reveal
(
this
.
viewId
,
treeNode
.
item
,
parentChain
.
map
(
p
=>
p
.
item
),
{
select
,
focus
,
expand
})),
error
=>
this
.
logService
.
error
(
error
));
}
private
_message
:
string
|
MarkdownString
=
''
;
get
message
():
string
|
MarkdownString
{
private
_message
:
string
=
''
;
get
message
():
string
{
return
this
.
_message
;
}
set
message
(
message
:
string
|
MarkdownString
)
{
set
message
(
message
:
string
)
{
this
.
_message
=
message
;
this
.
_onDidChangeData
.
fire
({
message
:
true
,
element
:
false
});
}
...
...
src/vs/workbench/browser/parts/views/customView.ts
浏览文件 @
192e15b6
...
...
@@ -5,7 +5,7 @@
import
'
vs/css!./media/views
'
;
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
IDisposable
,
Disposable
,
toDisposable
,
DisposableStore
,
MutableDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IDisposable
,
Disposable
,
toDisposable
,
MutableDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IAction
,
IActionViewItem
,
ActionRunner
,
Action
}
from
'
vs/base/common/actions
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
...
...
@@ -33,18 +33,14 @@ import { ViewletPanel, IViewletPanelOptions } from 'vs/workbench/browser/parts/v
import
{
localize
}
from
'
vs/nls
'
;
import
{
timeout
}
from
'
vs/base/common/async
'
;
import
{
editorFindMatchHighlight
,
editorFindMatchHighlightBorder
,
textLinkForeground
,
textCodeBlockBackground
,
focusBorder
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
IMarkdownString
}
from
'
vs/base/common/htmlContent
'
;
import
{
isString
}
from
'
vs/base/common/types
'
;
import
{
renderMarkdown
,
RenderOptions
}
from
'
vs/base/browser/htmlContentRenderer
'
;
import
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
import
{
IOpenerService
}
from
'
vs/platform/opener/common/opener
'
;
import
{
IMarkdownRenderResult
}
from
'
vs/editor/contrib/markdown/markdownRenderer
'
;
import
{
ILabelService
}
from
'
vs/platform/label/common/label
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
IListVirtualDelegate
,
IIdentityProvider
}
from
'
vs/base/browser/ui/list/list
'
;
import
{
ITreeRenderer
,
ITreeNode
,
IAsyncDataSource
,
ITreeContextMenuEvent
}
from
'
vs/base/browser/ui/tree/tree
'
;
import
{
FuzzyScore
,
createMatches
}
from
'
vs/base/common/filters
'
;
import
{
CollapseAllAction
}
from
'
vs/base/browser/ui/tree/treeDefaults
'
;
import
{
isFalsyOrWhitespace
}
from
'
vs/base/common/strings
'
;
export
class
CustomTreeViewPanel
extends
ViewletPanel
{
...
...
@@ -167,7 +163,7 @@ export class CustomTreeView extends Disposable implements ITreeView {
private
focused
:
boolean
=
false
;
private
domNode
:
HTMLElement
;
private
treeContainer
:
HTMLElement
;
private
_messageValue
:
string
|
IMarkdownString
|
undefined
;
private
_messageValue
:
string
|
undefined
;
private
messageElement
:
HTMLDivElement
;
private
tree
:
WorkbenchAsyncDataTree
<
ITreeItem
,
ITreeItem
,
FuzzyScore
>
;
private
treeLabels
:
ResourceLabels
;
...
...
@@ -175,9 +171,6 @@ export class CustomTreeView extends Disposable implements ITreeView {
private
elementsToRefresh
:
ITreeItem
[]
=
[];
private
menus
:
TitleMenus
;
private
markdownRenderer
:
MarkdownRenderer
;
private
markdownResult
:
IMarkdownRenderResult
|
null
;
private
readonly
_onDidExpandItem
:
Emitter
<
ITreeItem
>
=
this
.
_register
(
new
Emitter
<
ITreeItem
>
());
readonly
onDidExpandItem
:
Event
<
ITreeItem
>
=
this
.
_onDidExpandItem
.
event
;
...
...
@@ -217,12 +210,6 @@ export class CustomTreeView extends Disposable implements ITreeView {
this
.
doRefresh
([
this
.
root
]);
/** soft refresh **/
}
}));
this
.
markdownRenderer
=
instantiationService
.
createInstance
(
MarkdownRenderer
);
this
.
_register
(
toDisposable
(()
=>
{
if
(
this
.
markdownResult
)
{
this
.
markdownResult
.
dispose
();
}
}));
this
.
_register
(
Registry
.
as
<
IViewsRegistry
>
(
Extensions
.
ViewsRegistry
).
onDidChangeContainer
(({
views
,
from
,
to
})
=>
{
if
(
from
===
this
.
viewContainer
&&
views
.
some
(
v
=>
v
.
id
===
this
.
id
))
{
this
.
viewContainer
=
to
;
...
...
@@ -256,12 +243,12 @@ export class CustomTreeView extends Disposable implements ITreeView {
}
}
private
_message
:
string
|
IMarkdownString
|
undefined
;
get
message
():
string
|
IMarkdownString
|
undefined
{
private
_message
:
string
|
undefined
;
get
message
():
string
|
undefined
{
return
this
.
_message
;
}
set
message
(
message
:
string
|
IMarkdownString
|
undefined
)
{
set
message
(
message
:
string
|
undefined
)
{
this
.
_message
=
message
;
this
.
updateMessage
();
}
...
...
@@ -470,16 +457,13 @@ export class CustomTreeView extends Disposable implements ITreeView {
this
.
updateContentAreas
();
}
private
showMessage
(
message
:
string
|
IMarkdownString
):
void
{
private
showMessage
(
message
:
string
):
void
{
DOM
.
removeClass
(
this
.
messageElement
,
'
hide
'
);
if
(
this
.
_messageValue
!==
message
)
{
this
.
resetMessageElement
();
this
.
_messageValue
=
message
;
if
(
isString
(
this
.
_messageValu
e
))
{
if
(
!
isFalsyOrWhitespace
(
this
.
_messag
e
))
{
this
.
messageElement
.
textContent
=
this
.
_messageValue
;
}
else
{
this
.
markdownResult
=
this
.
markdownRenderer
.
render
(
this
.
_messageValue
);
DOM
.
append
(
this
.
messageElement
,
this
.
markdownResult
.
element
);
}
this
.
layout
(
this
.
_height
,
this
.
_width
);
}
...
...
@@ -492,10 +476,6 @@ export class CustomTreeView extends Disposable implements ITreeView {
}
private
resetMessageElement
():
void
{
if
(
this
.
markdownResult
)
{
this
.
markdownResult
.
dispose
();
this
.
markdownResult
=
null
;
}
DOM
.
clearNode
(
this
.
messageElement
);
}
...
...
@@ -893,38 +873,3 @@ class TreeMenus extends Disposable implements IDisposable {
}
}
class
MarkdownRenderer
{
constructor
(
@
IOpenerService
private
readonly
_openerService
:
IOpenerService
)
{
}
private
getOptions
(
disposeables
:
DisposableStore
):
RenderOptions
{
return
{
actionHandler
:
{
callback
:
(
content
)
=>
{
let
uri
:
URI
|
undefined
;
try
{
uri
=
URI
.
parse
(
content
);
}
catch
{
// ignore
}
if
(
uri
&&
this
.
_openerService
)
{
this
.
_openerService
.
open
(
uri
).
catch
(
onUnexpectedError
);
}
},
disposeables
}
};
}
render
(
markdown
:
IMarkdownString
):
IMarkdownRenderResult
{
const
disposeables
=
new
DisposableStore
();
const
element
:
HTMLElement
=
markdown
?
renderMarkdown
(
markdown
,
this
.
getOptions
(
disposeables
))
:
document
.
createElement
(
'
span
'
);
return
{
element
,
dispose
:
()
=>
disposeables
.
dispose
()
};
}
}
src/vs/workbench/common/views.ts
浏览文件 @
192e15b6
...
...
@@ -17,7 +17,6 @@ import { values, keys } from 'vs/base/common/map';
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
IKeybindings
}
from
'
vs/platform/keybinding/common/keybindingsRegistry
'
;
import
{
IAction
}
from
'
vs/base/common/actions
'
;
import
{
IMarkdownString
}
from
'
vs/base/common/htmlContent
'
;
import
{
ExtensionIdentifier
}
from
'
vs/platform/extensions/common/extensions
'
;
export
const
TEST_VIEW_CONTAINER_ID
=
'
workbench.view.extension.test
'
;
...
...
@@ -305,7 +304,7 @@ export interface ITreeView extends IDisposable {
showCollapseAllAction
:
boolean
;
message
?:
string
|
IMarkdownString
;
message
?:
string
;
readonly
visible
:
boolean
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录