Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
8ef8adb3
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,发现更多精彩内容 >>
提交
8ef8adb3
编写于
1月 17, 2017
作者:
C
Christof Marti
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add WalkThroughContentProvider
上级
c9c2454e
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
65 addition
and
7 deletion
+65
-7
src/vs/workbench/parts/walkThrough/electron-browser/editor/editorWalkThrough.ts
.../walkThrough/electron-browser/editor/editorWalkThrough.ts
+3
-1
src/vs/workbench/parts/walkThrough/electron-browser/walkThrough.contribution.ts
.../walkThrough/electron-browser/walkThrough.contribution.ts
+5
-0
src/vs/workbench/parts/walkThrough/electron-browser/walkThroughContentProvider.ts
...alkThrough/electron-browser/walkThroughContentProvider.ts
+46
-0
src/vs/workbench/parts/walkThrough/electron-browser/walkThroughPart.ts
...nch/parts/walkThrough/electron-browser/walkThroughPart.ts
+8
-5
src/vs/workbench/parts/welcomePage/electron-browser/welcomePage.ts
...rkbench/parts/welcomePage/electron-browser/welcomePage.ts
+3
-1
未找到文件。
src/vs/workbench/parts/walkThrough/electron-browser/editor/editorWalkThrough.ts
浏览文件 @
8ef8adb3
...
...
@@ -12,6 +12,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
WalkThroughInput
}
from
'
vs/workbench/parts/walkThrough/common/walkThroughInput
'
;
import
{
WALK_THROUGH_SCHEME
}
from
'
vs/workbench/parts/walkThrough/electron-browser/walkThroughContentProvider
'
;
export
class
EditorWalkThroughAction
extends
Action
{
...
...
@@ -28,7 +29,8 @@ export class EditorWalkThroughAction extends Action {
}
public
run
():
TPromise
<
void
>
{
const
uri
=
URI
.
parse
(
require
.
toUrl
(
'
./editorWalkThrough.md
'
));
const
uri
=
URI
.
parse
(
require
.
toUrl
(
'
./editorWalkThrough.md
'
))
.
with
({
scheme
:
WALK_THROUGH_SCHEME
});
const
input
=
this
.
instantiationService
.
createInstance
(
WalkThroughInput
,
localize
(
'
editorWalkThrough.title
'
,
"
Editor Walk-Through
"
),
''
,
uri
,
null
);
return
this
.
editorService
.
openEditor
(
input
,
{
pinned
:
true
},
Position
.
ONE
)
.
then
(()
=>
void
(
0
));
...
...
src/vs/workbench/parts/walkThrough/electron-browser/walkThrough.contribution.ts
浏览文件 @
8ef8adb3
...
...
@@ -7,6 +7,7 @@
import
{
localize
}
from
'
vs/nls
'
;
import
{
WalkThroughInput
}
from
'
vs/workbench/parts/walkThrough/common/walkThroughInput
'
;
import
{
WalkThroughPart
}
from
'
vs/workbench/parts/walkThrough/electron-browser/walkThroughPart
'
;
import
{
WalkThroughContentProvider
}
from
'
vs/workbench/parts/walkThrough/electron-browser/walkThroughContentProvider
'
;
import
{
EditorWalkThroughAction
}
from
'
vs/workbench/parts/walkThrough/electron-browser/editor/editorWalkThrough
'
;
import
{
Registry
}
from
'
vs/platform/platform
'
;
import
{
EditorDescriptor
}
from
'
vs/workbench/browser/parts/editor/baseEditor
'
;
...
...
@@ -14,6 +15,7 @@ import { IEditorRegistry, Extensions as EditorExtensions } from 'vs/workbench/co
import
{
SyncDescriptor
}
from
'
vs/platform/instantiation/common/descriptors
'
;
import
{
IWorkbenchActionRegistry
,
Extensions
}
from
'
vs/workbench/common/actionRegistry
'
;
import
{
SyncActionDescriptor
}
from
'
vs/platform/actions/common/actions
'
;
import
{
IWorkbenchContributionsRegistry
,
Extensions
as
WorkbenchExtensions
}
from
'
vs/workbench/common/contributions
'
;
(
<
IEditorRegistry
>
Registry
.
as
(
EditorExtensions
.
Editors
)).
registerEditor
(
new
EditorDescriptor
(
WalkThroughPart
.
ID
,
localize
(
'
walkThrough.editor.label
'
,
"
Walk-Through
"
),
...
...
@@ -23,3 +25,6 @@ import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
Registry
.
as
<
IWorkbenchActionRegistry
>
(
Extensions
.
WorkbenchActions
)
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
EditorWalkThroughAction
,
EditorWalkThroughAction
.
ID
,
EditorWalkThroughAction
.
LABEL
),
'
Help: Editor Walk-Through
'
,
localize
(
'
help
'
,
"
Help
"
));
Registry
.
as
<
IWorkbenchContributionsRegistry
>
(
WorkbenchExtensions
.
Workbench
)
.
registerWorkbenchContribution
(
WalkThroughContentProvider
);
src/vs/workbench/parts/walkThrough/electron-browser/walkThroughContentProvider.ts
0 → 100644
浏览文件 @
8ef8adb3
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
ITextModelResolverService
,
ITextModelContentProvider
}
from
'
vs/editor/common/services/resolverService
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
ITextFileService
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
IModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
IWorkbenchContribution
}
from
'
vs/workbench/common/contributions
'
;
export
const
WALK_THROUGH_SCHEME
=
'
walkThrough
'
;
export
class
WalkThroughContentProvider
implements
ITextModelContentProvider
,
IWorkbenchContribution
{
constructor
(
@
ITextModelResolverService
private
textModelResolverService
:
ITextModelResolverService
,
@
ITextFileService
private
textFileService
:
ITextFileService
,
@
IModeService
private
modeService
:
IModeService
,
@
IModelService
private
modelService
:
IModelService
,
)
{
this
.
textModelResolverService
.
registerTextModelContentProvider
(
WALK_THROUGH_SCHEME
,
this
);
}
public
provideTextContent
(
resource
:
URI
):
TPromise
<
IModel
>
{
return
this
.
textFileService
.
resolveTextContent
(
URI
.
file
(
resource
.
fsPath
)).
then
(
content
=>
{
let
codeEditorModel
=
this
.
modelService
.
getModel
(
resource
);
if
(
!
codeEditorModel
)
{
codeEditorModel
=
this
.
modelService
.
createModel
(
content
.
value
,
this
.
modeService
.
getOrCreateModeByFilenameOrFirstLine
(
resource
.
fsPath
),
resource
);
}
else
{
codeEditorModel
.
setValueFromRawText
(
content
.
value
);
}
return
codeEditorModel
;
});
}
public
getId
():
string
{
return
'
vs.walkThroughContentProvider
'
;
}
}
\ No newline at end of file
src/vs/workbench/parts/walkThrough/electron-browser/walkThroughPart.ts
浏览文件 @
8ef8adb3
...
...
@@ -120,10 +120,13 @@ export class WalkThroughPart extends BaseEditor {
const
folder
=
new
TPromise
<
string
>
((
c
,
e
)
=>
mkdirp
(
folderName
,
null
,
err
=>
err
?
e
(
err
)
:
c
(
folderName
)));
return
super
.
setInput
(
input
,
options
)
.
then
(()
=>
this
.
fileService
.
resolveContent
(
input
.
getResource
(),
{
acceptTextOnly
:
true
}))
.
then
(
content
=>
{
.
then
(()
=>
{
return
input
.
resolve
(
true
);
})
.
then
(
model
=>
{
const
content
=
model
.
textEditorModel
.
getLinesContent
().
join
(
'
\n
'
);
if
(
strings
.
endsWith
(
input
.
getResource
().
path
,
'
.html
'
))
{
this
.
content
.
innerHTML
=
content
.
value
;
this
.
content
.
innerHTML
=
content
;
this
.
decorateContent
();
if
(
input
.
onReady
)
{
input
.
onReady
(
this
.
content
);
...
...
@@ -148,7 +151,7 @@ export class WalkThroughPart extends BaseEditor {
return
`<div id=
${
id
}
class="walkThroughEditorContainer" ></div>`
;
};
this
.
content
.
classList
.
add
(
'
walkThroughContent
'
);
// only for markdown files
const
markdown
=
this
.
expandMacros
(
content
.
value
);
const
markdown
=
this
.
expandMacros
(
content
);
this
.
content
.
innerHTML
=
marked
(
markdown
,
{
renderer
});
// TODO: also create jsconfig.json and tsconfig.json
...
...
@@ -209,7 +212,7 @@ export class WalkThroughPart extends BaseEditor {
const
keybinding
=
this
.
keybindingService
.
lookupKeybindings
(
kb
)[
0
];
const
shortcut
=
keybinding
?
this
.
keybindingService
.
getLabelFor
(
keybinding
)
:
UNBOUND_COMMAND
;
return
`<span class="shortcut">
${
shortcut
}
</span>`
;
})
})
;
}
private
decorateContent
()
{
...
...
src/vs/workbench/parts/welcomePage/electron-browser/welcomePage.ts
浏览文件 @
8ef8adb3
...
...
@@ -22,6 +22,7 @@ import { IConfigurationEditingService, ConfigurationTarget } from 'vs/workbench/
import
{
localize
}
from
'
vs/nls
'
;
import
{
Action
}
from
'
vs/base/common/actions
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
WALK_THROUGH_SCHEME
}
from
'
vs/workbench/parts/walkThrough/electron-browser/walkThroughContentProvider
'
;
const
enabledKey
=
'
workbench.welcome.enabled
'
;
...
...
@@ -83,7 +84,8 @@ class WelcomePage {
private
create
()
{
const
recentlyOpened
=
this
.
windowService
.
getRecentlyOpen
();
const
uri
=
URI
.
parse
(
require
.
toUrl
(
'
./welcomePage.html
'
));
const
uri
=
URI
.
parse
(
require
.
toUrl
(
'
./welcomePage.html
'
))
.
with
({
scheme
:
WALK_THROUGH_SCHEME
});
const
input
=
this
.
instantiationService
.
createInstance
(
WalkThroughInput
,
localize
(
'
welcome.title
'
,
"
Welcome
"
),
''
,
uri
,
container
=>
this
.
onReady
(
container
,
recentlyOpened
));
this
.
editorService
.
openEditor
(
input
,
{
pinned
:
true
},
Position
.
ONE
)
.
then
(
null
,
onUnexpectedError
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录