Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
ffd533aa
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,发现更多精彩内容 >>
未验证
提交
ffd533aa
编写于
10月 07, 2020
作者:
J
Jackson Kearl
提交者:
GitHub
10月 07, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove unnecessary model creation in walkthrough pages (#108226)
上级
8907220c
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
11 addition
and
41 deletion
+11
-41
src/vs/workbench/contrib/welcome/walkThrough/browser/walkThrough.contribution.ts
...b/welcome/walkThrough/browser/walkThrough.contribution.ts
+1
-4
src/vs/workbench/contrib/welcome/walkThrough/browser/walkThroughInput.ts
...h/contrib/welcome/walkThrough/browser/walkThroughInput.ts
+8
-10
src/vs/workbench/contrib/welcome/walkThrough/browser/walkThroughPart.ts
...ch/contrib/welcome/walkThrough/browser/walkThroughPart.ts
+1
-2
src/vs/workbench/contrib/welcome/walkThrough/common/walkThroughContentProvider.ts
.../welcome/walkThrough/common/walkThroughContentProvider.ts
+1
-25
未找到文件。
src/vs/workbench/contrib/welcome/walkThrough/browser/walkThrough.contribution.ts
浏览文件 @
ffd533aa
...
...
@@ -7,7 +7,7 @@ import { localize } from 'vs/nls';
import
{
WalkThroughInput
}
from
'
vs/workbench/contrib/welcome/walkThrough/browser/walkThroughInput
'
;
import
{
WalkThroughPart
}
from
'
vs/workbench/contrib/welcome/walkThrough/browser/walkThroughPart
'
;
import
{
WalkThroughArrowUp
,
WalkThroughArrowDown
,
WalkThroughPageUp
,
WalkThroughPageDown
}
from
'
vs/workbench/contrib/welcome/walkThrough/browser/walkThroughActions
'
;
import
{
WalkThrough
ContentProvider
,
WalkThrough
SnippetContentProvider
}
from
'
vs/workbench/contrib/welcome/walkThrough/common/walkThroughContentProvider
'
;
import
{
WalkThroughSnippetContentProvider
}
from
'
vs/workbench/contrib/welcome/walkThrough/common/walkThroughContentProvider
'
;
import
{
EditorWalkThroughAction
,
EditorWalkThroughInputFactory
}
from
'
vs/workbench/contrib/welcome/walkThrough/browser/editor/editorWalkThrough
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
Extensions
as
EditorInputExtensions
,
IEditorInputFactoryRegistry
}
from
'
vs/workbench/common/editor
'
;
...
...
@@ -34,9 +34,6 @@ Registry.as<IWorkbenchActionRegistry>(Extensions.WorkbenchActions)
Registry
.
as
<
IEditorInputFactoryRegistry
>
(
EditorInputExtensions
.
EditorInputFactories
).
registerEditorInputFactory
(
EditorWalkThroughInputFactory
.
ID
,
EditorWalkThroughInputFactory
);
Registry
.
as
<
IWorkbenchContributionsRegistry
>
(
WorkbenchExtensions
.
Workbench
)
.
registerWorkbenchContribution
(
WalkThroughContentProvider
,
LifecyclePhase
.
Starting
);
Registry
.
as
<
IWorkbenchContributionsRegistry
>
(
WorkbenchExtensions
.
Workbench
)
.
registerWorkbenchContribution
(
WalkThroughSnippetContentProvider
,
LifecyclePhase
.
Starting
);
...
...
src/vs/workbench/contrib/welcome/walkThrough/browser/walkThroughInput.ts
浏览文件 @
ffd533aa
...
...
@@ -10,19 +10,19 @@ import { ITextModelService } from 'vs/editor/common/services/resolverService';
import
*
as
marked
from
'
vs/base/common/marked/marked
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
isEqual
}
from
'
vs/base/common/resources
'
;
import
{
EndOfLinePreference
}
from
'
vs/editor/common/model
'
;
import
{
requireToContent
}
from
'
vs/workbench/contrib/welcome/walkThrough/common/walkThroughContentProvider
'
;
export
class
WalkThroughModel
extends
EditorModel
{
constructor
(
private
mainRef
:
IReference
<
ITextEditorModel
>
,
private
mainRef
:
string
,
private
snippetRefs
:
IReference
<
ITextEditorModel
>
[]
)
{
super
();
}
get
main
()
{
return
this
.
mainRef
.
object
;
return
this
.
mainRef
;
}
get
snippets
()
{
...
...
@@ -31,7 +31,6 @@ export class WalkThroughModel extends EditorModel {
dispose
()
{
this
.
snippetRefs
.
forEach
(
ref
=>
ref
.
dispose
());
this
.
mainRef
.
dispose
();
super
.
dispose
();
}
}
...
...
@@ -94,10 +93,10 @@ export class WalkThroughInput extends EditorInput {
resolve
():
Promise
<
WalkThroughModel
>
{
if
(
!
this
.
promise
)
{
this
.
promise
=
this
.
textModelResolverService
.
createModelReference
(
this
.
options
.
resource
)
.
then
(
ref
=>
{
this
.
promise
=
requireToContent
(
this
.
options
.
resource
)
.
then
(
content
=>
{
if
(
this
.
resource
.
path
.
endsWith
(
'
.html
'
))
{
return
new
WalkThroughModel
(
ref
,
[]);
return
new
WalkThroughModel
(
content
,
[]);
}
const
snippets
:
Promise
<
IReference
<
ITextEditorModel
>>
[]
=
[];
...
...
@@ -109,11 +108,10 @@ export class WalkThroughInput extends EditorInput {
return
''
;
};
const
markdown
=
ref
.
object
.
textEditorModel
.
getValue
(
EndOfLinePreference
.
LF
);
marked
(
markdown
,
{
renderer
});
marked
(
content
,
{
renderer
});
return
Promise
.
all
(
snippets
)
.
then
(
refs
=>
new
WalkThroughModel
(
ref
,
refs
));
.
then
(
refs
=>
new
WalkThroughModel
(
content
,
refs
));
});
}
...
...
src/vs/workbench/contrib/welcome/walkThrough/browser/walkThroughPart.ts
浏览文件 @
ffd533aa
...
...
@@ -39,7 +39,6 @@ import { Dimension, size } from 'vs/base/browser/dom';
import
{
IEditorGroupsService
}
from
'
vs/workbench/services/editor/common/editorGroupsService
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
domEvent
}
from
'
vs/base/browser/event
'
;
import
{
EndOfLinePreference
}
from
'
vs/editor/common/model
'
;
export
const
WALK_THROUGH_FOCUS
=
new
RawContextKey
<
boolean
>
(
'
interactivePlaygroundFocus
'
,
false
);
...
...
@@ -279,7 +278,7 @@ export class WalkThroughPart extends EditorPane {
return
;
}
const
content
=
model
.
main
.
textEditorModel
.
getValue
(
EndOfLinePreference
.
LF
)
;
const
content
=
model
.
main
;
if
(
!
input
.
resource
.
path
.
endsWith
(
'
.md
'
))
{
this
.
content
.
innerHTML
=
content
;
this
.
updateSizeClasses
();
...
...
src/vs/workbench/contrib/welcome/walkThrough/common/walkThroughContentProvider.ts
浏览文件 @
ffd533aa
...
...
@@ -14,7 +14,7 @@ import { Schemas } from 'vs/base/common/network';
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
createTextBufferFactory
}
from
'
vs/editor/common/model/textModel
'
;
function
requireToContent
(
resource
:
URI
):
Promise
<
string
>
{
export
function
requireToContent
(
resource
:
URI
):
Promise
<
string
>
{
if
(
!
resource
.
query
)
{
throw
new
Error
(
'
Welcome: invalid resource
'
);
}
...
...
@@ -37,30 +37,6 @@ function requireToContent(resource: URI): Promise<string> {
return
content
;
}
export
class
WalkThroughContentProvider
implements
ITextModelContentProvider
,
IWorkbenchContribution
{
constructor
(
@
ITextModelService
private
readonly
textModelResolverService
:
ITextModelService
,
@
IModeService
private
readonly
modeService
:
IModeService
,
@
IModelService
private
readonly
modelService
:
IModelService
,
)
{
this
.
textModelResolverService
.
registerTextModelContentProvider
(
Schemas
.
walkThrough
,
this
);
}
public
async
provideTextContent
(
resource
:
URI
):
Promise
<
ITextModel
>
{
const
content
=
await
requireToContent
(
resource
);
let
codeEditorModel
=
this
.
modelService
.
getModel
(
resource
);
if
(
!
codeEditorModel
)
{
codeEditorModel
=
this
.
modelService
.
createModel
(
content
,
this
.
modeService
.
createByFilepathOrFirstLine
(
resource
),
resource
);
}
else
{
this
.
modelService
.
updateModel
(
codeEditorModel
,
content
);
}
return
codeEditorModel
;
}
}
export
class
WalkThroughSnippetContentProvider
implements
ITextModelContentProvider
,
IWorkbenchContribution
{
constructor
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录