Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
1b7f924e
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,发现更多精彩内容 >>
提交
1b7f924e
编写于
12月 21, 2017
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Clean up in Output panel:
- Do not create a channel if not registered
上级
33c067f6
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
83 addition
and
51 deletion
+83
-51
src/vs/workbench/parts/output/electron-browser/outputServices.ts
...workbench/parts/output/electron-browser/outputServices.ts
+76
-45
src/vs/workbench/parts/search/browser/searchViewlet.ts
src/vs/workbench/parts/search/browser/searchViewlet.ts
+1
-1
src/vs/workbench/parts/search/common/constants.ts
src/vs/workbench/parts/search/common/constants.ts
+1
-0
src/vs/workbench/parts/search/electron-browser/search.contribution.ts
...ench/parts/search/electron-browser/search.contribution.ts
+1
-1
src/vs/workbench/parts/tasks/electron-browser/task.contribution.ts
...rkbench/parts/tasks/electron-browser/task.contribution.ts
+4
-4
未找到文件。
src/vs/workbench/parts/output/electron-browser/outputServices.ts
浏览文件 @
1b7f924e
...
...
@@ -39,6 +39,7 @@ import { ILogService } from 'vs/platform/log/common/log';
import
{
binarySearch
}
from
'
vs/base/common/arrays
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
ILifecycleService
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
const
OUTPUT_ACTIVE_CHANNEL_KEY
=
'
output.activechannel
'
;
...
...
@@ -399,7 +400,8 @@ export class OutputService extends Disposable implements IOutputService, ITextMo
public
_serviceBrand
:
any
;
private
channels
:
Map
<
string
,
OutputChannel
>
=
new
Map
<
string
,
OutputChannel
>
();
private
activeChannelId
:
string
;
private
activeChannelIdInStorage
:
string
;
private
activeChannel
:
IOutputChannel
;
private
readonly
outputDir
:
string
;
private
_onActiveOutputChannel
:
Emitter
<
string
>
=
new
Emitter
<
string
>
();
...
...
@@ -416,23 +418,36 @@ export class OutputService extends Disposable implements IOutputService, ITextMo
@
IEnvironmentService
environmentService
:
IEnvironmentService
,
@
IWindowService
windowService
:
IWindowService
,
@
ITelemetryService
private
telemetryService
:
ITelemetryService
,
@
ILogService
private
logService
:
ILogService
@
ILogService
private
logService
:
ILogService
,
@
ILifecycleService
private
lifecycleService
:
ILifecycleService
,
)
{
super
();
const
channels
=
this
.
getChannels
();
this
.
activeChannelId
=
this
.
storageService
.
get
(
OUTPUT_ACTIVE_CHANNEL_KEY
,
StorageScope
.
WORKSPACE
,
channels
&&
channels
.
length
>
0
?
channels
[
0
].
id
:
null
);
instantiationService
.
createInstance
(
OutputLinkProvider
);
this
.
activeChannelIdInStorage
=
this
.
storageService
.
get
(
OUTPUT_ACTIVE_CHANNEL_KEY
,
StorageScope
.
WORKSPACE
,
null
);
this
.
outputDir
=
paths
.
join
(
environmentService
.
logsPath
,
`output_
${
windowService
.
getCurrentWindowId
()}
_
${
toLocalISOString
(
new
Date
()).
replace
(
/-|:|
\.\d
+Z$/g
,
''
)}
`
);
// Register as text model content provider for output
textModelResolverService
.
registerTextModelContentProvider
(
OUTPUT_SCHEME
,
this
);
instantiationService
.
createInstance
(
OutputLinkProvider
);
// Create output channels for already registered channels
const
registry
=
Registry
.
as
<
IOutputChannelRegistry
>
(
Extensions
.
OutputChannels
);
for
(
const
channelIdentifier
of
registry
.
getChannels
())
{
this
.
onDidRegisterChannel
(
channelIdentifier
.
id
);
}
this
.
_register
(
registry
.
onDidRegisterChannel
(
this
.
onDidRegisterChannel
,
this
));
this
.
onDidPanelOpen
(
this
.
panelService
.
getActivePanel
());
panelService
.
onDidPanelOpen
(
this
.
onDidPanelOpen
,
this
);
panelService
.
onDidPanelClose
(
this
.
onDidPanelClose
,
this
);
this
.
outputDir
=
paths
.
join
(
environmentService
.
logsPath
,
`output_
${
windowService
.
getCurrentWindowId
()}
_
${
toLocalISOString
(
new
Date
()).
replace
(
/-|:|
\.\d
+Z$/g
,
''
)}
`
);
this
.
_register
(
toDisposable
(()
=>
unWatchAllFiles
()));
// Set active channel to first channel if not set
if
(
!
this
.
activeChannel
)
{
const
channels
=
this
.
getChannels
();
this
.
activeChannel
=
channels
&&
channels
.
length
>
0
?
this
.
getChannel
(
channels
[
0
].
id
)
:
null
;
}
this
.
lifecycleService
.
onShutdown
(()
=>
this
.
onShutdown
());
}
provideTextContent
(
resource
:
URI
):
TPromise
<
IModel
>
{
...
...
@@ -444,14 +459,15 @@ export class OutputService extends Disposable implements IOutputService, ITextMo
}
showChannel
(
id
:
string
,
preserveFocus
?:
boolean
):
TPromise
<
void
>
{
if
(
this
.
isChannelShown
(
id
))
{
const
channel
=
this
.
getChannel
(
id
);
if
(
!
channel
||
this
.
isChannelShown
(
channel
))
{
return
TPromise
.
as
(
null
);
}
this
.
activeChannel
Id
=
id
;
this
.
activeChannel
=
channel
;
let
promise
=
TPromise
.
as
(
null
);
if
(
this
.
_outputPanel
)
{
this
.
doShowChannel
(
id
,
preserveFocus
);
this
.
doShowChannel
(
channel
,
preserveFocus
);
}
else
{
promise
=
this
.
panelService
.
openPanel
(
OUTPUT_PANEL_ID
)
as
TPromise
;
}
...
...
@@ -459,9 +475,6 @@ export class OutputService extends Disposable implements IOutputService, ITextMo
}
getChannel
(
id
:
string
):
IOutputChannel
{
if
(
!
this
.
channels
.
has
(
id
))
{
this
.
channels
.
set
(
id
,
this
.
createChannel
(
id
));
}
return
this
.
channels
.
get
(
id
);
}
...
...
@@ -470,7 +483,31 @@ export class OutputService extends Disposable implements IOutputService, ITextMo
}
getActiveChannel
():
IOutputChannel
{
return
this
.
getChannel
(
this
.
activeChannelId
);
return
this
.
activeChannel
;
}
private
onDidRegisterChannel
(
channelId
:
string
):
void
{
const
channel
=
this
.
createChannel
(
channelId
);
this
.
channels
.
set
(
channelId
,
channel
);
if
(
this
.
activeChannelIdInStorage
===
channelId
)
{
this
.
activeChannel
=
channel
;
this
.
onDidPanelOpen
(
this
.
panelService
.
getActivePanel
());
}
}
private
onDidPanelOpen
(
panel
:
IPanel
):
void
{
if
(
panel
&&
panel
.
getId
()
===
OUTPUT_PANEL_ID
)
{
this
.
_outputPanel
=
<
OutputPanel
>
this
.
panelService
.
getActivePanel
();
if
(
this
.
activeChannel
)
{
this
.
doShowChannel
(
this
.
activeChannel
,
true
);
}
}
}
private
onDidPanelClose
(
panel
:
IPanel
):
void
{
if
(
this
.
_outputPanel
&&
panel
.
getId
()
===
OUTPUT_PANEL_ID
)
{
this
.
_outputPanel
.
clearInput
();
}
}
private
createChannel
(
id
:
string
):
OutputChannel
{
...
...
@@ -479,14 +516,14 @@ export class OutputService extends Disposable implements IOutputService, ITextMo
channel
.
onDidAppendedContent
(()
=>
{
if
(
!
channel
.
scrollLock
)
{
const
panel
=
this
.
panelService
.
getActivePanel
();
if
(
panel
&&
panel
.
getId
()
===
OUTPUT_PANEL_ID
&&
this
.
isChannelShown
(
id
))
{
if
(
panel
&&
panel
.
getId
()
===
OUTPUT_PANEL_ID
&&
this
.
isChannelShown
(
channel
))
{
(
<
OutputPanel
>
panel
).
revealLastLine
();
}
}
},
channelDisposables
);
channel
.
onDispose
(()
=>
{
Registry
.
as
<
IOutputChannelRegistry
>
(
Extensions
.
OutputChannels
).
removeChannel
(
id
);
if
(
this
.
activeChannel
Id
===
id
)
{
if
(
this
.
activeChannel
===
channel
)
{
const
channels
=
this
.
getChannels
();
if
(
this
.
_outputPanel
&&
channels
.
length
)
{
this
.
showChannel
(
channels
[
0
].
id
);
...
...
@@ -502,6 +539,11 @@ export class OutputService extends Disposable implements IOutputService, ITextMo
private
instantiateChannel
(
id
:
string
):
OutputChannel
{
const
channelData
=
Registry
.
as
<
IOutputChannelRegistry
>
(
Extensions
.
OutputChannels
).
getChannel
(
id
);
if
(
!
channelData
)
{
this
.
logService
.
error
(
`Channel '
${
id
}
' is not registered yet`
);
throw
new
Error
(
`Channel '
${
id
}
' is not registered yet`
);
}
const
uri
=
URI
.
from
({
scheme
:
OUTPUT_SCHEME
,
path
:
id
});
if
(
channelData
&&
channelData
.
file
)
{
return
this
.
instantiationService
.
createInstance
(
FileOutputChannel
,
channelData
,
uri
);
...
...
@@ -516,41 +558,30 @@ export class OutputService extends Disposable implements IOutputService, ITextMo
}
}
private
isChannelShown
(
channelId
:
string
):
boolean
{
const
panel
=
this
.
panelService
.
getActivePanel
();
return
panel
&&
panel
.
getId
()
===
OUTPUT_PANEL_ID
&&
this
.
activeChannelId
===
channelId
;
}
private
onDidPanelClose
(
panel
:
IPanel
):
void
{
if
(
this
.
_outputPanel
&&
panel
.
getId
()
===
OUTPUT_PANEL_ID
)
{
this
.
_outputPanel
.
clearInput
();
}
}
private
onDidPanelOpen
(
panel
:
IPanel
):
void
{
if
(
panel
&&
panel
.
getId
()
===
OUTPUT_PANEL_ID
)
{
this
.
_outputPanel
=
<
OutputPanel
>
this
.
panelService
.
getActivePanel
();
if
(
this
.
activeChannelId
)
{
this
.
doShowChannel
(
this
.
activeChannelId
,
true
);
}
}
}
private
doShowChannel
(
channelId
:
string
,
preserveFocus
:
boolean
):
void
{
private
doShowChannel
(
channel
:
IOutputChannel
,
preserveFocus
:
boolean
):
void
{
if
(
this
.
_outputPanel
)
{
this
.
storageService
.
store
(
OUTPUT_ACTIVE_CHANNEL_KEY
,
channelId
,
StorageScope
.
WORKSPACE
);
this
.
_outputPanel
.
setInput
(
this
.
createInput
(
channelId
),
EditorOptions
.
create
({
preserveFocus
:
preserveFocus
}));
this
.
_outputPanel
.
setInput
(
this
.
createInput
(
channel
),
EditorOptions
.
create
({
preserveFocus
:
preserveFocus
}));
if
(
!
preserveFocus
)
{
this
.
_outputPanel
.
focus
();
}
}
}
private
createInput
(
channelId
:
string
):
ResourceEditorInput
{
const
resource
=
URI
.
from
({
scheme
:
OUTPUT_SCHEME
,
path
:
channelId
});
const
channelData
=
Registry
.
as
<
IOutputChannelRegistry
>
(
Extensions
.
OutputChannels
).
getChannel
(
channelId
);
const
label
=
channelData
?
channelData
.
label
:
channelId
;
return
this
.
instantiationService
.
createInstance
(
ResourceEditorInput
,
nls
.
localize
(
'
output
'
,
"
{0} - Output
"
,
label
),
nls
.
localize
(
'
channel
'
,
"
Output channel for '{0}'
"
,
label
),
resource
);
private
isChannelShown
(
channel
:
IOutputChannel
):
boolean
{
const
panel
=
this
.
panelService
.
getActivePanel
();
return
panel
&&
panel
.
getId
()
===
OUTPUT_PANEL_ID
&&
this
.
activeChannel
===
channel
;
}
private
createInput
(
channel
:
IOutputChannel
):
ResourceEditorInput
{
const
resource
=
URI
.
from
({
scheme
:
OUTPUT_SCHEME
,
path
:
channel
.
id
});
return
this
.
instantiationService
.
createInstance
(
ResourceEditorInput
,
nls
.
localize
(
'
output
'
,
"
{0} - Output
"
,
channel
.
label
),
nls
.
localize
(
'
channel
'
,
"
Output channel for '{0}'
"
,
channel
.
label
),
resource
);
}
onShutdown
():
void
{
if
(
this
.
activeChannel
)
{
this
.
storageService
.
store
(
OUTPUT_ACTIVE_CHANNEL_KEY
,
this
.
activeChannel
.
id
,
StorageScope
.
WORKSPACE
);
}
this
.
dispose
();
}
}
...
...
src/vs/workbench/parts/search/browser/searchViewlet.ts
浏览文件 @
1b7f924e
...
...
@@ -1063,7 +1063,7 @@ export class SearchViewlet extends Viewlet {
this
.
showEmptyStage
();
let
isDone
=
false
;
const
outputChannel
=
this
.
outputService
.
getChannel
(
'
search
'
);
const
outputChannel
=
this
.
outputService
.
getChannel
(
Constants
.
SEARCH_OUTPUT_CHANNEL_ID
);
let
onComplete
=
(
completed
?:
ISearchComplete
)
=>
{
if
(
query
.
useRipgrep
)
{
outputChannel
.
append
(
'
\n
'
);
...
...
src/vs/workbench/parts/search/common/constants.ts
浏览文件 @
1b7f924e
...
...
@@ -6,6 +6,7 @@
import
{
RawContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
export
const
VIEWLET_ID
=
'
workbench.view.search
'
;
export
const
SEARCH_OUTPUT_CHANNEL_ID
=
'
search
'
;
export
const
FindInFilesActionId
=
'
workbench.action.findInFiles
'
;
export
const
FocusActiveEditorCommandId
=
'
search.action.focusActiveEditor
'
;
...
...
src/vs/workbench/parts/search/electron-browser/search.contribution.ts
浏览文件 @
1b7f924e
...
...
@@ -360,7 +360,7 @@ Registry.as<IQuickOpenRegistry>(QuickOpenExtensions.Quickopen).registerQuickOpen
// Search output channel
const
outputChannelRegistry
=
<
IOutputChannelRegistry
>
Registry
.
as
(
OutputExt
.
OutputChannels
);
outputChannelRegistry
.
registerChannel
(
'
search
'
,
nls
.
localize
(
'
searchOutputChannelTitle
'
,
"
Search
"
));
outputChannelRegistry
.
registerChannel
(
Constants
.
SEARCH_OUTPUT_CHANNEL_ID
,
nls
.
localize
(
'
searchOutputChannelTitle
'
,
"
Search
"
));
// Configuration
const
configurationRegistry
=
Registry
.
as
<
IConfigurationRegistry
>
(
ConfigurationExtensions
.
Configuration
);
...
...
src/vs/workbench/parts/tasks/electron-browser/task.contribution.ts
浏览文件 @
1b7f924e
...
...
@@ -2358,6 +2358,10 @@ MenuRegistry.addCommand({ id: 'workbench.action.tasks.configureDefaultTestTask',
// MenuRegistry.addCommand( { id: 'workbench.action.tasks.rebuild', title: nls.localize('RebuildAction.label', 'Run Rebuild Task'), category: tasksCategory });
// MenuRegistry.addCommand( { id: 'workbench.action.tasks.clean', title: nls.localize('CleanAction.label', 'Run Clean Task'), category: tasksCategory });
// Tasks Output channel. Register it before using it in Task Service.
let
outputChannelRegistry
=
<
IOutputChannelRegistry
>
Registry
.
as
(
OutputExt
.
OutputChannels
);
outputChannelRegistry
.
registerChannel
(
TaskService
.
OutputChannelId
,
TaskService
.
OutputChannelLabel
);
// Task Service
registerSingleton
(
ITaskService
,
TaskService
);
...
...
@@ -2383,10 +2387,6 @@ let statusbarRegistry = <IStatusbarRegistry>Registry.as(StatusbarExtensions.Stat
statusbarRegistry
.
registerStatusbarItem
(
new
StatusbarItemDescriptor
(
BuildStatusBarItem
,
StatusbarAlignment
.
LEFT
,
50
/* Medium Priority */
));
statusbarRegistry
.
registerStatusbarItem
(
new
StatusbarItemDescriptor
(
TaskStatusBarItem
,
StatusbarAlignment
.
LEFT
,
50
/* Medium Priority */
));
// Output channel
let
outputChannelRegistry
=
<
IOutputChannelRegistry
>
Registry
.
as
(
OutputExt
.
OutputChannels
);
outputChannelRegistry
.
registerChannel
(
TaskService
.
OutputChannelId
,
TaskService
.
OutputChannelLabel
);
// tasks.json validation
let
schemaId
=
'
vscode://schemas/tasks
'
;
let
schema
:
IJSONSchema
=
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录