Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
71f86e58
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,发现更多精彩内容 >>
提交
71f86e58
编写于
11月 15, 2018
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Merge plugin config provider into plugin manager
上级
5da4d118
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
17 addition
and
25 deletion
+17
-25
extensions/typescript-language-features/src/commands.ts
extensions/typescript-language-features/src/commands.ts
+4
-4
extensions/typescript-language-features/src/extension.ts
extensions/typescript-language-features/src/extension.ts
+5
-8
extensions/typescript-language-features/src/typeScriptServiceClientHost.ts
...ript-language-features/src/typeScriptServiceClientHost.ts
+1
-3
extensions/typescript-language-features/src/typescriptServiceClient.ts
...pescript-language-features/src/typescriptServiceClient.ts
+3
-4
extensions/typescript-language-features/src/utils/plugins.ts
extensions/typescript-language-features/src/utils/plugins.ts
+4
-6
未找到文件。
extensions/typescript-language-features/src/commands.ts
浏览文件 @
71f86e58
...
...
@@ -6,11 +6,11 @@
import
*
as
vscode
from
'
vscode
'
;
import
*
as
nls
from
'
vscode-nls
'
;
import
TypeScriptServiceClientHost
from
'
./typeScriptServiceClientHost
'
;
import
{
nulToken
}
from
'
./utils/cancellation
'
;
import
{
Command
}
from
'
./utils/commandManager
'
;
import
{
Lazy
}
from
'
./utils/lazy
'
;
import
{
PluginManager
}
from
'
./utils/plugins
'
;
import
{
isImplicitProjectConfigFile
,
openOrCreateConfigFile
}
from
'
./utils/tsconfig
'
;
import
{
nulToken
}
from
'
./utils/cancellation
'
;
import
{
PluginConfigProvider
}
from
'
./utils/plugins
'
;
const
localize
=
nls
.
loadMessageBundle
();
...
...
@@ -108,11 +108,11 @@ export class ConfigurePluginCommand implements Command {
public
readonly
id
=
'
_typescript.configurePlugin
'
;
public
constructor
(
private
readonly
plugin
ConfigProvider
:
PluginConfigProvid
er
,
private
readonly
plugin
Manager
:
PluginManag
er
,
)
{
}
public
execute
(
pluginId
:
string
,
configuration
:
any
)
{
this
.
plugin
ConfigProvid
er
.
set
(
pluginId
,
configuration
);
this
.
plugin
Manag
er
.
set
(
pluginId
,
configuration
);
}
}
...
...
extensions/typescript-language-features/src/extension.ts
浏览文件 @
71f86e58
...
...
@@ -15,7 +15,7 @@ import { standardLanguageDescriptions } from './utils/languageDescription';
import
{
lazy
,
Lazy
}
from
'
./utils/lazy
'
;
import
LogDirectoryProvider
from
'
./utils/logDirectoryProvider
'
;
import
ManagedFileContextManager
from
'
./utils/managedFileContext
'
;
import
{
Plugin
ConfigProvider
,
Plugin
Manager
}
from
'
./utils/plugins
'
;
import
{
PluginManager
}
from
'
./utils/plugins
'
;
import
*
as
ProjectStatus
from
'
./utils/projectStatus
'
;
import
{
Surveyor
}
from
'
./utils/surveyor
'
;
...
...
@@ -34,7 +34,6 @@ export function activate(
context
:
vscode
.
ExtensionContext
):
Api
{
const
pluginManager
=
new
PluginManager
();
const
pluginConfigProvider
=
new
PluginConfigProvider
();
const
commandManager
=
new
CommandManager
();
context
.
subscriptions
.
push
(
commandManager
);
...
...
@@ -42,11 +41,11 @@ export function activate(
const
onCompletionAccepted
=
new
vscode
.
EventEmitter
();
context
.
subscriptions
.
push
(
onCompletionAccepted
);
const
lazyClientHost
=
createLazyClientHost
(
context
,
pluginManager
,
pluginConfigProvider
,
commandManager
,
item
=>
{
const
lazyClientHost
=
createLazyClientHost
(
context
,
pluginManager
,
commandManager
,
item
=>
{
onCompletionAccepted
.
fire
(
item
);
});
registerCommands
(
commandManager
,
lazyClientHost
,
plugin
ConfigProvid
er
);
registerCommands
(
commandManager
,
lazyClientHost
,
plugin
Manag
er
);
context
.
subscriptions
.
push
(
new
TypeScriptTaskProviderManager
(
lazyClientHost
.
map
(
x
=>
x
.
serviceClient
)));
context
.
subscriptions
.
push
(
new
LanguageConfigurationManager
());
...
...
@@ -94,7 +93,6 @@ export function activate(
function
createLazyClientHost
(
context
:
vscode
.
ExtensionContext
,
pluginManager
:
PluginManager
,
pluginConfigProvider
:
PluginConfigProvider
,
commandManager
:
CommandManager
,
onCompletionAccepted
:
(
item
:
vscode
.
CompletionItem
)
=>
void
,
):
Lazy
<
TypeScriptServiceClientHost
>
{
...
...
@@ -105,7 +103,6 @@ function createLazyClientHost(
standardLanguageDescriptions
,
context
.
workspaceState
,
pluginManager
,
pluginConfigProvider
,
commandManager
,
logDirectoryProvider
,
onCompletionAccepted
);
...
...
@@ -129,7 +126,7 @@ function createLazyClientHost(
function
registerCommands
(
commandManager
:
CommandManager
,
lazyClientHost
:
Lazy
<
TypeScriptServiceClientHost
>
,
plugin
ConfigProvider
:
PluginConfigProvid
er
,
plugin
Manager
:
PluginManag
er
,
)
{
commandManager
.
register
(
new
commands
.
ReloadTypeScriptProjectsCommand
(
lazyClientHost
));
commandManager
.
register
(
new
commands
.
ReloadJavaScriptProjectsCommand
(
lazyClientHost
));
...
...
@@ -138,7 +135,7 @@ function registerCommands(
commandManager
.
register
(
new
commands
.
RestartTsServerCommand
(
lazyClientHost
));
commandManager
.
register
(
new
commands
.
TypeScriptGoToProjectConfigCommand
(
lazyClientHost
));
commandManager
.
register
(
new
commands
.
JavaScriptGoToProjectConfigCommand
(
lazyClientHost
));
commandManager
.
register
(
new
commands
.
ConfigurePluginCommand
(
plugin
ConfigProvid
er
));
commandManager
.
register
(
new
commands
.
ConfigurePluginCommand
(
plugin
Manag
er
));
}
function
isSupportedDocument
(
...
...
extensions/typescript-language-features/src/typeScriptServiceClientHost.ts
浏览文件 @
71f86e58
...
...
@@ -20,7 +20,7 @@ import { CommandManager } from './utils/commandManager';
import
{
Disposable
}
from
'
./utils/dispose
'
;
import
{
DiagnosticLanguage
,
LanguageDescription
}
from
'
./utils/languageDescription
'
;
import
LogDirectoryProvider
from
'
./utils/logDirectoryProvider
'
;
import
{
Plugin
ConfigProvider
,
Plugin
Manager
}
from
'
./utils/plugins
'
;
import
{
PluginManager
}
from
'
./utils/plugins
'
;
import
*
as
typeConverters
from
'
./utils/typeConverters
'
;
import
TypingsStatus
,
{
AtaProgressReporter
}
from
'
./utils/typingsStatus
'
;
import
VersionStatus
from
'
./utils/versionStatus
'
;
...
...
@@ -49,7 +49,6 @@ export default class TypeScriptServiceClientHost extends Disposable {
descriptions
:
LanguageDescription
[],
workspaceState
:
vscode
.
Memento
,
pluginManager
:
PluginManager
,
pluginConfigProvider
:
PluginConfigProvider
,
private
readonly
commandManager
:
CommandManager
,
logDirectoryProvider
:
LogDirectoryProvider
,
onCompletionAccepted
:
(
item
:
vscode
.
CompletionItem
)
=>
void
,
...
...
@@ -74,7 +73,6 @@ export default class TypeScriptServiceClientHost extends Disposable {
workspaceState
,
version
=>
this
.
versionStatus
.
onDidChangeTypeScriptVersion
(
version
),
pluginManager
,
pluginConfigProvider
,
logDirectoryProvider
,
allModeIds
));
...
...
extensions/typescript-language-features/src/typescriptServiceClient.ts
浏览文件 @
71f86e58
...
...
@@ -20,7 +20,7 @@ import * as is from './utils/is';
import
LogDirectoryProvider
from
'
./utils/logDirectoryProvider
'
;
import
Logger
from
'
./utils/logger
'
;
import
{
TypeScriptPluginPathsProvider
}
from
'
./utils/pluginPathsProvider
'
;
import
{
Plugin
ConfigProvider
,
Plugin
Manager
}
from
'
./utils/plugins
'
;
import
{
PluginManager
}
from
'
./utils/plugins
'
;
import
TelemetryReporter
from
'
./utils/telemetry
'
;
import
Tracer
from
'
./utils/tracer
'
;
import
{
inferredProjectConfig
}
from
'
./utils/tsconfig
'
;
...
...
@@ -75,7 +75,6 @@ export default class TypeScriptServiceClient extends Disposable implements IType
private
readonly
workspaceState
:
vscode
.
Memento
,
private
readonly
onDidChangeTypeScriptVersion
:
(
version
:
TypeScriptVersion
)
=>
void
,
public
readonly
pluginManager
:
PluginManager
,
private
readonly
pluginConfigProvider
:
PluginConfigProvider
,
private
readonly
logDirectoryProvider
:
LogDirectoryProvider
,
allModeIds
:
string
[]
)
{
...
...
@@ -134,7 +133,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType
this
.
typescriptServerSpawner
=
new
TypeScriptServerSpawner
(
this
.
versionProvider
,
this
.
logDirectoryProvider
,
this
.
pluginPathsProvider
,
this
.
logger
,
this
.
telemetryReporter
,
this
.
tracer
);
this
.
_register
(
this
.
plugin
ConfigProvid
er
.
onDidUpdateConfig
(
update
=>
{
this
.
_register
(
this
.
plugin
Manag
er
.
onDidUpdateConfig
(
update
=>
{
this
.
configurePlugin
(
update
.
pluginId
,
update
.
config
);
}));
}
...
...
@@ -413,7 +412,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType
}
// Reconfigure any plugins
for
(
const
[
config
,
pluginName
]
of
this
.
plugin
ConfigProvider
.
entries
())
{
for
(
const
[
config
,
pluginName
]
of
this
.
plugin
Manager
.
config
())
{
this
.
configurePlugin
(
config
,
pluginName
);
}
}
...
...
extensions/typescript-language-features/src/utils/plugins.ts
浏览文件 @
71f86e58
...
...
@@ -13,7 +13,9 @@ export interface TypeScriptServerPlugin {
readonly
languages
:
ReadonlyArray
<
string
>
;
}
export
class
PluginManager
{
export
class
PluginManager
extends
Disposable
{
private
readonly
_config
=
new
Map
<
string
,
{}
>
();
@
memoize
public
get
plugins
():
ReadonlyArray
<
TypeScriptServerPlugin
>
{
const
plugins
:
TypeScriptServerPlugin
[]
=
[];
...
...
@@ -31,10 +33,6 @@ export class PluginManager {
}
return
plugins
;
}
}
export
class
PluginConfigProvider
extends
Disposable
{
private
readonly
_config
=
new
Map
<
string
,
{}
>
();
private
readonly
_onDidUpdateConfig
=
this
.
_register
(
new
vscode
.
EventEmitter
<
{
pluginId
:
string
,
config
:
{}
}
>
());
public
readonly
onDidUpdateConfig
=
this
.
_onDidUpdateConfig
.
event
;
...
...
@@ -44,7 +42,7 @@ export class PluginConfigProvider extends Disposable {
this
.
_onDidUpdateConfig
.
fire
({
pluginId
,
config
});
}
public
entries
():
IterableIterator
<
[
string
,
{}]
>
{
public
config
():
IterableIterator
<
[
string
,
{}]
>
{
return
this
.
_config
.
entries
();
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录