Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
3e8954af
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,发现更多精彩内容 >>
提交
3e8954af
编写于
7月 31, 2017
作者:
C
Christof Marti
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Do not open Welcome page on reload (fixes #30997)
上级
a8d0740c
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
97 addition
and
35 deletion
+97
-35
src/vs/workbench/parts/welcome/page/electron-browser/welcomePage.contribution.ts
...welcome/page/electron-browser/welcomePage.contribution.ts
+4
-1
src/vs/workbench/parts/welcome/page/electron-browser/welcomePage.ts
...kbench/parts/welcome/page/electron-browser/welcomePage.ts
+41
-12
src/vs/workbench/parts/welcome/walkThrough/electron-browser/editor/editorWalkThrough.ts
.../walkThrough/electron-browser/editor/editorWalkThrough.ts
+26
-5
src/vs/workbench/parts/welcome/walkThrough/electron-browser/walkThrough.contribution.ts
.../walkThrough/electron-browser/walkThrough.contribution.ts
+3
-1
src/vs/workbench/parts/welcome/walkThrough/node/walkThroughInput.ts
...kbench/parts/welcome/walkThrough/node/walkThroughInput.ts
+23
-16
未找到文件。
src/vs/workbench/parts/welcome/page/electron-browser/welcomePage.contribution.ts
浏览文件 @
3e8954af
...
...
@@ -7,10 +7,11 @@
import
{
localize
}
from
'
vs/nls
'
;
import
{
IWorkbenchContributionsRegistry
,
Extensions
as
WorkbenchExtensions
}
from
'
vs/workbench/common/contributions
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
WelcomePageContribution
,
WelcomePageAction
}
from
'
vs/workbench/parts/welcome/page/electron-browser/welcomePage
'
;
import
{
WelcomePageContribution
,
WelcomePageAction
,
WelcomeInputFactory
}
from
'
vs/workbench/parts/welcome/page/electron-browser/welcomePage
'
;
import
{
IWorkbenchActionRegistry
,
Extensions
as
ActionExtensions
}
from
'
vs/workbench/common/actionRegistry
'
;
import
{
SyncActionDescriptor
}
from
'
vs/platform/actions/common/actions
'
;
import
{
IConfigurationRegistry
,
Extensions
as
ConfigurationExtensions
}
from
'
vs/platform/configuration/common/configurationRegistry
'
;
import
{
IEditorRegistry
,
Extensions
as
EditorExtensions
}
from
'
vs/workbench/common/editor
'
;
Registry
.
as
<
IConfigurationRegistry
>
(
ConfigurationExtensions
.
Configuration
)
.
registerConfiguration
({
...
...
@@ -37,3 +38,5 @@ Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
Registry
.
as
<
IWorkbenchActionRegistry
>
(
ActionExtensions
.
WorkbenchActions
)
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
WelcomePageAction
,
WelcomePageAction
.
ID
,
WelcomePageAction
.
LABEL
),
'
Help: Welcome
'
,
localize
(
'
help
'
,
"
Help
"
));
Registry
.
as
<
IEditorRegistry
>
(
EditorExtensions
.
Editors
).
registerEditorInputFactory
(
WelcomeInputFactory
.
ID
,
WelcomeInputFactory
);
src/vs/workbench/parts/welcome/page/electron-browser/welcomePage.ts
浏览文件 @
3e8954af
...
...
@@ -30,7 +30,7 @@ import { IMessageService, Severity, CloseAction } from 'vs/platform/message/comm
import
{
getInstalledExtensions
,
IExtensionStatus
,
onExtensionChanged
,
isKeymapExtension
}
from
'
vs/workbench/parts/extensions/electron-browser/extensionsUtils
'
;
import
{
IExtensionEnablementService
,
IExtensionManagementService
,
IExtensionGalleryService
,
IExtensionTipsService
}
from
'
vs/platform/extensionManagement/common/extensionManagement
'
;
import
{
used
}
from
'
vs/workbench/parts/welcome/page/electron-browser/vs_code_welcome_page
'
;
import
{
ILifecycleService
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
ILifecycleService
,
StartupKind
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
tildify
}
from
'
vs/base/common/labels
'
;
import
{
isLinux
}
from
'
vs/base/common/platform
'
;
...
...
@@ -40,6 +40,7 @@ import { getExtraColor } from 'vs/workbench/parts/welcome/walkThrough/node/walkT
import
{
IExtensionsWorkbenchService
}
from
'
vs/workbench/parts/extensions/common/extensions
'
;
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
IWorkspaceIdentifier
,
getWorkspaceLabel
,
ISingleFolderWorkspaceIdentifier
,
isSingleFolderWorkspaceIdentifier
}
from
"
vs/platform/workspaces/common/workspaces
"
;
import
{
IEditorInputFactory
,
EditorInput
}
from
'
vs/workbench/common/editor
'
;
used
();
...
...
@@ -56,18 +57,21 @@ export class WelcomePageContribution implements IWorkbenchContribution {
@
IWorkbenchEditorService
editorService
:
IWorkbenchEditorService
,
@
IBackupFileService
backupFileService
:
IBackupFileService
,
@
ITelemetryService
telemetryService
:
ITelemetryService
,
@
ILifecycleService
lifecycleService
:
ILifecycleService
,
@
IStorageService
storageService
:
IStorageService
)
{
const
enabled
=
isWelcomePageEnabled
(
configurationService
);
if
(
enabled
)
{
if
(
enabled
&&
lifecycleService
.
startupKind
!==
StartupKind
.
ReloadedWindow
)
{
TPromise
.
join
([
backupFileService
.
hasBackups
(),
partService
.
joinCreation
()
]).
then
(([
hasBackups
])
=>
{
const
activeInput
=
editorService
.
getActiveEditorInput
();
if
(
!
activeInput
&&
!
hasBackups
)
{
instantiationService
.
createInstance
(
WelcomePage
);
return
instantiationService
.
createInstance
(
WelcomePage
)
.
openEditor
();
}
return
undefined
;
}).
then
(
null
,
onUnexpectedError
);
}
}
...
...
@@ -102,8 +106,9 @@ export class WelcomePageAction extends Action {
}
public
run
():
TPromise
<
void
>
{
this
.
instantiationService
.
createInstance
(
WelcomePage
);
return
null
;
return
this
.
instantiationService
.
createInstance
(
WelcomePage
)
.
openEditor
()
.
then
(()
=>
undefined
);
}
}
...
...
@@ -161,10 +166,14 @@ const keymapStrings: Strings = {
extensionNotFound
:
localize
(
'
welcomePage.keymapNotFound
'
,
"
The {0} keyboard shortcuts with id {1} could not be found.
"
),
};
const
welcomeInputTypeId
=
'
workbench.editors.welcomePageInput
'
;
class
WelcomePage
{
private
disposables
:
IDisposable
[]
=
[];
readonly
editorInput
:
WalkThroughInput
;
constructor
(
@
IWorkbenchEditorService
private
editorService
:
IWorkbenchEditorService
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
,
...
...
@@ -185,20 +194,25 @@ class WelcomePage {
@
ITelemetryService
private
telemetryService
:
ITelemetryService
)
{
this
.
disposables
.
push
(
lifecycleService
.
onShutdown
(()
=>
this
.
dispose
()));
this
.
create
();
}
private
create
()
{
const
recentlyOpened
=
this
.
windowService
.
getRecentlyOpened
();
const
installedExtensions
=
this
.
instantiationService
.
invokeFunction
(
getInstalledExtensions
);
const
uri
=
URI
.
parse
(
require
.
toUrl
(
'
./vs_code_welcome_page
'
))
const
resource
=
URI
.
parse
(
require
.
toUrl
(
'
./vs_code_welcome_page
'
))
.
with
({
scheme
:
Schemas
.
walkThrough
,
query
:
JSON
.
stringify
({
moduleId
:
'
vs/workbench/parts/welcome/page/electron-browser/vs_code_welcome_page
'
})
});
const
input
=
this
.
instantiationService
.
createInstance
(
WalkThroughInput
,
localize
(
'
welcome.title
'
,
"
Welcome
"
),
''
,
uri
,
telemetryFrom
,
container
=>
this
.
onReady
(
container
,
recentlyOpened
,
installedExtensions
));
this
.
editorService
.
openEditor
(
input
,
{
pinned
:
true
},
Position
.
ONE
)
.
then
(
null
,
onUnexpectedError
);
this
.
editorInput
=
this
.
instantiationService
.
createInstance
(
WalkThroughInput
,
{
typeId
:
welcomeInputTypeId
,
name
:
localize
(
'
welcome.title
'
,
"
Welcome
"
),
resource
,
telemetryFrom
,
onReady
:
container
=>
this
.
onReady
(
container
,
recentlyOpened
,
installedExtensions
)
});
}
public
openEditor
()
{
return
this
.
editorService
.
openEditor
(
this
.
editorInput
,
{
pinned
:
true
},
Position
.
ONE
);
}
private
onReady
(
container
:
HTMLElement
,
recentlyOpened
:
TPromise
<
{
files
:
string
[];
workspaces
:
(
IWorkspaceIdentifier
|
ISingleFolderWorkspaceIdentifier
)[];
}
>
,
installedExtensions
:
TPromise
<
IExtensionStatus
[]
>
):
void
{
...
...
@@ -473,6 +487,21 @@ class WelcomePage {
}
}
export
class
WelcomeInputFactory
implements
IEditorInputFactory
{
static
ID
=
welcomeInputTypeId
;
public
serialize
(
editorInput
:
EditorInput
):
string
{
return
'
{}
'
;
}
public
deserialize
(
instantiationService
:
IInstantiationService
,
serializedEditorInput
:
string
):
WalkThroughInput
{
return
instantiationService
.
createInstance
(
WelcomePage
)
.
editorInput
;
}
}
// theming
const
buttonBackground
=
registerColor
(
'
welcomePage.buttonBackground
'
,
{
dark
:
null
,
light
:
null
,
hc
:
null
},
localize
(
'
welcomePage.buttonBackground
'
,
'
Background color for the buttons on the Welcome page.
'
));
...
...
src/vs/workbench/parts/welcome/walkThrough/electron-browser/editor/editorWalkThrough.ts
浏览文件 @
3e8954af
...
...
@@ -11,8 +11,18 @@ import { Action } from 'vs/base/common/actions';
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
WalkThroughInput
}
from
'
vs/workbench/parts/welcome/walkThrough/node/walkThroughInput
'
;
import
{
WalkThroughInput
,
WalkThroughInputOptions
}
from
'
vs/workbench/parts/welcome/walkThrough/node/walkThroughInput
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
IEditorInputFactory
,
EditorInput
}
from
'
vs/workbench/common/editor
'
;
const
typeId
=
'
workbench.editors.walkThroughInput
'
;
const
inputOptions
:
WalkThroughInputOptions
=
{
typeId
,
name
:
localize
(
'
editorWalkThrough.title
'
,
"
Interactive Playground
"
),
resource
:
URI
.
parse
(
require
.
toUrl
(
'
./vs_code_editor_walkthrough.md
'
))
.
with
({
scheme
:
Schemas
.
walkThrough
}),
telemetryFrom
:
'
walkThrough
'
};
export
class
EditorWalkThroughAction
extends
Action
{
...
...
@@ -29,10 +39,21 @@ export class EditorWalkThroughAction extends Action {
}
public
run
():
TPromise
<
void
>
{
const
uri
=
URI
.
parse
(
require
.
toUrl
(
'
./vs_code_editor_walkthrough.md
'
))
.
with
({
scheme
:
Schemas
.
walkThrough
});
const
input
=
this
.
instantiationService
.
createInstance
(
WalkThroughInput
,
localize
(
'
editorWalkThrough.title
'
,
"
Interactive Playground
"
),
''
,
uri
,
/* telemetryFrom */
null
,
/* onReady */
null
);
const
input
=
this
.
instantiationService
.
createInstance
(
WalkThroughInput
,
inputOptions
);
return
this
.
editorService
.
openEditor
(
input
,
{
pinned
:
true
},
Position
.
ONE
)
.
then
(()
=>
void
(
0
));
}
}
\ No newline at end of file
}
export
class
EditorWalkThroughInputFactory
implements
IEditorInputFactory
{
static
ID
=
typeId
;
public
serialize
(
editorInput
:
EditorInput
):
string
{
return
'
{}
'
;
}
public
deserialize
(
instantiationService
:
IInstantiationService
,
serializedEditorInput
:
string
):
WalkThroughInput
{
return
instantiationService
.
createInstance
(
WalkThroughInput
,
inputOptions
);
}
}
src/vs/workbench/parts/welcome/walkThrough/electron-browser/walkThrough.contribution.ts
浏览文件 @
3e8954af
...
...
@@ -9,7 +9,7 @@ import { WalkThroughInput } from 'vs/workbench/parts/welcome/walkThrough/node/wa
import
{
WalkThroughPart
,
WALK_THROUGH_FOCUS
}
from
'
vs/workbench/parts/welcome/walkThrough/electron-browser/walkThroughPart
'
;
import
{
WalkThroughArrowUpAction
,
WalkThroughArrowDownAction
,
WalkThroughPageUpAction
,
WalkThroughPageDownAction
}
from
'
vs/workbench/parts/welcome/walkThrough/electron-browser/walkThroughActions
'
;
import
{
WalkThroughContentProvider
,
WalkThroughSnippetContentProvider
}
from
'
vs/workbench/parts/welcome/walkThrough/node/walkThroughContentProvider
'
;
import
{
EditorWalkThroughAction
}
from
'
vs/workbench/parts/welcome/walkThrough/electron-browser/editor/editorWalkThrough
'
;
import
{
EditorWalkThroughAction
,
EditorWalkThroughInputFactory
}
from
'
vs/workbench/parts/welcome/walkThrough/electron-browser/editor/editorWalkThrough
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
EditorDescriptor
}
from
'
vs/workbench/browser/parts/editor/baseEditor
'
;
import
{
IEditorRegistry
,
Extensions
as
EditorExtensions
}
from
'
vs/workbench/common/editor
'
;
...
...
@@ -33,6 +33,8 @@ Registry.as<IWorkbenchActionRegistry>(Extensions.WorkbenchActions)
new
SyncActionDescriptor
(
EditorWalkThroughAction
,
EditorWalkThroughAction
.
ID
,
EditorWalkThroughAction
.
LABEL
),
'
Help: Interactive Playground
'
,
localize
(
'
help
'
,
"
Help
"
));
Registry
.
as
<
IEditorRegistry
>
(
EditorExtensions
.
Editors
).
registerEditorInputFactory
(
EditorWalkThroughInputFactory
.
ID
,
EditorWalkThroughInputFactory
);
Registry
.
as
<
IWorkbenchContributionsRegistry
>
(
WorkbenchExtensions
.
Workbench
)
.
registerWorkbenchContribution
(
WalkThroughContentProvider
);
...
...
src/vs/workbench/parts/welcome/walkThrough/node/walkThroughInput.ts
浏览文件 @
3e8954af
...
...
@@ -40,9 +40,16 @@ export class WalkThroughModel extends EditorModel {
}
}
export
class
WalkThroughInput
extends
EditorInput
{
export
interface
WalkThroughInputOptions
{
readonly
typeId
:
string
;
readonly
name
:
string
;
readonly
description
?:
string
;
readonly
resource
:
URI
;
readonly
telemetryFrom
:
string
;
readonly
onReady
?:
(
container
:
HTMLElement
)
=>
void
;
}
static
ID
:
string
=
'
workbench.editors.walkThroughInput
'
;
export
class
WalkThroughInput
extends
EditorInput
{
private
disposables
:
IDisposable
[]
=
[];
...
...
@@ -53,11 +60,7 @@ export class WalkThroughInput extends EditorInput {
private
maxBottomScroll
=
0
;
constructor
(
private
name
:
string
,
private
description
:
string
,
private
resource
:
URI
,
private
telemetryFrom
:
string
,
public
readonly
onReady
:
(
container
:
HTMLElement
)
=>
void
,
private
options
:
WalkThroughInputOptions
,
@
ITelemetryService
private
telemetryService
:
ITelemetryService
,
@
ILifecycleService
lifecycleService
:
ILifecycleService
,
@
ITextModelService
private
textModelResolverService
:
ITextModelService
...
...
@@ -67,36 +70,40 @@ export class WalkThroughInput extends EditorInput {
}
getResource
():
URI
{
return
this
.
resource
;
return
this
.
options
.
resource
;
}
getTypeId
():
string
{
return
WalkThroughInput
.
ID
;
return
this
.
options
.
typeId
;
}
getName
():
string
{
return
this
.
name
;
return
this
.
options
.
name
;
}
getDescription
():
string
{
return
this
.
description
;
return
this
.
options
.
description
||
''
;
}
getTelemetryFrom
():
string
{
return
this
.
telemetryFrom
||
'
walkThrough
'
;
return
this
.
options
.
telemetryFrom
;
}
getTelemetryDescriptor
():
object
{
const
descriptor
=
super
.
getTelemetryDescriptor
();
descriptor
[
'
target
'
]
=
this
.
getTelemetryFrom
();
descriptor
[
'
resource
'
]
=
telemetryURIDescriptor
(
this
.
resource
);
descriptor
[
'
resource
'
]
=
telemetryURIDescriptor
(
this
.
options
.
resource
);
return
descriptor
;
}
get
onReady
()
{
return
this
.
options
.
onReady
;
}
resolve
(
refresh
?:
boolean
):
TPromise
<
WalkThroughModel
>
{
if
(
!
this
.
promise
)
{
this
.
resolveTelemetry
();
this
.
promise
=
this
.
textModelResolverService
.
createModelReference
(
this
.
resource
)
this
.
promise
=
this
.
textModelResolverService
.
createModelReference
(
this
.
options
.
resource
)
.
then
(
ref
=>
{
if
(
strings
.
endsWith
(
this
.
getResource
().
path
,
'
.html
'
))
{
return
new
WalkThroughModel
(
ref
,
[]);
...
...
@@ -106,7 +113,7 @@ export class WalkThroughInput extends EditorInput {
let
i
=
0
;
const
renderer
=
new
marked
.
Renderer
();
renderer
.
code
=
(
code
,
lang
)
=>
{
const
resource
=
this
.
resource
.
with
({
scheme
:
Schemas
.
walkThroughSnippet
,
fragment
:
`
${
i
++
}
.
${
lang
}
`
});
const
resource
=
this
.
options
.
resource
.
with
({
scheme
:
Schemas
.
walkThroughSnippet
,
fragment
:
`
${
i
++
}
.
${
lang
}
`
});
snippets
.
push
(
this
.
textModelResolverService
.
createModelReference
(
resource
));
return
''
;
};
...
...
@@ -131,7 +138,7 @@ export class WalkThroughInput extends EditorInput {
let
otherResourceEditorInput
=
<
WalkThroughInput
>
otherInput
;
// Compare by properties
return
otherResourceEditorInput
.
resource
.
toString
()
===
thi
s
.
resource
.
toString
();
return
otherResourceEditorInput
.
options
.
resource
.
toString
()
===
this
.
option
s
.
resource
.
toString
();
}
return
false
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录