Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
6ca13773
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,发现更多精彩内容 >>
提交
6ca13773
编写于
2月 06, 2019
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Extract
上级
198e6a55
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
37 addition
and
19 deletion
+37
-19
extensions/markdown-language-features/src/extension.ts
extensions/markdown-language-features/src/extension.ts
+37
-19
未找到文件。
extensions/markdown-language-features/src/extension.ts
浏览文件 @
6ca13773
...
@@ -15,8 +15,8 @@ import MarkdownWorkspaceSymbolProvider from './features/workspaceSymbolProvider'
...
@@ -15,8 +15,8 @@ import MarkdownWorkspaceSymbolProvider from './features/workspaceSymbolProvider'
import
{
Logger
}
from
'
./logger
'
;
import
{
Logger
}
from
'
./logger
'
;
import
{
MarkdownEngine
}
from
'
./markdownEngine
'
;
import
{
MarkdownEngine
}
from
'
./markdownEngine
'
;
import
{
getMarkdownExtensionContributions
}
from
'
./markdownExtensions
'
;
import
{
getMarkdownExtensionContributions
}
from
'
./markdownExtensions
'
;
import
{
ExtensionContentSecurityPolicyArbiter
,
PreviewSecuritySelector
}
from
'
./security
'
;
import
{
ExtensionContentSecurityPolicyArbiter
,
PreviewSecuritySelector
,
ContentSecurityPolicyArbiter
}
from
'
./security
'
;
import
{
loadDefaultTelemetryReporter
}
from
'
./telemetryReporter
'
;
import
{
loadDefaultTelemetryReporter
,
TelemetryReporter
}
from
'
./telemetryReporter
'
;
import
{
githubSlugifier
}
from
'
./slugify
'
;
import
{
githubSlugifier
}
from
'
./slugify
'
;
...
@@ -31,28 +31,49 @@ export function activate(context: vscode.ExtensionContext) {
...
@@ -31,28 +31,49 @@ export function activate(context: vscode.ExtensionContext) {
const
engine
=
new
MarkdownEngine
(
contributions
,
githubSlugifier
);
const
engine
=
new
MarkdownEngine
(
contributions
,
githubSlugifier
);
const
logger
=
new
Logger
();
const
logger
=
new
Logger
();
const
selector
:
vscode
.
DocumentSelector
=
[
{
language
:
'
markdown
'
,
scheme
:
'
file
'
},
{
language
:
'
markdown
'
,
scheme
:
'
untitled
'
}
];
const
contentProvider
=
new
MarkdownContentProvider
(
engine
,
context
,
cspArbiter
,
contributions
,
logger
);
const
contentProvider
=
new
MarkdownContentProvider
(
engine
,
context
,
cspArbiter
,
contributions
,
logger
);
const
symbolProvider
=
new
MDDocumentSymbolProvider
(
engine
);
const
symbolProvider
=
new
MDDocumentSymbolProvider
(
engine
);
const
previewManager
=
new
MarkdownPreviewManager
(
contentProvider
,
logger
,
contributions
);
const
previewManager
=
new
MarkdownPreviewManager
(
contentProvider
,
logger
,
contributions
);
context
.
subscriptions
.
push
(
previewManager
);
context
.
subscriptions
.
push
(
previewManager
);
context
.
subscriptions
.
push
(
vscode
.
languages
.
setLanguageConfiguration
(
'
markdown
'
,
{
context
.
subscriptions
.
push
(
registerMarkdownLanguageFeatures
(
symbolProvider
,
engine
));
wordPattern
:
new
RegExp
(
'
(
\\
p{Alphabetic}|
\\
p{Number})+
'
,
'
ug
'
),
context
.
subscriptions
.
push
(
registerMarkdownCommands
(
previewManager
,
telemetryReporter
,
cspArbiter
,
engine
));
context
.
subscriptions
.
push
(
vscode
.
workspace
.
onDidChangeConfiguration
(()
=>
{
logger
.
updateConfiguration
();
previewManager
.
updateConfiguration
();
}));
}));
context
.
subscriptions
.
push
(
vscode
.
languages
.
registerDocumentSymbolProvider
(
selector
,
symbolProvider
));
}
context
.
subscriptions
.
push
(
vscode
.
languages
.
registerDocumentLinkProvider
(
selector
,
new
LinkProvider
()));
context
.
subscriptions
.
push
(
vscode
.
languages
.
registerFoldingRangeProvider
(
selector
,
new
MarkdownFoldingProvider
(
engine
)));
context
.
subscriptions
.
push
(
vscode
.
languages
.
registerWorkspaceSymbolProvider
(
new
MarkdownWorkspaceSymbolProvider
(
symbolProvider
)));
function
registerMarkdownLanguageFeatures
(
symbolProvider
:
MDDocumentSymbolProvider
,
engine
:
MarkdownEngine
):
vscode
.
Disposable
{
const
selector
:
vscode
.
DocumentSelector
=
[
{
language
:
'
markdown
'
,
scheme
:
'
file
'
},
{
language
:
'
markdown
'
,
scheme
:
'
untitled
'
}
];
return
vscode
.
Disposable
.
from
(
vscode
.
languages
.
setLanguageConfiguration
(
'
markdown
'
,
{
wordPattern
:
new
RegExp
(
'
(
\\
p{Alphabetic}|
\\
p{Number})+
'
,
'
ug
'
),
}),
vscode
.
languages
.
registerDocumentSymbolProvider
(
selector
,
symbolProvider
),
vscode
.
languages
.
registerDocumentLinkProvider
(
selector
,
new
LinkProvider
()),
vscode
.
languages
.
registerFoldingRangeProvider
(
selector
,
new
MarkdownFoldingProvider
(
engine
)),
vscode
.
languages
.
registerWorkspaceSymbolProvider
(
new
MarkdownWorkspaceSymbolProvider
(
symbolProvider
))
);
}
function
registerMarkdownCommands
(
previewManager
:
MarkdownPreviewManager
,
telemetryReporter
:
TelemetryReporter
,
cspArbiter
:
ContentSecurityPolicyArbiter
,
engine
:
MarkdownEngine
):
vscode
.
Disposable
{
const
previewSecuritySelector
=
new
PreviewSecuritySelector
(
cspArbiter
,
previewManager
);
const
previewSecuritySelector
=
new
PreviewSecuritySelector
(
cspArbiter
,
previewManager
);
const
commandManager
=
new
CommandManager
();
const
commandManager
=
new
CommandManager
();
context
.
subscriptions
.
push
(
commandManager
);
commandManager
.
register
(
new
commands
.
ShowPreviewCommand
(
previewManager
,
telemetryReporter
));
commandManager
.
register
(
new
commands
.
ShowPreviewCommand
(
previewManager
,
telemetryReporter
));
commandManager
.
register
(
new
commands
.
ShowPreviewToSideCommand
(
previewManager
,
telemetryReporter
));
commandManager
.
register
(
new
commands
.
ShowPreviewToSideCommand
(
previewManager
,
telemetryReporter
));
commandManager
.
register
(
new
commands
.
ShowLockedPreviewToSideCommand
(
previewManager
,
telemetryReporter
));
commandManager
.
register
(
new
commands
.
ShowLockedPreviewToSideCommand
(
previewManager
,
telemetryReporter
));
...
@@ -62,9 +83,6 @@ export function activate(context: vscode.ExtensionContext) {
...
@@ -62,9 +83,6 @@ export function activate(context: vscode.ExtensionContext) {
commandManager
.
register
(
new
commands
.
ShowPreviewSecuritySelectorCommand
(
previewSecuritySelector
,
previewManager
));
commandManager
.
register
(
new
commands
.
ShowPreviewSecuritySelectorCommand
(
previewSecuritySelector
,
previewManager
));
commandManager
.
register
(
new
commands
.
OpenDocumentLinkCommand
(
engine
));
commandManager
.
register
(
new
commands
.
OpenDocumentLinkCommand
(
engine
));
commandManager
.
register
(
new
commands
.
ToggleLockCommand
(
previewManager
));
commandManager
.
register
(
new
commands
.
ToggleLockCommand
(
previewManager
));
return
commandManager
;
context
.
subscriptions
.
push
(
vscode
.
workspace
.
onDidChangeConfiguration
(()
=>
{
logger
.
updateConfiguration
();
previewManager
.
updateConfiguration
();
}));
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录