Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
1c563f88
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,发现更多精彩内容 >>
提交
1c563f88
编写于
8月 16, 2017
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/master'
上级
a6907bc5
49084053
变更
43
隐藏空白更改
内联
并排
Showing
43 changed file
with
499 addition
and
300 deletion
+499
-300
build/gulpfile.vscode.js
build/gulpfile.vscode.js
+1
-1
package.json
package.json
+1
-1
src/vs/base/parts/quickopen/browser/quickOpenWidget.ts
src/vs/base/parts/quickopen/browser/quickOpenWidget.ts
+11
-1
src/vs/base/parts/tree/browser/tree.ts
src/vs/base/parts/tree/browser/tree.ts
+1
-0
src/vs/base/parts/tree/browser/treeView.ts
src/vs/base/parts/tree/browser/treeView.ts
+2
-1
src/vs/code/electron-main/keyboard.ts
src/vs/code/electron-main/keyboard.ts
+4
-4
src/vs/editor/common/model/textModelWithDecorations.ts
src/vs/editor/common/model/textModelWithDecorations.ts
+3
-17
src/vs/editor/contrib/colorPicker/browser/colorPicker.css
src/vs/editor/contrib/colorPicker/browser/colorPicker.css
+1
-1
src/vs/workbench/api/electron-browser/extHostCustomers.ts
src/vs/workbench/api/electron-browser/extHostCustomers.ts
+64
-0
src/vs/workbench/api/electron-browser/extensionHost.contribution.ts
...kbench/api/electron-browser/extensionHost.contribution.ts
+50
-3
src/vs/workbench/api/electron-browser/mainThreadCommands.ts
src/vs/workbench/api/electron-browser/mainThreadCommands.ts
+6
-4
src/vs/workbench/api/electron-browser/mainThreadDocumentContentProviders.ts
...pi/electron-browser/mainThreadDocumentContentProviders.ts
+79
-0
src/vs/workbench/api/electron-browser/mainThreadDocuments.ts
src/vs/workbench/api/electron-browser/mainThreadDocuments.ts
+0
-48
src/vs/workbench/api/node/extHost.api.impl.ts
src/vs/workbench/api/node/extHost.api.impl.ts
+5
-3
src/vs/workbench/api/node/extHost.protocol.ts
src/vs/workbench/api/node/extHost.protocol.ts
+26
-5
src/vs/workbench/api/node/extHostCommands.ts
src/vs/workbench/api/node/extHostCommands.ts
+3
-4
src/vs/workbench/api/node/extHostCredentials.ts
src/vs/workbench/api/node/extHostCredentials.ts
+3
-4
src/vs/workbench/api/node/extHostDebugService.ts
src/vs/workbench/api/node/extHostDebugService.ts
+3
-4
src/vs/workbench/api/node/extHostDiagnostics.ts
src/vs/workbench/api/node/extHostDiagnostics.ts
+3
-4
src/vs/workbench/api/node/extHostDocumentContentProviders.ts
src/vs/workbench/api/node/extHostDocumentContentProviders.ts
+90
-0
src/vs/workbench/api/node/extHostDocuments.ts
src/vs/workbench/api/node/extHostDocuments.ts
+3
-66
src/vs/workbench/api/node/extHostDocumentsAndEditors.ts
src/vs/workbench/api/node/extHostDocumentsAndEditors.ts
+4
-5
src/vs/workbench/api/node/extHostLanguageFeatures.ts
src/vs/workbench/api/node/extHostLanguageFeatures.ts
+3
-4
src/vs/workbench/api/node/extHostLanguages.ts
src/vs/workbench/api/node/extHostLanguages.ts
+3
-4
src/vs/workbench/api/node/extHostMessageService.ts
src/vs/workbench/api/node/extHostMessageService.ts
+3
-4
src/vs/workbench/api/node/extHostOutputService.ts
src/vs/workbench/api/node/extHostOutputService.ts
+3
-4
src/vs/workbench/api/node/extHostQuickOpen.ts
src/vs/workbench/api/node/extHostQuickOpen.ts
+3
-4
src/vs/workbench/api/node/extHostSCM.ts
src/vs/workbench/api/node/extHostSCM.ts
+3
-4
src/vs/workbench/api/node/extHostStatusBar.ts
src/vs/workbench/api/node/extHostStatusBar.ts
+3
-4
src/vs/workbench/api/node/extHostStorage.ts
src/vs/workbench/api/node/extHostStorage.ts
+3
-4
src/vs/workbench/api/node/extHostTask.ts
src/vs/workbench/api/node/extHostTask.ts
+3
-4
src/vs/workbench/api/node/extHostTelemetry.ts
src/vs/workbench/api/node/extHostTelemetry.ts
+3
-4
src/vs/workbench/api/node/extHostTerminalService.ts
src/vs/workbench/api/node/extHostTerminalService.ts
+3
-4
src/vs/workbench/api/node/extHostTextEditors.ts
src/vs/workbench/api/node/extHostTextEditors.ts
+3
-4
src/vs/workbench/api/node/extHostWorkspace.ts
src/vs/workbench/api/node/extHostWorkspace.ts
+3
-4
src/vs/workbench/electron-browser/window.ts
src/vs/workbench/electron-browser/window.ts
+1
-1
src/vs/workbench/parts/debug/electron-browser/debugService.ts
...vs/workbench/parts/debug/electron-browser/debugService.ts
+1
-1
src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts
...bench/parts/terminal/electron-browser/terminalInstance.ts
+3
-0
src/vs/workbench/parts/terminal/electron-browser/windowsShellHelper.ts
...nch/parts/terminal/electron-browser/windowsShellHelper.ts
+22
-17
src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts
...ench/test/electron-browser/api/extHostApiCommands.test.ts
+41
-35
src/vs/workbench/test/electron-browser/api/extHostDocumentsAndEditors.test.ts
...t/electron-browser/api/extHostDocumentsAndEditors.test.ts
+1
-3
src/vs/workbench/test/electron-browser/api/extHostLanguageFeatures.test.ts
...test/electron-browser/api/extHostLanguageFeatures.test.ts
+19
-12
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
...kbench/test/electron-browser/api/extHostTreeViews.test.ts
+9
-3
未找到文件。
build/gulpfile.vscode.js
浏览文件 @
1c563f88
...
...
@@ -43,7 +43,7 @@ const nodeModules = ['electron', 'original-fs']
// Build
const
builtInExtensions
=
[
{
name
:
'
ms-vscode.node-debug
'
,
version
:
'
1.16.
2
'
},
{
name
:
'
ms-vscode.node-debug
'
,
version
:
'
1.16.
3
'
},
{
name
:
'
ms-vscode.node-debug2
'
,
version
:
'
1.16.0
'
}
];
...
...
package.json
浏览文件 @
1c563f88
...
...
@@ -2,7 +2,7 @@
"name"
:
"code-oss-dev"
,
"version"
:
"1.16.0"
,
"electronVersion"
:
"1.7.4"
,
"distro"
:
"
8d45185c204c118bc29f54b40bf8c5067b355593
"
,
"distro"
:
"
724097db097bfde7796fcca70aaac83ba80a95f8
"
,
"author"
:
{
"name"
:
"Microsoft Corporation"
},
...
...
src/vs/base/parts/quickopen/browser/quickOpenWidget.ts
浏览文件 @
1c563f88
...
...
@@ -244,7 +244,8 @@ export class QuickOpenWidget implements IModelProvider {
alwaysFocused
:
true
,
verticalScrollMode
:
ScrollbarVisibility
.
Visible
,
ariaLabel
:
nls
.
localize
(
'
treeAriaLabel
'
,
"
Quick Picker
"
),
keyboardSupport
:
this
.
options
.
keyboardSupport
keyboardSupport
:
this
.
options
.
keyboardSupport
,
preventRootFocus
:
true
});
this
.
treeElement
=
this
.
tree
.
getHTMLElement
();
...
...
@@ -336,6 +337,15 @@ export class QuickOpenWidget implements IModelProvider {
this
.
applyStyles
();
// Allows focus to switch to next/previous entry after tab into an actionbar item
DOM
.
addDisposableListener
(
this
.
treeContainer
.
getHTMLElement
(),
DOM
.
EventType
.
KEY_DOWN
,
(
e
:
KeyboardEvent
)
=>
{
const
keyboardEvent
:
StandardKeyboardEvent
=
new
StandardKeyboardEvent
(
e
);
if
(
keyboardEvent
.
keyCode
===
KeyCode
.
DownArrow
||
keyboardEvent
.
keyCode
===
KeyCode
.
UpArrow
||
keyboardEvent
.
keyCode
===
KeyCode
.
PageDown
||
keyboardEvent
.
keyCode
===
KeyCode
.
PageUp
)
{
DOM
.
EventHelper
.
stop
(
e
,
true
);
this
.
navigateInTree
(
keyboardEvent
.
keyCode
,
keyboardEvent
.
shiftKey
);
this
.
inputBox
.
inputElement
.
focus
();
}
});
return
this
.
builder
.
getHTMLElement
();
}
...
...
src/vs/base/parts/tree/browser/tree.ts
浏览文件 @
1c563f88
...
...
@@ -670,6 +670,7 @@ export interface ITreeOptions extends ITreeStyles {
paddingOnRow
?:
boolean
;
ariaLabel
?:
string
;
keyboardSupport
?:
boolean
;
preventRootFocus
?:
boolean
;
}
export
interface
ITreeStyles
{
...
...
src/vs/base/parts/tree/browser/treeView.ts
浏览文件 @
1c563f88
...
...
@@ -444,7 +444,8 @@ export class TreeView extends HeightMap {
this
.
domNode
=
document
.
createElement
(
'
div
'
);
this
.
domNode
.
className
=
`monaco-tree no-focused-item monaco-tree-instance-
${
this
.
instance
}
`
;
this
.
domNode
.
tabIndex
=
0
;
// to allow direct tabbing into the tree instead of first focusing the tree
this
.
domNode
.
tabIndex
=
context
.
options
.
preventRootFocus
?
-
1
:
0
;
this
.
styleElement
=
DOM
.
createStyleSheet
(
this
.
domNode
);
...
...
src/vs/code/electron-main/keyboard.ts
浏览文件 @
1c563f88
...
...
@@ -108,10 +108,6 @@ export class KeybindingsResolver {
private
registerListeners
():
void
{
// Resolve keybindings when any first window is loaded
const
onceOnWindowReady
=
once
(
this
.
windowsService
.
onWindowReady
);
onceOnWindowReady
(
win
=>
this
.
resolveKeybindings
(
win
));
// Listen to resolved keybindings from window
ipc
.
on
(
'
vscode:keybindingsResolved
'
,
(
event
,
rawKeybindings
:
string
)
=>
{
let
keybindings
:
IKeybinding
[]
=
[];
...
...
@@ -148,6 +144,10 @@ export class KeybindingsResolver {
}
});
// Resolve keybindings when any first window is loaded
const
onceOnWindowReady
=
once
(
this
.
windowsService
.
onWindowReady
);
onceOnWindowReady
(
win
=>
this
.
resolveKeybindings
(
win
));
// Resolve keybindings again when keybindings.json changes
this
.
keybindingsWatcher
.
onDidUpdateConfiguration
(()
=>
this
.
resolveKeybindings
());
...
...
src/vs/editor/common/model/textModelWithDecorations.ts
浏览文件 @
1c563f88
...
...
@@ -879,23 +879,15 @@ export class ModelDecorationOverviewRulerOptions implements editorCommon.IModelD
let
lastStaticId
=
0
;
// TODO@Joao
// This was introduced to solve the color problem.
// We don't want to expose colors in decorations, although
// we piggyback on decorations to implement colors in the model.
export
interface
IModelDecorationExtraOptions
{
__extraOptions
?:
any
;
}
export
class
ModelDecorationOptions
implements
editorCommon
.
IModelDecorationOptions
{
public
static
EMPTY
:
ModelDecorationOptions
;
public
static
register
(
options
:
editorCommon
.
IModelDecorationOptions
&
IModelDecorationExtraOptions
):
ModelDecorationOptions
{
public
static
register
(
options
:
editorCommon
.
IModelDecorationOptions
):
ModelDecorationOptions
{
return
new
ModelDecorationOptions
(
++
lastStaticId
,
options
);
}
public
static
createDynamic
(
options
:
editorCommon
.
IModelDecorationOptions
&
IModelDecorationExtraOptions
):
ModelDecorationOptions
{
public
static
createDynamic
(
options
:
editorCommon
.
IModelDecorationOptions
):
ModelDecorationOptions
{
return
new
ModelDecorationOptions
(
0
,
options
);
}
...
...
@@ -913,9 +905,8 @@ export class ModelDecorationOptions implements editorCommon.IModelDecorationOpti
readonly
inlineClassName
:
string
;
readonly
beforeContentClassName
:
string
;
readonly
afterContentClassName
:
string
;
readonly
extraOptions
:
any
;
private
constructor
(
staticId
:
number
,
options
:
editorCommon
.
IModelDecorationOptions
&
IModelDecorationExtraOptions
)
{
private
constructor
(
staticId
:
number
,
options
:
editorCommon
.
IModelDecorationOptions
)
{
this
.
staticId
=
staticId
;
this
.
stickiness
=
options
.
stickiness
||
editorCommon
.
TrackedRangeStickiness
.
AlwaysGrowsWhenTypingAtEdges
;
this
.
className
=
options
.
className
?
cleanClassName
(
options
.
className
)
:
strings
.
empty
;
...
...
@@ -930,10 +921,6 @@ export class ModelDecorationOptions implements editorCommon.IModelDecorationOpti
this
.
inlineClassName
=
options
.
inlineClassName
?
cleanClassName
(
options
.
inlineClassName
)
:
strings
.
empty
;
this
.
beforeContentClassName
=
options
.
beforeContentClassName
?
cleanClassName
(
options
.
beforeContentClassName
)
:
strings
.
empty
;
this
.
afterContentClassName
=
options
.
afterContentClassName
?
cleanClassName
(
options
.
afterContentClassName
)
:
strings
.
empty
;
if
(
options
.
__extraOptions
)
{
this
.
extraOptions
=
options
.
__extraOptions
;
}
}
public
equals
(
other
:
ModelDecorationOptions
):
boolean
{
...
...
@@ -955,7 +942,6 @@ export class ModelDecorationOptions implements editorCommon.IModelDecorationOpti
&&
markedStringsEquals
(
this
.
hoverMessage
,
other
.
hoverMessage
)
&&
markedStringsEquals
(
this
.
glyphMarginHoverMessage
,
other
.
glyphMarginHoverMessage
)
&&
this
.
overviewRuler
.
equals
(
other
.
overviewRuler
)
&&
this
.
extraOptions
===
other
.
extraOptions
);
}
}
...
...
src/vs/editor/contrib/colorPicker/browser/colorPicker.css
浏览文件 @
1c563f88
...
...
@@ -27,7 +27,7 @@
.colorpicker-header
.picked-color
{
width
:
216px
;
text-align
:
center
;
line-height
:
2
0
px
;
line-height
:
2
4
px
;
cursor
:
pointer
;
color
:
white
;
flex
:
1
;
...
...
src/vs/workbench/api/electron-browser/extHostCustomers.ts
0 → 100644
浏览文件 @
1c563f88
/*---------------------------------------------------------------------------------------------
* 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
{
IDisposable
}
from
"
vs/base/common/lifecycle
"
;
import
{
ProxyIdentifier
}
from
"
vs/workbench/services/thread/common/threadService
"
;
import
{
IConstructorSignature1
}
from
"
vs/platform/instantiation/common/instantiation
"
;
import
{
IExtHostContext
}
from
"
vs/workbench/api/node/extHost.protocol
"
;
export
type
IExtHostNamedCustomer
=
[
ProxyIdentifier
<
IDisposable
>
,
IExtHostCustomerCtor
<
IDisposable
>
];
export
type
IExtHostCustomerCtor
<
T
>
=
IConstructorSignature1
<
IExtHostContext
,
T
>
;
export
function
extHostNamedCustomer
<
T
extends
IDisposable
>
(
id
:
ProxyIdentifier
<
T
>
)
{
return
function
(
ctor
:
IExtHostCustomerCtor
<
T
>
):
void
{
ExtHostCustomersRegistryImpl
.
INSTANCE
.
registerNamedCustomer
(
id
,
ctor
);
};
}
export
function
extHostCustomer
<
T
extends
IDisposable
>
(
ctor
:
IExtHostCustomerCtor
<
T
>
):
void
{
ExtHostCustomersRegistryImpl
.
INSTANCE
.
registerCustomer
(
ctor
);
}
export
namespace
ExtHostCustomersRegistry
{
export
function
getNamedCustomers
():
IExtHostNamedCustomer
[]
{
return
ExtHostCustomersRegistryImpl
.
INSTANCE
.
getNamedCustomers
();
}
export
function
getCustomers
():
IExtHostCustomerCtor
<
any
>
[]
{
return
ExtHostCustomersRegistryImpl
.
INSTANCE
.
getCustomers
();
}
}
class
ExtHostCustomersRegistryImpl
{
public
static
INSTANCE
=
new
ExtHostCustomersRegistryImpl
();
private
_namedCustomers
:
IExtHostNamedCustomer
[];
private
_customers
:
IExtHostCustomerCtor
<
any
>
[];
constructor
()
{
this
.
_namedCustomers
=
[];
this
.
_customers
=
[];
}
public
registerNamedCustomer
<
T
extends
IDisposable
>
(
id
:
ProxyIdentifier
<
T
>
,
ctor
:
IExtHostCustomerCtor
<
T
>
):
void
{
const
entry
:
IExtHostNamedCustomer
=
[
id
,
ctor
];
this
.
_namedCustomers
.
push
(
entry
);
}
public
getNamedCustomers
():
IExtHostNamedCustomer
[]
{
return
this
.
_namedCustomers
;
}
public
registerCustomer
<
T
>
(
ctor
:
IExtHostCustomerCtor
<
T
>
):
void
{
this
.
_customers
.
push
(
ctor
);
}
public
getCustomers
():
IExtHostCustomerCtor
<
any
>
[]
{
return
this
.
_customers
;
}
}
src/vs/workbench/api/electron-browser/extensionHost.contribution.ts
浏览文件 @
1c563f88
...
...
@@ -11,13 +11,14 @@ import { IInstantiationService, IConstructorSignature0 } from 'vs/platform/insta
import
{
IThreadService
}
from
'
vs/workbench/services/thread/common/threadService
'
;
import
{
MainContext
,
InstanceCollection
}
from
'
../node/extHost.protocol
'
;
import
{
IExtensionService
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
ExtHostCustomersRegistry
}
from
"
vs/workbench/api/electron-browser/extHostCustomers
"
;
// --- addressable
import
{
MainThreadCommands
}
from
'
./mainThreadCommands
'
;
import
{
MainThreadConfiguration
}
from
'
./mainThreadConfiguration
'
;
import
{
MainThreadDebugService
}
from
'
./mainThreadDebugService
'
;
import
{
MainThreadDiagnostics
}
from
'
./mainThreadDiagnostics
'
;
import
{
MainThreadDocuments
}
from
'
./mainThreadDocuments
'
;
import
{
MainThreadDocumentContentProviders
}
from
'
./mainThreadDocumentContentProviders
'
;
import
{
MainThreadEditors
}
from
'
./mainThreadEditors
'
;
import
{
MainThreadErrors
}
from
'
./mainThreadErrors
'
;
import
{
MainThreadTreeViews
}
from
'
./mainThreadTreeViews
'
;
...
...
@@ -48,6 +49,36 @@ import { SaveParticipant } from './mainThreadSaveParticipant';
// --- registers itself as service
import
'
./mainThreadHeapService
'
;
// --- mainThread participants
import
'
./mainThreadCommands
'
;
// import './mainThreadConfiguration';
// import './mainThreadCredentials';
// import './mainThreadDebugService';
// import './mainThreadDiagnostics';
// import './mainThreadDocuments';
// import './mainThreadDocumentsAndEditors';
import
'
./mainThreadEditor
'
;
// import './mainThreadEditors';
// import './mainThreadErrors';
// import './mainThreadExtensionService';
// import './mainThreadFileSystemEventService';
// import './mainThreadHeapService';
// import './mainThreadLanguageFeatures';
// import './mainThreadLanguages';
// import './mainThreadMessageService';
// import './mainThreadOutputService';
// import './mainThreadProgress';
// import './mainThreadQuickOpen';
// import './mainThreadSCM';
// import './mainThreadSaveParticipant';
// import './mainThreadStatusBar';
// import './mainThreadStorage';
// import './mainThreadTask';
// import './mainThreadTelemetry';
// import './mainThreadTerminalService';
// import './mainThreadTreeViews';
// import './mainThreadWorkspace';
export
class
ExtHostContribution
implements
IWorkbenchContribution
{
constructor
(
...
...
@@ -71,10 +102,10 @@ export class ExtHostContribution implements IWorkbenchContribution {
// Addressable instances
const
col
=
new
InstanceCollection
();
col
.
define
(
MainContext
.
MainThreadCommands
).
set
(
create
(
MainThreadCommands
));
col
.
define
(
MainContext
.
MainThreadConfiguration
).
set
(
create
(
MainThreadConfiguration
));
col
.
define
(
MainContext
.
MainThreadDebugService
).
set
(
create
(
MainThreadDebugService
));
col
.
define
(
MainContext
.
MainThreadDiagnostics
).
set
(
create
(
MainThreadDiagnostics
));
col
.
define
(
MainContext
.
MainThreadDocumentContentProviders
).
set
(
create
(
MainThreadDocumentContentProviders
));
col
.
define
(
MainContext
.
MainThreadDocuments
).
set
(
this
.
instantiationService
.
createInstance
(
MainThreadDocuments
,
documentsAndEditors
));
col
.
define
(
MainContext
.
MainThreadEditors
).
set
(
this
.
instantiationService
.
createInstance
(
MainThreadEditors
,
documentsAndEditors
));
col
.
define
(
MainContext
.
MainThreadErrors
).
set
(
create
(
MainThreadErrors
));
...
...
@@ -94,11 +125,27 @@ export class ExtHostContribution implements IWorkbenchContribution {
col
.
define
(
MainContext
.
MainThreadTask
).
set
(
create
(
MainThreadTask
));
col
.
define
(
MainContext
.
MainThreadCredentials
).
set
(
create
(
MainThreadCredentials
));
col
.
define
(
MainContext
.
MainProcessExtensionService
).
set
(
create
(
MainProcessExtensionServiceAPI
));
// Registered named customers
const
namedCustomers
=
ExtHostCustomersRegistry
.
getNamedCustomers
();
for
(
let
i
=
0
,
len
=
namedCustomers
.
length
;
i
<
len
;
i
++
)
{
const
[
id
,
ctor
]
=
namedCustomers
[
i
];
const
obj
=
this
.
instantiationService
.
createInstance
(
ctor
,
this
.
threadService
);
col
.
define
(
id
).
set
(
obj
);
}
// Registered customers
const
customers
=
ExtHostCustomersRegistry
.
getCustomers
();
for
(
let
i
=
0
,
len
=
customers
.
length
;
i
<
len
;
i
++
)
{
const
ctor
=
customers
[
i
];
this
.
instantiationService
.
createInstance
(
ctor
,
this
.
threadService
);
}
col
.
finish
(
true
,
this
.
threadService
);
// Other interested parties
create
(
JSONValidationExtensionPoint
);
// TODO@rehost: can survive an ext host restart
create
(
ColorExtensionPoint
);
create
(
ColorExtensionPoint
);
// TODO@rehost: can survive an ext host restart
this
.
instantiationService
.
createInstance
(
LanguageConfigurationFileHandler
);
// TODO@rehost: can survive an ext host restart
create
(
MainThreadFileSystemEventService
);
create
(
SaveParticipant
);
...
...
src/vs/workbench/api/electron-browser/mainThreadCommands.ts
浏览文件 @
1c563f88
...
...
@@ -8,19 +8,21 @@ import { IThreadService } from 'vs/workbench/services/thread/common/threadServic
import
{
ICommandService
,
CommandsRegistry
,
ICommandHandlerDescription
}
from
'
vs/platform/commands/common/commands
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
ExtHostContext
,
MainThreadCommandsShape
,
ExtHostCommandsShape
}
from
'
../node/extHost.protocol
'
;
import
{
ExtHostContext
,
MainThreadCommandsShape
,
ExtHostCommandsShape
,
MainContext
,
IExtHostContext
}
from
'
../node/extHost.protocol
'
;
import
{
extHostNamedCustomer
}
from
"
vs/workbench/api/electron-browser/extHostCustomers
"
;
@
extHostNamedCustomer
(
MainContext
.
MainThreadCommands
)
export
class
MainThreadCommands
extends
MainThreadCommandsShape
{
private
readonly
_disposables
=
new
Map
<
string
,
IDisposable
>
();
private
readonly
_proxy
:
ExtHostCommandsShape
;
constructor
(
@
IThreadService
private
readonly
_threadService
:
IThreadService
,
@
ICommandService
private
readonly
_commandService
:
ICommandService
extHostContext
:
IExtHostContext
,
@
ICommandService
private
readonly
_commandService
:
ICommandService
,
)
{
super
();
this
.
_proxy
=
this
.
_threadService
.
get
(
ExtHostContext
.
ExtHostCommands
);
this
.
_proxy
=
extHostContext
.
get
(
ExtHostContext
.
ExtHostCommands
);
}
dispose
()
{
...
...
src/vs/workbench/api/electron-browser/mainThreadDocumentContentProviders.ts
0 → 100644
浏览文件 @
1c563f88
/*---------------------------------------------------------------------------------------------
* 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
URI
from
'
vs/base/common/uri
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IThreadService
}
from
'
vs/workbench/services/thread/common/threadService
'
;
import
{
IModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ICodeEditorService
}
from
'
vs/editor/common/services/codeEditorService
'
;
import
{
IEditorGroupService
}
from
'
vs/workbench/services/group/common/groupService
'
;
import
{
MainThreadDocumentContentProvidersShape
,
ExtHostContext
,
ExtHostDocumentContentProvidersShape
}
from
'
../node/extHost.protocol
'
;
import
{
ITextSource
}
from
'
vs/editor/common/model/textSource
'
;
import
{
ITextModelService
}
from
'
vs/editor/common/services/resolverService
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
export
class
MainThreadDocumentContentProviders
extends
MainThreadDocumentContentProvidersShape
{
private
_resourceContentProvider
:
{
[
handle
:
number
]:
IDisposable
}
=
Object
.
create
(
null
);
private
readonly
_proxy
:
ExtHostDocumentContentProvidersShape
;
constructor
(
@
ITextModelService
private
readonly
_textModelResolverService
:
ITextModelService
,
@
IModeService
private
readonly
_modeService
:
IModeService
,
@
IModelService
private
readonly
_modelService
:
IModelService
,
@
IThreadService
threadService
:
IThreadService
,
@
ICodeEditorService
codeEditorService
:
ICodeEditorService
,
@
IEditorGroupService
editorGroupService
:
IEditorGroupService
)
{
super
();
this
.
_proxy
=
threadService
.
get
(
ExtHostContext
.
ExtHostDocumentContentProviders
);
}
$registerTextContentProvider
(
handle
:
number
,
scheme
:
string
):
void
{
this
.
_resourceContentProvider
[
handle
]
=
this
.
_textModelResolverService
.
registerTextModelContentProvider
(
scheme
,
{
provideTextContent
:
(
uri
:
URI
):
TPromise
<
IModel
>
=>
{
return
this
.
_proxy
.
$provideTextDocumentContent
(
handle
,
uri
).
then
(
value
=>
{
if
(
typeof
value
===
'
string
'
)
{
const
firstLineText
=
value
.
substr
(
0
,
1
+
value
.
search
(
/
\r?\n
/
));
const
mode
=
this
.
_modeService
.
getOrCreateModeByFilenameOrFirstLine
(
uri
.
fsPath
,
firstLineText
);
return
this
.
_modelService
.
createModel
(
value
,
mode
,
uri
);
}
return
undefined
;
});
}
});
}
$unregisterTextContentProvider
(
handle
:
number
):
void
{
const
registration
=
this
.
_resourceContentProvider
[
handle
];
if
(
registration
)
{
registration
.
dispose
();
delete
this
.
_resourceContentProvider
[
handle
];
}
}
$onVirtualDocumentChange
(
uri
:
URI
,
value
:
ITextSource
):
void
{
const
model
=
this
.
_modelService
.
getModel
(
uri
);
if
(
!
model
)
{
return
;
}
const
raw
:
ITextSource
=
{
lines
:
value
.
lines
,
length
:
value
.
length
,
BOM
:
value
.
BOM
,
EOL
:
value
.
EOL
,
containsRTL
:
value
.
containsRTL
,
isBasicASCII
:
value
.
isBasicASCII
,
};
if
(
!
model
.
equals
(
raw
))
{
model
.
setValueFromTextSource
(
raw
);
}
}
}
src/vs/workbench/api/electron-browser/mainThreadDocuments.ts
浏览文件 @
1c563f88
...
...
@@ -18,7 +18,6 @@ import { IEditorGroupService } from 'vs/workbench/services/group/common/groupSer
import
{
ExtHostContext
,
MainThreadDocumentsShape
,
ExtHostDocumentsShape
}
from
'
../node/extHost.protocol
'
;
import
{
ITextModelService
}
from
'
vs/editor/common/services/resolverService
'
;
import
{
ICodeEditorService
}
from
'
vs/editor/common/services/codeEditorService
'
;
import
{
ITextSource
}
from
'
vs/editor/common/model/textSource
'
;
import
{
MainThreadDocumentsAndEditors
}
from
'
./mainThreadDocumentsAndEditors
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
{
ITextEditorModel
}
from
'
vs/workbench/common/editor
'
;
...
...
@@ -82,7 +81,6 @@ export class MainThreadDocuments extends MainThreadDocumentsShape {
private
_modelToDisposeMap
:
{
[
modelUrl
:
string
]:
IDisposable
;
};
private
_proxy
:
ExtHostDocumentsShape
;
private
_modelIsSynced
:
{
[
modelId
:
string
]:
boolean
;
};
private
_resourceContentProvider
:
{
[
handle
:
number
]:
IDisposable
};
private
_modelReferenceCollection
=
new
BoundModelReferenceCollection
();
constructor
(
...
...
@@ -133,7 +131,6 @@ export class MainThreadDocuments extends MainThreadDocumentsShape {
}));
this
.
_modelToDisposeMap
=
Object
.
create
(
null
);
this
.
_resourceContentProvider
=
Object
.
create
(
null
);
}
public
dispose
():
void
{
...
...
@@ -247,49 +244,4 @@ export class MainThreadDocuments extends MainThreadDocumentsShape {
return
resource
;
});
}
// --- virtual document logic
$registerTextContentProvider
(
handle
:
number
,
scheme
:
string
):
void
{
this
.
_resourceContentProvider
[
handle
]
=
this
.
_textModelResolverService
.
registerTextModelContentProvider
(
scheme
,
{
provideTextContent
:
(
uri
:
URI
):
TPromise
<
editorCommon
.
IModel
>
=>
{
return
this
.
_proxy
.
$provideTextDocumentContent
(
handle
,
uri
).
then
(
value
=>
{
if
(
typeof
value
===
'
string
'
)
{
const
firstLineText
=
value
.
substr
(
0
,
1
+
value
.
search
(
/
\r?\n
/
));
const
mode
=
this
.
_modeService
.
getOrCreateModeByFilenameOrFirstLine
(
uri
.
fsPath
,
firstLineText
);
return
this
.
_modelService
.
createModel
(
value
,
mode
,
uri
);
}
return
undefined
;
});
}
});
}
$unregisterTextContentProvider
(
handle
:
number
):
void
{
const
registration
=
this
.
_resourceContentProvider
[
handle
];
if
(
registration
)
{
registration
.
dispose
();
delete
this
.
_resourceContentProvider
[
handle
];
}
}
$onVirtualDocumentChange
(
uri
:
URI
,
value
:
ITextSource
):
void
{
const
model
=
this
.
_modelService
.
getModel
(
uri
);
if
(
!
model
)
{
return
;
}
const
raw
:
ITextSource
=
{
lines
:
value
.
lines
,
length
:
value
.
length
,
BOM
:
value
.
BOM
,
EOL
:
value
.
EOL
,
containsRTL
:
value
.
containsRTL
,
isBasicASCII
:
value
.
isBasicASCII
,
};
if
(
!
model
.
equals
(
raw
))
{
model
.
setValueFromTextSource
(
raw
);
}
}
}
src/vs/workbench/api/node/extHost.api.impl.ts
浏览文件 @
1c563f88
...
...
@@ -15,6 +15,7 @@ import pkg from 'vs/platform/node/package';
import
{
ExtHostFileSystemEventService
}
from
'
vs/workbench/api/node/extHostFileSystemEventService
'
;
import
{
ExtHostDocumentsAndEditors
}
from
'
vs/workbench/api/node/extHostDocumentsAndEditors
'
;
import
{
ExtHostDocuments
}
from
'
vs/workbench/api/node/extHostDocuments
'
;
import
{
ExtHostDocumentContentProvider
}
from
'
vs/workbench/api/node/extHostDocumentContentProviders
'
;
import
{
ExtHostDocumentSaveParticipant
}
from
'
vs/workbench/api/node/extHostDocumentSaveParticipant
'
;
import
{
ExtHostConfiguration
}
from
'
vs/workbench/api/node/extHostConfiguration
'
;
import
{
ExtHostDiagnostics
}
from
'
vs/workbench/api/node/extHostDiagnostics
'
;
...
...
@@ -82,6 +83,7 @@ export function createApiFactory(
const
extHostDebugService
=
col
.
define
(
ExtHostContext
.
ExtHostDebugService
).
set
<
ExtHostDebugService
>
(
new
ExtHostDebugService
(
threadService
));
const
extHostDocumentsAndEditors
=
col
.
define
(
ExtHostContext
.
ExtHostDocumentsAndEditors
).
set
<
ExtHostDocumentsAndEditors
>
(
new
ExtHostDocumentsAndEditors
(
threadService
));
const
extHostDocuments
=
col
.
define
(
ExtHostContext
.
ExtHostDocuments
).
set
<
ExtHostDocuments
>
(
new
ExtHostDocuments
(
threadService
,
extHostDocumentsAndEditors
));
const
extHostDocumentContentProviders
=
col
.
define
(
ExtHostContext
.
ExtHostDocumentContentProviders
).
set
<
ExtHostDocumentContentProvider
>
(
new
ExtHostDocumentContentProvider
(
threadService
,
extHostDocumentsAndEditors
));
const
extHostDocumentSaveParticipant
=
col
.
define
(
ExtHostContext
.
ExtHostDocumentSaveParticipant
).
set
<
ExtHostDocumentSaveParticipant
>
(
new
ExtHostDocumentSaveParticipant
(
extHostDocuments
,
threadService
.
get
(
MainContext
.
MainThreadWorkspace
)));
const
extHostEditors
=
col
.
define
(
ExtHostContext
.
ExtHostEditors
).
set
<
ExtHostEditors
>
(
new
ExtHostEditors
(
threadService
,
extHostDocumentsAndEditors
));
const
extHostCommands
=
col
.
define
(
ExtHostContext
.
ExtHostCommands
).
set
<
ExtHostCommands
>
(
new
ExtHostCommands
(
threadService
,
extHostHeapService
));
...
...
@@ -428,9 +430,6 @@ export function createApiFactory(
});
});
},
registerTextDocumentContentProvider
(
scheme
:
string
,
provider
:
vscode
.
TextDocumentContentProvider
)
{
return
extHostDocuments
.
registerTextDocumentContentProvider
(
scheme
,
provider
);
},
onDidOpenTextDocument
:
(
listener
,
thisArgs
?,
disposables
?)
=>
{
return
extHostDocuments
.
onDidAddDocument
(
listener
,
thisArgs
,
disposables
);
},
...
...
@@ -452,6 +451,9 @@ export function createApiFactory(
getConfiguration
:
(
section
?:
string
,
resource
?:
vscode
.
Uri
):
vscode
.
WorkspaceConfiguration
=>
{
return
extHostConfiguration
.
getConfiguration
(
section
,
<
URI
>
resource
);
},
registerTextDocumentContentProvider
(
scheme
:
string
,
provider
:
vscode
.
TextDocumentContentProvider
)
{
return
extHostDocumentContentProviders
.
registerTextDocumentContentProvider
(
scheme
,
provider
);
},
registerTaskProvider
:
(
type
:
string
,
provider
:
vscode
.
TaskProvider
)
=>
{
return
extHostTask
.
registerTaskProvider
(
extension
,
provider
);
},
...
...
src/vs/workbench/api/node/extHost.protocol.ts
浏览文件 @
1c563f88
...
...
@@ -73,6 +73,20 @@ export interface IInitData {
telemetryInfo
:
ITelemetryInfo
;
}
export
interface
IExtHostContext
{
/**
* Returns a proxy to an object addressable/named in the extension host process.
*/
get
<
T
>
(
identifier
:
ProxyIdentifier
<
T
>
):
T
;
}
export
interface
IMainContext
{
/**
* Returns a proxy to an object addressable/named in the main/renderer process.
*/
get
<
T
>
(
identifier
:
ProxyIdentifier
<
T
>
):
T
;
}
export
interface
InstanceSetter
<
T
>
{
set
<
R
extends
T
>
(
instance
:
T
):
R
;
}
...
...
@@ -133,16 +147,18 @@ export abstract class MainThreadDiagnosticsShape {
$clear
(
owner
:
string
):
TPromise
<
any
>
{
throw
ni
();
}
}
export
abstract
class
MainThreadDocumentContentProvidersShape
{
$registerTextContentProvider
(
handle
:
number
,
scheme
:
string
):
void
{
throw
ni
();
}
$unregisterTextContentProvider
(
handle
:
number
):
void
{
throw
ni
();
}
$onVirtualDocumentChange
(
uri
:
URI
,
value
:
ITextSource
):
void
{
throw
ni
();
}
}
export
abstract
class
MainThreadDocumentsShape
{
$tryCreateDocument
(
options
?:
{
language
?:
string
;
content
?:
string
;
}):
TPromise
<
any
>
{
throw
ni
();
}
$tryOpenDocument
(
uri
:
URI
):
TPromise
<
any
>
{
throw
ni
();
}
$registerTextContentProvider
(
handle
:
number
,
scheme
:
string
):
void
{
throw
ni
();
}
$onVirtualDocumentChange
(
uri
:
URI
,
value
:
ITextSource
):
void
{
throw
ni
();
}
$unregisterTextContentProvider
(
handle
:
number
):
void
{
throw
ni
();
}
$trySaveDocument
(
uri
:
URI
):
TPromise
<
boolean
>
{
throw
ni
();
}
}
export
interface
ISelectionChangeEvent
{
selections
:
Selection
[];
source
?:
string
;
...
...
@@ -377,6 +393,10 @@ export abstract class ExtHostDiagnosticsShape {
}
export
abstract
class
ExtHostDocumentContentProvidersShape
{
$provideTextDocumentContent
(
handle
:
number
,
uri
:
URI
):
TPromise
<
string
>
{
throw
ni
();
}
}
export
interface
IModelAddedData
{
url
:
URI
;
versionId
:
number
;
...
...
@@ -386,7 +406,6 @@ export interface IModelAddedData {
isDirty
:
boolean
;
}
export
abstract
class
ExtHostDocumentsShape
{
$provideTextDocumentContent
(
handle
:
number
,
uri
:
URI
):
TPromise
<
string
>
{
throw
ni
();
}
$acceptModelModeChanged
(
strURL
:
string
,
oldModeId
:
string
,
newModeId
:
string
):
void
{
throw
ni
();
}
$acceptModelSaved
(
strURL
:
string
):
void
{
throw
ni
();
}
$acceptDirtyStateChanged
(
strURL
:
string
,
isDirty
:
boolean
):
void
{
throw
ni
();
}
...
...
@@ -539,6 +558,7 @@ export const MainContext = {
MainThreadDebugService
:
createMainId
<
MainThreadDebugServiceShape
>
(
'
MainThreadDebugService
'
,
MainThreadDebugServiceShape
),
MainThreadDiagnostics
:
createMainId
<
MainThreadDiagnosticsShape
>
(
'
MainThreadDiagnostics
'
,
MainThreadDiagnosticsShape
),
MainThreadDocuments
:
createMainId
<
MainThreadDocumentsShape
>
(
'
MainThreadDocuments
'
,
MainThreadDocumentsShape
),
MainThreadDocumentContentProviders
:
createMainId
<
MainThreadDocumentContentProvidersShape
>
(
'
MainThreadDocumentContentProviders
'
,
MainThreadDocumentContentProvidersShape
),
MainThreadEditors
:
createMainId
<
MainThreadEditorsShape
>
(
'
MainThreadEditors
'
,
MainThreadEditorsShape
),
MainThreadErrors
:
createMainId
<
MainThreadErrorsShape
>
(
'
MainThreadErrors
'
,
MainThreadErrorsShape
),
MainThreadTreeViews
:
createMainId
<
MainThreadTreeViewsShape
>
(
'
MainThreadTreeViews
'
,
MainThreadTreeViewsShape
),
...
...
@@ -566,6 +586,7 @@ export const ExtHostContext = {
ExtHostDebugService
:
createExtId
<
ExtHostDebugServiceShape
>
(
'
ExtHostDebugService
'
,
ExtHostDebugServiceShape
),
ExtHostDocumentsAndEditors
:
createExtId
<
ExtHostDocumentsAndEditorsShape
>
(
'
ExtHostDocumentsAndEditors
'
,
ExtHostDocumentsAndEditorsShape
),
ExtHostDocuments
:
createExtId
<
ExtHostDocumentsShape
>
(
'
ExtHostDocuments
'
,
ExtHostDocumentsShape
),
ExtHostDocumentContentProviders
:
createExtId
<
ExtHostDocumentContentProvidersShape
>
(
'
ExtHostDocumentContentProviders
'
,
ExtHostDocumentContentProvidersShape
),
ExtHostDocumentSaveParticipant
:
createExtId
<
ExtHostDocumentSaveParticipantShape
>
(
'
ExtHostDocumentSaveParticipant
'
,
ExtHostDocumentSaveParticipantShape
),
ExtHostEditors
:
createExtId
<
ExtHostEditorsShape
>
(
'
ExtHostEditors
'
,
ExtHostEditorsShape
),
ExtHostTreeViews
:
createExtId
<
ExtHostTreeViewsShape
>
(
'
ExtHostTreeViews
'
,
ExtHostTreeViewsShape
),
...
...
src/vs/workbench/api/node/extHostCommands.ts
浏览文件 @
1c563f88
...
...
@@ -4,14 +4,13 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
IThreadService
}
from
'
vs/workbench/services/thread/common/threadService
'
;
import
{
validateConstraint
}
from
'
vs/base/common/types
'
;
import
{
ICommandHandlerDescription
}
from
'
vs/platform/commands/common/commands
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
*
as
extHostTypes
from
'
vs/workbench/api/node/extHostTypes
'
;
import
*
as
extHostTypeConverter
from
'
vs/workbench/api/node/extHostTypeConverters
'
;
import
{
cloneAndChange
}
from
'
vs/base/common/objects
'
;
import
{
MainContext
,
MainThreadCommandsShape
,
ExtHostCommandsShape
,
ObjectIdentifier
}
from
'
./extHost.protocol
'
;
import
{
MainContext
,
MainThreadCommandsShape
,
ExtHostCommandsShape
,
ObjectIdentifier
,
IMainContext
}
from
'
./extHost.protocol
'
;
import
{
ExtHostHeapService
}
from
'
vs/workbench/api/node/extHostHeapService
'
;
import
{
isFalsyOrEmpty
}
from
'
vs/base/common/arrays
'
;
import
*
as
modes
from
'
vs/editor/common/modes
'
;
...
...
@@ -35,11 +34,11 @@ export class ExtHostCommands extends ExtHostCommandsShape {
private
_argumentProcessors
:
ArgumentProcessor
[]
=
[];
constructor
(
threadService
:
IThreadService
,
mainContext
:
IMainContext
,
heapService
:
ExtHostHeapService
)
{
super
();
this
.
_proxy
=
threadService
.
get
(
MainContext
.
MainThreadCommands
);
this
.
_proxy
=
mainContext
.
get
(
MainContext
.
MainThreadCommands
);
this
.
_converter
=
new
CommandsConverter
(
this
,
heapService
);
}
...
...
src/vs/workbench/api/node/extHostCredentials.ts
浏览文件 @
1c563f88
...
...
@@ -4,17 +4,16 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
MainContext
,
MainThreadCredentialsShape
,
ExtHostCredentialsShape
}
from
'
vs/workbench/api/node/extHost.protocol
'
;
import
{
IThreadService
}
from
'
vs/workbench/services/thread/common/threadService
'
;
import
{
MainContext
,
MainThreadCredentialsShape
,
ExtHostCredentialsShape
,
IMainContext
}
from
'
vs/workbench/api/node/extHost.protocol
'
;
export
class
ExtHostCredentials
extends
ExtHostCredentialsShape
{
private
_proxy
:
MainThreadCredentialsShape
;
constructor
(
threadService
:
IThreadService
)
{
constructor
(
mainContext
:
IMainContext
)
{
super
();
this
.
_proxy
=
threadService
.
get
(
MainContext
.
MainThreadCredentials
);
this
.
_proxy
=
mainContext
.
get
(
MainContext
.
MainThreadCredentials
);
};
readSecret
(
service
:
string
,
account
:
string
):
Thenable
<
string
|
undefined
>
{
...
...
src/vs/workbench/api/node/extHostDebugService.ts
浏览文件 @
1c563f88
...
...
@@ -7,8 +7,7 @@
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
IThreadService
}
from
'
vs/workbench/services/thread/common/threadService
'
;
import
{
MainContext
,
MainThreadDebugServiceShape
,
ExtHostDebugServiceShape
,
DebugSessionUUID
}
from
'
vs/workbench/api/node/extHost.protocol
'
;
import
{
MainContext
,
MainThreadDebugServiceShape
,
ExtHostDebugServiceShape
,
DebugSessionUUID
,
IMainContext
}
from
'
vs/workbench/api/node/extHost.protocol
'
;
import
*
as
vscode
from
'
vscode
'
;
import
URI
from
'
vs/base/common/uri
'
;
...
...
@@ -35,7 +34,7 @@ export class ExtHostDebugService extends ExtHostDebugServiceShape {
get
onDidReceiveDebugSessionCustomEvent
():
Event
<
vscode
.
DebugSessionCustomEvent
>
{
return
this
.
_onDidReceiveDebugSessionCustomEvent
.
event
;
}
constructor
(
threadService
:
IThreadService
)
{
constructor
(
mainContext
:
IMainContext
)
{
super
();
this
.
_onDidStartDebugSession
=
new
Emitter
<
vscode
.
DebugSession
>
();
...
...
@@ -43,7 +42,7 @@ export class ExtHostDebugService extends ExtHostDebugServiceShape {
this
.
_onDidChangeActiveDebugSession
=
new
Emitter
<
vscode
.
DebugSession
>
();
this
.
_onDidReceiveDebugSessionCustomEvent
=
new
Emitter
<
vscode
.
DebugSessionCustomEvent
>
();
this
.
_debugServiceProxy
=
threadService
.
get
(
MainContext
.
MainThreadDebugService
);
this
.
_debugServiceProxy
=
mainContext
.
get
(
MainContext
.
MainThreadDebugService
);
}
public
startDebugging
(
folder
:
vscode
.
WorkspaceFolder
|
undefined
,
nameOrConfig
:
string
|
vscode
.
DebugConfiguration
):
TPromise
<
boolean
>
{
...
...
src/vs/workbench/api/node/extHostDiagnostics.ts
浏览文件 @
1c563f88
...
...
@@ -5,12 +5,11 @@
'
use strict
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
IThreadService
}
from
'
vs/workbench/services/thread/common/threadService
'
;
import
{
IMarkerData
}
from
'
vs/platform/markers/common/markers
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
Severity
from
'
vs/base/common/severity
'
;
import
*
as
vscode
from
'
vscode
'
;
import
{
MainContext
,
MainThreadDiagnosticsShape
,
ExtHostDiagnosticsShape
}
from
'
./extHost.protocol
'
;
import
{
MainContext
,
MainThreadDiagnosticsShape
,
ExtHostDiagnosticsShape
,
IMainContext
}
from
'
./extHost.protocol
'
;
import
{
DiagnosticSeverity
}
from
'
./extHostTypes
'
;
import
{
mergeSort
}
from
'
vs/base/common/arrays
'
;
...
...
@@ -224,9 +223,9 @@ export class ExtHostDiagnostics extends ExtHostDiagnosticsShape {
private
_proxy
:
MainThreadDiagnosticsShape
;
private
_collections
:
DiagnosticCollection
[];
constructor
(
threadService
:
IThreadService
)
{
constructor
(
mainContext
:
IMainContext
)
{
super
();
this
.
_proxy
=
threadService
.
get
(
MainContext
.
MainThreadDiagnostics
);
this
.
_proxy
=
mainContext
.
get
(
MainContext
.
MainThreadDiagnostics
);
this
.
_collections
=
[];
}
...
...
src/vs/workbench/api/node/extHostDocumentContentProviders.ts
0 → 100644
浏览文件 @
1c563f88
/*---------------------------------------------------------------------------------------------
* 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
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
{
IThreadService
}
from
'
vs/workbench/services/thread/common/threadService
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
Disposable
}
from
'
vs/workbench/api/node/extHostTypes
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
*
as
vscode
from
'
vscode
'
;
import
{
asWinJsPromise
}
from
'
vs/base/common/async
'
;
import
{
TextSource
}
from
'
vs/editor/common/model/textSource
'
;
import
{
MainContext
,
ExtHostDocumentContentProvidersShape
,
MainThreadDocumentContentProvidersShape
}
from
'
./extHost.protocol
'
;
import
{
ExtHostDocumentsAndEditors
}
from
'
./extHostDocumentsAndEditors
'
;
export
class
ExtHostDocumentContentProvider
extends
ExtHostDocumentContentProvidersShape
{
private
static
_handlePool
=
0
;
private
readonly
_documentContentProviders
=
new
Map
<
number
,
vscode
.
TextDocumentContentProvider
>
();
private
readonly
_proxy
:
MainThreadDocumentContentProvidersShape
;
private
readonly
_documentsAndEditors
:
ExtHostDocumentsAndEditors
;
constructor
(
threadService
:
IThreadService
,
documentsAndEditors
:
ExtHostDocumentsAndEditors
)
{
super
();
this
.
_proxy
=
threadService
.
get
(
MainContext
.
MainThreadDocumentContentProviders
);
this
.
_documentsAndEditors
=
documentsAndEditors
;
}
dispose
():
void
{
// todo@joh
}
registerTextDocumentContentProvider
(
scheme
:
string
,
provider
:
vscode
.
TextDocumentContentProvider
):
vscode
.
Disposable
{
if
(
scheme
===
'
file
'
||
scheme
===
'
untitled
'
)
{
throw
new
Error
(
`scheme '
${
scheme
}
' already registered`
);
}
const
handle
=
ExtHostDocumentContentProvider
.
_handlePool
++
;
this
.
_documentContentProviders
.
set
(
handle
,
provider
);
this
.
_proxy
.
$registerTextContentProvider
(
handle
,
scheme
);
let
subscription
:
IDisposable
;
if
(
typeof
provider
.
onDidChange
===
'
function
'
)
{
subscription
=
provider
.
onDidChange
(
uri
=>
{
if
(
this
.
_documentsAndEditors
.
getDocument
(
uri
.
toString
()))
{
this
.
$provideTextDocumentContent
(
handle
,
<
URI
>
uri
).
then
(
value
=>
{
const
document
=
this
.
_documentsAndEditors
.
getDocument
(
uri
.
toString
());
if
(
!
document
)
{
// disposed in the meantime
return
;
}
// create lines and compare
const
textSource
=
TextSource
.
fromString
(
value
,
editorCommon
.
DefaultEndOfLine
.
CRLF
);
// broadcast event when content changed
if
(
!
document
.
equalLines
(
textSource
))
{
return
this
.
_proxy
.
$onVirtualDocumentChange
(
<
URI
>
uri
,
textSource
);
}
},
onUnexpectedError
);
}
});
}
return
new
Disposable
(()
=>
{
if
(
this
.
_documentContentProviders
.
delete
(
handle
))
{
this
.
_proxy
.
$unregisterTextContentProvider
(
handle
);
}
if
(
subscription
)
{
subscription
.
dispose
();
subscription
=
undefined
;
}
});
}
$provideTextDocumentContent
(
handle
:
number
,
uri
:
URI
):
TPromise
<
string
>
{
const
provider
=
this
.
_documentContentProviders
.
get
(
handle
);
if
(
!
provider
)
{
return
TPromise
.
wrapError
<
string
>
(
new
Error
(
`unsupported uri-scheme:
${
uri
.
scheme
}
`
));
}
return
asWinJsPromise
(
token
=>
provider
.
provideTextDocumentContent
(
uri
,
token
));
}
}
src/vs/workbench/api/node/extHostDocuments.ts
浏览文件 @
1c563f88
...
...
@@ -4,27 +4,19 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
{
IThreadService
}
from
'
vs/workbench/services/thread/common/threadService
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
Disposable
}
from
'
vs/workbench/api/node/extHostTypes
'
;
import
*
as
TypeConverters
from
'
./extHostTypeConverters
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
*
as
vscode
from
'
vscode
'
;
import
{
asWinJsPromise
}
from
'
vs/base/common/async
'
;
import
{
TextSource
}
from
'
vs/editor/common/model/textSource
'
;
import
{
MainContext
,
MainThreadDocumentsShape
,
ExtHostDocumentsShape
}
from
'
./extHost.protocol
'
;
import
{
MainContext
,
MainThreadDocumentsShape
,
ExtHostDocumentsShape
,
IMainContext
}
from
'
./extHost.protocol
'
;
import
{
ExtHostDocumentData
,
setWordDefinitionFor
}
from
'
./extHostDocumentData
'
;
import
{
ExtHostDocumentsAndEditors
}
from
'
./extHostDocumentsAndEditors
'
;
import
{
IModelChangedEvent
}
from
'
vs/editor/common/model/mirrorModel
'
;
export
class
ExtHostDocuments
extends
ExtHostDocumentsShape
{
private
static
_handlePool
:
number
=
0
;
private
_onDidAddDocument
=
new
Emitter
<
vscode
.
TextDocument
>
();
private
_onDidRemoveDocument
=
new
Emitter
<
vscode
.
TextDocument
>
();
private
_onDidChangeDocument
=
new
Emitter
<
vscode
.
TextDocumentChangeEvent
>
();
...
...
@@ -39,12 +31,10 @@ export class ExtHostDocuments extends ExtHostDocumentsShape {
private
_proxy
:
MainThreadDocumentsShape
;
private
_documentsAndEditors
:
ExtHostDocumentsAndEditors
;
private
_documentLoader
=
new
Map
<
string
,
TPromise
<
ExtHostDocumentData
>>
();
private
_documentContentProviders
=
new
Map
<
number
,
vscode
.
TextDocumentContentProvider
>
();
constructor
(
threadService
:
IThreadService
,
documentsAndEditors
:
ExtHostDocumentsAndEditors
)
{
constructor
(
mainContext
:
IMainContext
,
documentsAndEditors
:
ExtHostDocumentsAndEditors
)
{
super
();
this
.
_proxy
=
threadService
.
get
(
MainContext
.
MainThreadDocuments
);
this
.
_proxy
=
mainContext
.
get
(
MainContext
.
MainThreadDocuments
);
this
.
_documentsAndEditors
=
documentsAndEditors
;
this
.
_toDispose
=
[
...
...
@@ -106,59 +96,6 @@ export class ExtHostDocuments extends ExtHostDocumentsShape {
return
this
.
_proxy
.
$tryCreateDocument
(
options
);
}
public
registerTextDocumentContentProvider
(
scheme
:
string
,
provider
:
vscode
.
TextDocumentContentProvider
):
vscode
.
Disposable
{
if
(
scheme
===
'
file
'
||
scheme
===
'
untitled
'
)
{
throw
new
Error
(
`scheme '
${
scheme
}
' already registered`
);
}
const
handle
=
ExtHostDocuments
.
_handlePool
++
;
this
.
_documentContentProviders
.
set
(
handle
,
provider
);
this
.
_proxy
.
$registerTextContentProvider
(
handle
,
scheme
);
let
subscription
:
IDisposable
;
if
(
typeof
provider
.
onDidChange
===
'
function
'
)
{
subscription
=
provider
.
onDidChange
(
uri
=>
{
if
(
this
.
_documentsAndEditors
.
getDocument
(
uri
.
toString
()))
{
this
.
$provideTextDocumentContent
(
handle
,
<
URI
>
uri
).
then
(
value
=>
{
const
document
=
this
.
_documentsAndEditors
.
getDocument
(
uri
.
toString
());
if
(
!
document
)
{
// disposed in the meantime
return
;
}
// create lines and compare
const
textSource
=
TextSource
.
fromString
(
value
,
editorCommon
.
DefaultEndOfLine
.
CRLF
);
// broadcast event when content changed
if
(
!
document
.
equalLines
(
textSource
))
{
return
this
.
_proxy
.
$onVirtualDocumentChange
(
<
URI
>
uri
,
textSource
);
}
},
onUnexpectedError
);
}
});
}
return
new
Disposable
(()
=>
{
if
(
this
.
_documentContentProviders
.
delete
(
handle
))
{
this
.
_proxy
.
$unregisterTextContentProvider
(
handle
);
}
if
(
subscription
)
{
subscription
.
dispose
();
subscription
=
undefined
;
}
});
}
public
$provideTextDocumentContent
(
handle
:
number
,
uri
:
URI
):
TPromise
<
string
>
{
const
provider
=
this
.
_documentContentProviders
.
get
(
handle
);
if
(
!
provider
)
{
return
TPromise
.
wrapError
<
string
>
(
new
Error
(
`unsupported uri-scheme:
${
uri
.
scheme
}
`
));
}
return
asWinJsPromise
(
token
=>
provider
.
provideTextDocumentContent
(
uri
,
token
));
}
public
$acceptModelModeChanged
(
strURL
:
string
,
oldModeId
:
string
,
newModeId
:
string
):
void
{
let
data
=
this
.
_documentsAndEditors
.
getDocument
(
strURL
);
...
...
src/vs/workbench/api/node/extHostDocumentsAndEditors.ts
浏览文件 @
1c563f88
...
...
@@ -6,10 +6,9 @@
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
MainContext
,
ExtHostDocumentsAndEditorsShape
,
IDocumentsAndEditorsDelta
}
from
'
./extHost.protocol
'
;
import
{
MainContext
,
ExtHostDocumentsAndEditorsShape
,
IDocumentsAndEditorsDelta
,
IMainContext
}
from
'
./extHost.protocol
'
;
import
{
ExtHostDocumentData
}
from
'
./extHostDocumentData
'
;
import
{
ExtHostTextEditor
}
from
'
./extHostTextEditor
'
;
import
{
IThreadService
}
from
'
vs/workbench/services/thread/common/threadService
'
;
import
*
as
assert
from
'
assert
'
;
import
*
as
typeConverters
from
'
./extHostTypeConverters
'
;
...
...
@@ -30,7 +29,7 @@ export class ExtHostDocumentsAndEditors extends ExtHostDocumentsAndEditorsShape
readonly
onDidChangeActiveTextEditor
:
Event
<
ExtHostTextEditor
>
=
this
.
_onDidChangeActiveTextEditor
.
event
;
constructor
(
@
IThreadService
private
_threadService
:
IThreadService
private
readonly
_mainContext
:
IMainContext
)
{
super
();
}
...
...
@@ -54,7 +53,7 @@ export class ExtHostDocumentsAndEditors extends ExtHostDocumentsAndEditorsShape
assert
.
ok
(
!
this
.
_documents
.
has
(
data
.
url
.
toString
()),
`document '
${
data
.
url
}
already exists!'`
);
const
documentData
=
new
ExtHostDocumentData
(
this
.
_
threadService
.
get
(
MainContext
.
MainThreadDocuments
),
this
.
_
mainContext
.
get
(
MainContext
.
MainThreadDocuments
),
data
.
url
,
data
.
lines
,
data
.
EOL
,
...
...
@@ -82,7 +81,7 @@ export class ExtHostDocumentsAndEditors extends ExtHostDocumentsAndEditorsShape
const
documentData
=
this
.
_documents
.
get
(
data
.
document
.
toString
());
const
editor
=
new
ExtHostTextEditor
(
this
.
_
threadService
.
get
(
MainContext
.
MainThreadEditors
),
this
.
_
mainContext
.
get
(
MainContext
.
MainThreadEditors
),
data
.
id
,
documentData
,
data
.
selections
.
map
(
typeConverters
.
toSelection
),
...
...
src/vs/workbench/api/node/extHostLanguageFeatures.ts
浏览文件 @
1c563f88
...
...
@@ -7,7 +7,6 @@
import
URI
from
'
vs/base/common/uri
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
mixin
}
from
'
vs/base/common/objects
'
;
import
{
IThreadService
}
from
'
vs/workbench/services/thread/common/threadService
'
;
import
*
as
vscode
from
'
vscode
'
;
import
*
as
TypeConverters
from
'
vs/workbench/api/node/extHostTypeConverters
'
;
import
{
Range
,
Disposable
,
CompletionList
,
CompletionItem
,
SnippetString
}
from
'
vs/workbench/api/node/extHostTypes
'
;
...
...
@@ -19,7 +18,7 @@ import { ExtHostCommands, CommandsConverter } from 'vs/workbench/api/node/extHos
import
{
ExtHostDiagnostics
}
from
'
vs/workbench/api/node/extHostDiagnostics
'
;
import
{
IWorkspaceSymbolProvider
}
from
'
vs/workbench/parts/search/common/search
'
;
import
{
asWinJsPromise
}
from
'
vs/base/common/async
'
;
import
{
MainContext
,
MainThreadLanguageFeaturesShape
,
ExtHostLanguageFeaturesShape
,
ObjectIdentifier
,
IRawColorInfo
,
IRawColorFormatMap
}
from
'
./extHost.protocol
'
;
import
{
MainContext
,
MainThreadLanguageFeaturesShape
,
ExtHostLanguageFeaturesShape
,
ObjectIdentifier
,
IRawColorInfo
,
IRawColorFormatMap
,
IMainContext
}
from
'
./extHost.protocol
'
;
import
{
regExpLeadsToEndlessLoop
}
from
'
vs/base/common/strings
'
;
import
{
IPosition
}
from
'
vs/editor/common/core/position
'
;
import
{
IRange
}
from
'
vs/editor/common/core/range
'
;
...
...
@@ -737,14 +736,14 @@ export class ExtHostLanguageFeatures extends ExtHostLanguageFeaturesShape {
private
_colorFormatCache
=
new
Map
<
string
,
number
>
();
constructor
(
threadService
:
IThreadService
,
mainContext
:
IMainContext
,
documents
:
ExtHostDocuments
,
commands
:
ExtHostCommands
,
heapMonitor
:
ExtHostHeapService
,
diagnostics
:
ExtHostDiagnostics
)
{
super
();
this
.
_proxy
=
threadService
.
get
(
MainContext
.
MainThreadLanguageFeatures
);
this
.
_proxy
=
mainContext
.
get
(
MainContext
.
MainThreadLanguageFeatures
);
this
.
_documents
=
documents
;
this
.
_commands
=
commands
;
this
.
_heapService
=
heapMonitor
;
...
...
src/vs/workbench/api/node/extHostLanguages.ts
浏览文件 @
1c563f88
...
...
@@ -5,17 +5,16 @@
'
use strict
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IThreadService
}
from
'
vs/workbench/services/thread/common/threadService
'
;
import
{
MainContext
,
MainThreadLanguagesShape
}
from
'
./extHost.protocol
'
;
import
{
MainContext
,
MainThreadLanguagesShape
,
IMainContext
}
from
'
./extHost.protocol
'
;
export
class
ExtHostLanguages
{
private
_proxy
:
MainThreadLanguagesShape
;
constructor
(
threadService
:
IThreadService
mainContext
:
IMainContext
)
{
this
.
_proxy
=
threadService
.
get
(
MainContext
.
MainThreadLanguages
);
this
.
_proxy
=
mainContext
.
get
(
MainContext
.
MainThreadLanguages
);
}
getLanguages
():
TPromise
<
string
[]
>
{
...
...
src/vs/workbench/api/node/extHostMessageService.ts
浏览文件 @
1c563f88
...
...
@@ -4,10 +4,9 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
IThreadService
}
from
'
vs/workbench/services/thread/common/threadService
'
;
import
Severity
from
'
vs/base/common/severity
'
;
import
vscode
=
require
(
'
vscode
'
);
import
{
MainContext
,
MainThreadMessageServiceShape
}
from
'
./extHost.protocol
'
;
import
{
MainContext
,
MainThreadMessageServiceShape
,
IMainContext
}
from
'
./extHost.protocol
'
;
const
emptyMessageOptions
:
vscode
.
MessageOptions
=
Object
.
create
(
null
);
...
...
@@ -27,8 +26,8 @@ export class ExtHostMessageService {
private
_proxy
:
MainThreadMessageServiceShape
;
constructor
(
threadService
:
IThreadService
)
{
this
.
_proxy
=
threadService
.
get
(
MainContext
.
MainThreadMessageService
);
constructor
(
mainContext
:
IMainContext
)
{
this
.
_proxy
=
mainContext
.
get
(
MainContext
.
MainThreadMessageService
);
}
showMessage
(
severity
:
Severity
,
message
:
string
,
optionsOrFirstItem
:
vscode
.
MessageOptions
|
string
,
rest
:
string
[]):
Thenable
<
string
|
undefined
>
;
...
...
src/vs/workbench/api/node/extHostOutputService.ts
浏览文件 @
1c563f88
...
...
@@ -4,8 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
IThreadService
}
from
'
vs/workbench/services/thread/common/threadService
'
;
import
{
MainContext
,
MainThreadOutputServiceShape
}
from
'
./extHost.protocol
'
;
import
{
MainContext
,
MainThreadOutputServiceShape
,
IMainContext
}
from
'
./extHost.protocol
'
;
import
*
as
vscode
from
'
vscode
'
;
export
class
ExtHostOutputChannel
implements
vscode
.
OutputChannel
{
...
...
@@ -64,8 +63,8 @@ export class ExtHostOutputService {
private
_proxy
:
MainThreadOutputServiceShape
;
constructor
(
threadService
:
IThreadService
)
{
this
.
_proxy
=
threadService
.
get
(
MainContext
.
MainThreadOutputService
);
constructor
(
mainContext
:
IMainContext
)
{
this
.
_proxy
=
mainContext
.
get
(
MainContext
.
MainThreadOutputService
);
}
createOutputChannel
(
name
:
string
):
vscode
.
OutputChannel
{
...
...
src/vs/workbench/api/node/extHostQuickOpen.ts
浏览文件 @
1c563f88
...
...
@@ -7,9 +7,8 @@
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
wireCancellationToken
}
from
'
vs/base/common/async
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
IThreadService
}
from
'
vs/workbench/services/thread/common/threadService
'
;
import
{
QuickPickOptions
,
QuickPickItem
,
InputBoxOptions
}
from
'
vscode
'
;
import
{
MainContext
,
MainThreadQuickOpenShape
,
ExtHostQuickOpenShape
,
MyQuickPickItems
}
from
'
./extHost.protocol
'
;
import
{
MainContext
,
MainThreadQuickOpenShape
,
ExtHostQuickOpenShape
,
MyQuickPickItems
,
IMainContext
}
from
'
./extHost.protocol
'
;
export
type
Item
=
string
|
QuickPickItem
;
...
...
@@ -19,9 +18,9 @@ export class ExtHostQuickOpen extends ExtHostQuickOpenShape {
private
_onDidSelectItem
:
(
handle
:
number
)
=>
void
;
private
_validateInput
:
(
input
:
string
)
=>
string
;
constructor
(
threadService
:
IThreadService
)
{
constructor
(
mainContext
:
IMainContext
)
{
super
();
this
.
_proxy
=
threadService
.
get
(
MainContext
.
MainThreadQuickOpen
);
this
.
_proxy
=
mainContext
.
get
(
MainContext
.
MainThreadQuickOpen
);
}
showQuickPick
(
itemsOrItemsPromise
:
string
[]
|
Thenable
<
string
[]
>
,
options
?:
QuickPickOptions
,
token
?:
CancellationToken
):
Thenable
<
string
|
undefined
>
;
...
...
src/vs/workbench/api/node/extHostSCM.ts
浏览文件 @
1c563f88
...
...
@@ -8,9 +8,8 @@ import URI from 'vs/base/common/uri';
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
asWinJsPromise
}
from
'
vs/base/common/async
'
;
import
{
IThreadService
}
from
'
vs/workbench/services/thread/common/threadService
'
;
import
{
ExtHostCommands
,
CommandsConverter
}
from
'
vs/workbench/api/node/extHostCommands
'
;
import
{
MainContext
,
MainThreadSCMShape
,
SCMRawResource
}
from
'
./extHost.protocol
'
;
import
{
MainContext
,
MainThreadSCMShape
,
SCMRawResource
,
IMainContext
}
from
'
./extHost.protocol
'
;
import
*
as
vscode
from
'
vscode
'
;
function
getIconPath
(
decorations
:
vscode
.
SourceControlResourceThemableDecorations
)
{
...
...
@@ -278,10 +277,10 @@ export class ExtHostSCM {
get
inputBox
():
ExtHostSCMInputBox
{
return
this
.
_inputBox
;
}
constructor
(
threadService
:
IThreadService
,
mainContext
:
IMainContext
,
private
_commands
:
ExtHostCommands
)
{
this
.
_proxy
=
threadService
.
get
(
MainContext
.
MainThreadSCM
);
this
.
_proxy
=
mainContext
.
get
(
MainContext
.
MainThreadSCM
);
this
.
_inputBox
=
new
ExtHostSCMInputBox
(
this
.
_proxy
);
_commands
.
registerArgumentProcessor
({
...
...
src/vs/workbench/api/node/extHostStatusBar.ts
浏览文件 @
1c563f88
...
...
@@ -4,11 +4,10 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
IThreadService
}
from
'
vs/workbench/services/thread/common/threadService
'
;
import
{
StatusbarAlignment
as
MainThreadStatusBarAlignment
}
from
'
vs/platform/statusbar/common/statusbar
'
;
import
{
StatusBarAlignment
as
ExtHostStatusBarAlignment
,
Disposable
,
ThemeColor
}
from
'
./extHostTypes
'
;
import
{
StatusBarItem
,
StatusBarAlignment
}
from
'
vscode
'
;
import
{
MainContext
,
MainThreadStatusBarShape
}
from
'
./extHost.protocol
'
;
import
{
MainContext
,
MainThreadStatusBarShape
,
IMainContext
}
from
'
./extHost.protocol
'
;
export
class
ExtHostStatusBarEntry
implements
StatusBarItem
{
private
static
ID_GEN
=
0
;
...
...
@@ -163,8 +162,8 @@ export class ExtHostStatusBar {
private
_proxy
:
MainThreadStatusBarShape
;
private
_statusMessage
:
StatusBarMessage
;
constructor
(
threadService
:
IThreadService
)
{
this
.
_proxy
=
threadService
.
get
(
MainContext
.
MainThreadStatusBar
);
constructor
(
mainContext
:
IMainContext
)
{
this
.
_proxy
=
mainContext
.
get
(
MainContext
.
MainThreadStatusBar
);
this
.
_statusMessage
=
new
StatusBarMessage
(
this
);
}
...
...
src/vs/workbench/api/node/extHostStorage.ts
浏览文件 @
1c563f88
...
...
@@ -5,15 +5,14 @@
'
use strict
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IThreadService
}
from
'
vs/workbench/services/thread/common/threadService
'
;
import
{
MainContext
,
MainThreadStorageShape
}
from
'
./extHost.protocol
'
;
import
{
MainContext
,
MainThreadStorageShape
,
IMainContext
}
from
'
./extHost.protocol
'
;
export
class
ExtHostStorage
{
private
_proxy
:
MainThreadStorageShape
;
constructor
(
threadService
:
IThreadService
)
{
this
.
_proxy
=
threadService
.
get
(
MainContext
.
MainThreadStorage
);
constructor
(
mainContext
:
IMainContext
)
{
this
.
_proxy
=
mainContext
.
get
(
MainContext
.
MainThreadStorage
);
}
getValue
<
T
>
(
shared
:
boolean
,
key
:
string
,
defaultValue
?:
T
):
TPromise
<
T
>
{
...
...
src/vs/workbench/api/node/extHostTask.ts
浏览文件 @
1c563f88
...
...
@@ -12,8 +12,7 @@ import { asWinJsPromise } from 'vs/base/common/async';
import
{
IExtensionDescription
}
from
'
vs/platform/extensions/common/extensions
'
;
import
*
as
TaskSystem
from
'
vs/workbench/parts/tasks/common/tasks
'
;
import
{
IThreadService
}
from
'
vs/workbench/services/thread/common/threadService
'
;
import
{
MainContext
,
MainThreadTaskShape
,
ExtHostTaskShape
}
from
'
vs/workbench/api/node/extHost.protocol
'
;
import
{
MainContext
,
MainThreadTaskShape
,
ExtHostTaskShape
,
IMainContext
}
from
'
vs/workbench/api/node/extHost.protocol
'
;
import
*
as
types
from
'
vs/workbench/api/node/extHostTypes
'
;
import
*
as
vscode
from
'
vscode
'
;
...
...
@@ -402,9 +401,9 @@ export class ExtHostTask extends ExtHostTaskShape {
private
_handleCounter
:
number
;
private
_handlers
:
Map
<
number
,
HandlerData
>
;
constructor
(
threadService
:
IThreadService
)
{
constructor
(
mainContext
:
IMainContext
)
{
super
();
this
.
_proxy
=
threadService
.
get
(
MainContext
.
MainThreadTask
);
this
.
_proxy
=
mainContext
.
get
(
MainContext
.
MainThreadTask
);
this
.
_handleCounter
=
0
;
this
.
_handlers
=
new
Map
<
number
,
HandlerData
>
();
};
...
...
src/vs/workbench/api/node/extHostTelemetry.ts
浏览文件 @
1c563f88
...
...
@@ -7,8 +7,7 @@
import
{
notImplemented
}
from
'
vs/base/common/errors
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
ITelemetryService
,
ITelemetryInfo
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IThreadService
}
from
'
vs/workbench/services/thread/common/threadService
'
;
import
{
MainContext
,
MainThreadTelemetryShape
}
from
'
./extHost.protocol
'
;
import
{
MainContext
,
MainThreadTelemetryShape
,
IMainContext
}
from
'
./extHost.protocol
'
;
export
class
RemoteTelemetryService
implements
ITelemetryService
{
...
...
@@ -17,9 +16,9 @@ export class RemoteTelemetryService implements ITelemetryService {
private
_name
:
string
;
private
_proxy
:
MainThreadTelemetryShape
;
constructor
(
name
:
string
,
threadService
:
IThreadService
)
{
constructor
(
name
:
string
,
mainContext
:
IMainContext
)
{
this
.
_name
=
name
;
this
.
_proxy
=
threadService
.
get
(
MainContext
.
MainThreadTelemetry
);
this
.
_proxy
=
mainContext
.
get
(
MainContext
.
MainThreadTelemetry
);
}
get
isOptedIn
():
boolean
{
...
...
src/vs/workbench/api/node/extHostTerminalService.ts
浏览文件 @
1c563f88
...
...
@@ -7,8 +7,7 @@
import
vscode
=
require
(
'
vscode
'
);
import
{
TPromise
,
TValueCallback
}
from
'
vs/base/common/winjs.base
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
ExtHostTerminalServiceShape
,
MainContext
,
MainThreadTerminalServiceShape
}
from
'
./extHost.protocol
'
;
import
{
IThreadService
}
from
'
vs/workbench/services/thread/common/threadService
'
;
import
{
ExtHostTerminalServiceShape
,
MainContext
,
MainThreadTerminalServiceShape
,
IMainContext
}
from
'
./extHost.protocol
'
;
export
class
ExtHostTerminal
implements
vscode
.
Terminal
{
...
...
@@ -101,9 +100,9 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
private
_proxy
:
MainThreadTerminalServiceShape
;
private
_terminals
:
ExtHostTerminal
[];
constructor
(
threadService
:
IThreadService
)
{
constructor
(
mainContext
:
IMainContext
)
{
this
.
_onDidCloseTerminal
=
new
Emitter
<
vscode
.
Terminal
>
();
this
.
_proxy
=
threadService
.
get
(
MainContext
.
MainThreadTerminalService
);
this
.
_proxy
=
mainContext
.
get
(
MainContext
.
MainThreadTerminalService
);
this
.
_terminals
=
[];
}
...
...
src/vs/workbench/api/node/extHostTextEditors.ts
浏览文件 @
1c563f88
...
...
@@ -8,13 +8,12 @@ import URI from 'vs/base/common/uri';
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
toThenable
}
from
'
vs/base/common/async
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IThreadService
}
from
'
vs/workbench/services/thread/common/threadService
'
;
import
{
TextEditorSelectionChangeKind
}
from
'
./extHostTypes
'
;
import
*
as
TypeConverters
from
'
./extHostTypeConverters
'
;
import
{
TextEditorDecorationType
,
ExtHostTextEditor
}
from
'
./extHostTextEditor
'
;
import
{
ExtHostDocumentsAndEditors
}
from
'
./extHostDocumentsAndEditors
'
;
import
{
Position
as
EditorPosition
}
from
'
vs/platform/editor/common/editor
'
;
import
{
MainContext
,
MainThreadEditorsShape
,
ExtHostEditorsShape
,
ITextDocumentShowOptions
,
ITextEditorPositionData
,
IResolvedTextEditorConfiguration
,
ISelectionChangeEvent
}
from
'
./extHost.protocol
'
;
import
{
MainContext
,
MainThreadEditorsShape
,
ExtHostEditorsShape
,
ITextDocumentShowOptions
,
ITextEditorPositionData
,
IResolvedTextEditorConfiguration
,
ISelectionChangeEvent
,
IMainContext
}
from
'
./extHost.protocol
'
;
import
*
as
vscode
from
'
vscode
'
;
export
class
ExtHostEditors
extends
ExtHostEditorsShape
{
...
...
@@ -36,11 +35,11 @@ export class ExtHostEditors extends ExtHostEditorsShape {
private
_extHostDocumentsAndEditors
:
ExtHostDocumentsAndEditors
;
constructor
(
threadService
:
IThreadService
,
mainContext
:
IMainContext
,
extHostDocumentsAndEditors
:
ExtHostDocumentsAndEditors
,
)
{
super
();
this
.
_proxy
=
threadService
.
get
(
MainContext
.
MainThreadEditors
);
this
.
_proxy
=
mainContext
.
get
(
MainContext
.
MainThreadEditors
);
this
.
_extHostDocumentsAndEditors
=
extHostDocumentsAndEditors
;
this
.
_extHostDocumentsAndEditors
.
onDidChangeVisibleTextEditors
(
e
=>
this
.
_onDidChangeVisibleTextEditors
.
fire
(
e
));
...
...
src/vs/workbench/api/node/extHostWorkspace.ts
浏览文件 @
1c563f88
...
...
@@ -10,11 +10,10 @@ import { normalize } from 'vs/base/common/paths';
import
{
delta
}
from
'
vs/base/common/arrays
'
;
import
{
relative
,
basename
}
from
'
path
'
;
import
{
Workspace
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IThreadService
}
from
'
vs/workbench/services/thread/common/threadService
'
;
import
{
IResourceEdit
}
from
'
vs/editor/common/services/bulkEdit
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
fromRange
,
EndOfLine
}
from
'
vs/workbench/api/node/extHostTypeConverters
'
;
import
{
IWorkspaceData
,
ExtHostWorkspaceShape
,
MainContext
,
MainThreadWorkspaceShape
}
from
'
./extHost.protocol
'
;
import
{
IWorkspaceData
,
ExtHostWorkspaceShape
,
MainContext
,
MainThreadWorkspaceShape
,
IMainContext
}
from
'
./extHost.protocol
'
;
import
*
as
vscode
from
'
vscode
'
;
import
{
compare
}
from
"
vs/base/common/strings
"
;
import
{
asWinJsPromise
}
from
'
vs/base/common/async
'
;
...
...
@@ -76,9 +75,9 @@ export class ExtHostWorkspace extends ExtHostWorkspaceShape {
readonly
onDidChangeWorkspace
:
Event
<
vscode
.
WorkspaceFoldersChangeEvent
>
=
this
.
_onDidChangeWorkspace
.
event
;
constructor
(
threadService
:
IThreadService
,
data
:
IWorkspaceData
)
{
constructor
(
mainContext
:
IMainContext
,
data
:
IWorkspaceData
)
{
super
();
this
.
_proxy
=
threadService
.
get
(
MainContext
.
MainThreadWorkspace
);
this
.
_proxy
=
mainContext
.
get
(
MainContext
.
MainThreadWorkspace
);
this
.
_workspace
=
Workspace2
.
fromData
(
data
);
}
...
...
src/vs/workbench/electron-browser/window.ts
浏览文件 @
1c563f88
...
...
@@ -341,7 +341,7 @@ export class ElectronWindow extends Themable {
}
private
resolveKeybindings
(
actionIds
:
string
[]):
TPromise
<
{
id
:
string
;
label
:
string
,
isNative
:
boolean
;
}[]
>
{
return
this
.
partService
.
joinCreation
(
).
then
(()
=>
{
return
TPromise
.
join
([
this
.
partService
.
joinCreation
(),
this
.
extensionService
.
onReady
()]
).
then
(()
=>
{
return
arrays
.
coalesce
(
actionIds
.
map
(
id
=>
{
const
binding
=
this
.
keybindingService
.
lookupKeybinding
(
id
);
if
(
!
binding
)
{
...
...
src/vs/workbench/parts/debug/electron-browser/debugService.ts
浏览文件 @
1c563f88
...
...
@@ -839,7 +839,7 @@ export class DebugService implements debug.IDebugService {
this
.
extensionService
.
activateByEvent
(
`onDebug:
${
configuration
.
type
}
`
).
done
(
null
,
errors
.
onUnexpectedError
);
this
.
inDebugMode
.
set
(
true
);
this
.
debugType
.
set
(
configuration
.
type
);
this
.
isNodeDebugType
.
set
(
configuration
.
type
===
'
node
'
||
configuration
.
type
===
'
node2
'
||
configuration
.
type
===
'
extensionHost
'
);
this
.
isNodeDebugType
.
set
(
configuration
.
type
===
'
node
'
||
configuration
.
type
===
'
node2
'
||
configuration
.
type
===
'
extensionHost
'
||
configuration
.
type
===
'
chrome
'
);
if
(
this
.
model
.
getProcesses
().
length
>
1
)
{
this
.
viewModel
.
setMultiProcessView
(
true
);
}
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts
浏览文件 @
1c563f88
...
...
@@ -890,6 +890,9 @@ export class TerminalInstance implements ITerminalInstance {
}
public
setTitle
(
title
:
string
,
eventFromProcess
:
boolean
):
void
{
if
(
!
title
)
{
return
;
}
if
(
eventFromProcess
)
{
title
=
path
.
basename
(
title
);
if
(
platform
.
isWindows
)
{
...
...
src/vs/workbench/parts/terminal/electron-browser/windowsShellHelper.ts
浏览文件 @
1c563f88
...
...
@@ -5,6 +5,7 @@
import
*
as
cp
from
'
child_process
'
;
import
*
as
platform
from
'
vs/base/common/platform
'
;
import
*
as
pfs
from
'
vs/base/node/pfs
'
;
import
*
as
path
from
'
path
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
Emitter
,
debounceEvent
}
from
'
vs/base/common/event
'
;
...
...
@@ -54,23 +55,27 @@ export class WindowsShellHelper {
private
getChildProcessDetails
(
pid
:
number
):
TPromise
<
{
executable
:
string
,
pid
:
number
}[]
>
{
return
new
TPromise
((
resolve
,
reject
)
=>
{
this
.
_wmicProcess
=
cp
.
execFile
(
'
wmic.exe
'
,
[
'
process
'
,
'
where
'
,
`parentProcessId=
${
pid
}
`
,
'
get
'
,
'
ExecutablePath,ProcessId
'
],
(
err
,
stdout
,
stderr
)
=>
{
this
.
_wmicProcess
=
null
;
if
(
this
.
_isDisposed
)
{
reject
(
null
);
}
if
(
err
)
{
reject
(
err
);
}
else
if
(
stderr
.
length
>
0
)
{
resolve
([]);
// No processes found
}
else
{
const
childProcessLines
=
stdout
.
split
(
'
\n
'
).
slice
(
1
).
filter
(
str
=>
!
/^
\s
*$/
.
test
(
str
));
const
childProcessDetails
=
childProcessLines
.
map
(
str
=>
{
const
s
=
str
.
split
(
'
'
);
return
{
executable
:
s
[
0
],
pid
:
Number
(
s
[
1
])
};
});
resolve
(
childProcessDetails
);
}
const
is32ProcessOn64Windows
=
process
.
env
.
hasOwnProperty
(
'
PROCESSOR_ARCHITEW6432
'
);
const
wmicPath
=
`
${
process
.
env
.
windir
}
\
\$
{is32ProcessOn64Windows ? 'Sysnative' : 'System32'}\\wbem\\wmic.exe`
;
pfs
.
fileExists
(
wmicPath
).
then
(()
=>
{
this
.
_wmicProcess
=
cp
.
execFile
(
wmicPath
,
[
'
process
'
,
'
where
'
,
`parentProcessId=
${
pid
}
`
,
'
get
'
,
'
ExecutablePath,ProcessId
'
],
(
err
,
stdout
,
stderr
)
=>
{
this
.
_wmicProcess
=
null
;
if
(
this
.
_isDisposed
)
{
reject
(
null
);
}
if
(
err
)
{
reject
(
err
);
}
else
if
(
stderr
.
length
>
0
)
{
resolve
([]);
// No processes found
}
else
{
const
childProcessLines
=
stdout
.
split
(
'
\n
'
).
slice
(
1
).
filter
(
str
=>
!
/^
\s
*$/
.
test
(
str
));
const
childProcessDetails
=
childProcessLines
.
map
(
str
=>
{
const
s
=
str
.
split
(
'
'
);
return
{
executable
:
s
[
0
],
pid
:
Number
(
s
[
1
])
};
});
resolve
(
childProcessDetails
);
}
});
});
});
}
...
...
src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts
浏览文件 @
1c563f88
...
...
@@ -31,6 +31,7 @@ import { ExtHostDocumentsAndEditors } from 'vs/workbench/api/node/extHostDocumen
import
{
MainContext
,
ExtHostContext
}
from
'
vs/workbench/api/node/extHost.protocol
'
;
import
{
ExtHostDiagnostics
}
from
'
vs/workbench/api/node/extHostDiagnostics
'
;
import
*
as
vscode
from
'
vscode
'
;
import
{
IInstantiationService
}
from
"
vs/platform/instantiation/common/instantiation
"
;
const
defaultSelector
=
{
scheme
:
'
far
'
};
const
model
:
EditorCommon
.
IModel
=
EditorModel
.
createFromString
(
...
...
@@ -57,40 +58,45 @@ suite('ExtHostLanguageFeatureCommands', function () {
originalErrorHandler
=
errorHandler
.
getUnexpectedErrorHandler
();
setUnexpectedErrorHandler
(()
=>
{
});
let
instantiationService
=
new
TestInstantiationService
();
threadService
=
new
TestThreadService
();
instantiationService
.
stub
(
IHeapService
,
{
_serviceBrand
:
undefined
,
trackRecursive
(
args
)
{
// nothing
return
args
;
}
});
instantiationService
.
stub
(
ICommandService
,
{
_serviceBrand
:
undefined
,
executeCommand
(
id
,
args
):
any
{
if
(
!
CommandsRegistry
.
getCommands
()[
id
])
{
return
TPromise
.
wrapError
(
new
Error
(
id
+
'
NOT known
'
));
// Use IInstantiationService to get typechecking when instantiating
let
inst
:
IInstantiationService
;
{
let
instantiationService
=
new
TestInstantiationService
();
threadService
=
new
TestThreadService
();
instantiationService
.
stub
(
IHeapService
,
{
_serviceBrand
:
undefined
,
trackRecursive
(
args
)
{
// nothing
return
args
;
}
let
{
handler
}
=
CommandsRegistry
.
getCommands
()[
id
];
return
TPromise
.
as
(
instantiationService
.
invokeFunction
(
handler
,
args
));
}
});
instantiationService
.
stub
(
IMarkerService
,
new
MarkerService
());
instantiationService
.
stub
(
IThreadService
,
threadService
);
instantiationService
.
stub
(
IModelService
,
<
IModelService
>
{
_serviceBrand
:
IModelService
,
getModel
():
any
{
return
model
;
},
createModel
():
any
{
throw
new
Error
();
},
updateModel
():
any
{
throw
new
Error
();
},
setMode
():
any
{
throw
new
Error
();
},
destroyModel
():
any
{
throw
new
Error
();
},
getModels
():
any
{
throw
new
Error
();
},
onModelAdded
:
undefined
,
onModelModeChanged
:
undefined
,
onModelRemoved
:
undefined
,
getCreationOptions
():
any
{
throw
new
Error
();
}
});
});
instantiationService
.
stub
(
ICommandService
,
{
_serviceBrand
:
undefined
,
executeCommand
(
id
,
args
):
any
{
if
(
!
CommandsRegistry
.
getCommands
()[
id
])
{
return
TPromise
.
wrapError
(
new
Error
(
id
+
'
NOT known
'
));
}
let
{
handler
}
=
CommandsRegistry
.
getCommands
()[
id
];
return
TPromise
.
as
(
instantiationService
.
invokeFunction
(
handler
,
args
));
}
});
instantiationService
.
stub
(
IMarkerService
,
new
MarkerService
());
instantiationService
.
stub
(
IThreadService
,
threadService
);
instantiationService
.
stub
(
IModelService
,
<
IModelService
>
{
_serviceBrand
:
IModelService
,
getModel
():
any
{
return
model
;
},
createModel
():
any
{
throw
new
Error
();
},
updateModel
():
any
{
throw
new
Error
();
},
setMode
():
any
{
throw
new
Error
();
},
destroyModel
():
any
{
throw
new
Error
();
},
getModels
():
any
{
throw
new
Error
();
},
onModelAdded
:
undefined
,
onModelModeChanged
:
undefined
,
onModelRemoved
:
undefined
,
getCreationOptions
():
any
{
throw
new
Error
();
}
});
inst
=
instantiationService
;
}
const
extHostDocumentsAndEditors
=
new
ExtHostDocumentsAndEditors
(
threadService
);
extHostDocumentsAndEditors
.
$acceptDocumentsAndEditorsDelta
({
...
...
@@ -110,7 +116,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
commands
=
new
ExtHostCommands
(
threadService
,
heapService
);
threadService
.
set
(
ExtHostContext
.
ExtHostCommands
,
commands
);
threadService
.
setTestInstance
(
MainContext
.
MainThreadCommands
,
inst
antiationService
.
createInstance
(
MainThreadCommands
));
threadService
.
setTestInstance
(
MainContext
.
MainThreadCommands
,
inst
.
createInstance
(
MainThreadCommands
,
threadService
));
ExtHostApiCommands
.
register
(
commands
);
const
diagnostics
=
new
ExtHostDiagnostics
(
threadService
);
...
...
@@ -119,7 +125,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
extHost
=
new
ExtHostLanguageFeatures
(
threadService
,
extHostDocuments
,
commands
,
heapService
,
diagnostics
);
threadService
.
set
(
ExtHostContext
.
ExtHostLanguageFeatures
,
extHost
);
mainThread
=
threadService
.
setTestInstance
(
MainContext
.
MainThreadLanguageFeatures
,
instantiationService
.
createInstance
(
MainThreadLanguageFeatures
));
mainThread
=
<
MainThreadLanguageFeatures
>
threadService
.
setTestInstance
(
MainContext
.
MainThreadLanguageFeatures
,
inst
.
createInstance
(
MainThreadLanguageFeatures
));
threadService
.
sync
().
then
(
done
,
done
);
});
...
...
src/vs/workbench/test/electron-browser/api/extHostDocumentsAndEditors.test.ts
浏览文件 @
1c563f88
...
...
@@ -17,9 +17,7 @@ suite('ExtHostDocumentsAndEditors', () => {
setup
(
function
()
{
editors
=
new
ExtHostDocumentsAndEditors
({
_serviceBrand
:
undefined
,
get
()
{
return
undefined
;
},
set
()
{
}
get
()
{
return
undefined
;
}
});
});
...
...
src/vs/workbench/test/electron-browser/api/extHostLanguageFeatures.test.ts
浏览文件 @
1c563f88
...
...
@@ -44,6 +44,7 @@ import { MainContext, ExtHostContext } from 'vs/workbench/api/node/extHost.proto
import
{
ExtHostDiagnostics
}
from
'
vs/workbench/api/node/extHostDiagnostics
'
;
import
{
ExtHostHeapService
}
from
'
vs/workbench/api/node/extHostHeapService
'
;
import
*
as
vscode
from
'
vscode
'
;
import
{
IInstantiationService
}
from
"
vs/platform/instantiation/common/instantiation
"
;
const
defaultSelector
=
{
scheme
:
'
far
'
};
const
model
:
EditorCommon
.
IModel
=
EditorModel
.
createFromString
(
...
...
@@ -67,16 +68,22 @@ suite('ExtHostLanguageFeatures', function () {
suiteSetup
(()
=>
{
threadService
=
new
TestThreadService
();
let
instantiationService
=
new
TestInstantiationService
();
instantiationService
.
stub
(
IThreadService
,
threadService
);
instantiationService
.
stub
(
IMarkerService
,
MarkerService
);
instantiationService
.
stub
(
IHeapService
,
{
_serviceBrand
:
undefined
,
trackRecursive
(
args
)
{
// nothing
return
args
;
}
});
// Use IInstantiationService to get typechecking when instantiating
let
inst
:
IInstantiationService
;
{
let
instantiationService
=
new
TestInstantiationService
();
instantiationService
.
stub
(
IThreadService
,
threadService
);
instantiationService
.
stub
(
IMarkerService
,
MarkerService
);
instantiationService
.
stub
(
IHeapService
,
{
_serviceBrand
:
undefined
,
trackRecursive
(
args
)
{
// nothing
return
args
;
}
});
inst
=
instantiationService
;
}
originalErrorHandler
=
errorHandler
.
getUnexpectedErrorHandler
();
setUnexpectedErrorHandler
(()
=>
{
});
...
...
@@ -99,7 +106,7 @@ suite('ExtHostLanguageFeatures', function () {
const
commands
=
new
ExtHostCommands
(
threadService
,
heapService
);
threadService
.
set
(
ExtHostContext
.
ExtHostCommands
,
commands
);
threadService
.
setTestInstance
(
MainContext
.
MainThreadCommands
,
inst
antiationService
.
createInstance
(
MainThreadCommands
));
threadService
.
setTestInstance
(
MainContext
.
MainThreadCommands
,
inst
.
createInstance
(
MainThreadCommands
,
threadService
));
const
diagnostics
=
new
ExtHostDiagnostics
(
threadService
);
threadService
.
set
(
ExtHostContext
.
ExtHostDiagnostics
,
diagnostics
);
...
...
@@ -107,7 +114,7 @@ suite('ExtHostLanguageFeatures', function () {
extHost
=
new
ExtHostLanguageFeatures
(
threadService
,
extHostDocuments
,
commands
,
heapService
,
diagnostics
);
threadService
.
set
(
ExtHostContext
.
ExtHostLanguageFeatures
,
extHost
);
mainThread
=
<
MainThreadLanguageFeatures
>
threadService
.
setTestInstance
(
MainContext
.
MainThreadLanguageFeatures
,
inst
antiationService
.
createInstance
(
MainThreadLanguageFeatures
));
mainThread
=
<
MainThreadLanguageFeatures
>
threadService
.
setTestInstance
(
MainContext
.
MainThreadLanguageFeatures
,
inst
.
createInstance
(
MainThreadLanguageFeatures
));
});
suiteTeardown
(()
=>
{
...
...
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
浏览文件 @
1c563f88
...
...
@@ -16,6 +16,7 @@ import { ExtHostHeapService } from 'vs/workbench/api/node/extHostHeapService';
import
{
TestInstantiationService
}
from
'
vs/platform/instantiation/test/common/instantiationServiceMock
'
;
import
{
IThreadService
}
from
'
vs/workbench/services/thread/common/threadService
'
;
import
{
MainThreadCommands
}
from
'
vs/workbench/api/electron-browser/mainThreadCommands
'
;
import
{
IInstantiationService
}
from
"
vs/platform/instantiation/common/instantiation
"
;
suite
(
'
ExtHostConfiguration
'
,
function
()
{
...
...
@@ -38,10 +39,15 @@ suite('ExtHostConfiguration', function () {
setup
(()
=>
{
let
threadService
=
new
TestThreadService
();
let
instantiationService
=
new
TestInstantiationService
();
instantiationService
.
stub
(
IThreadService
,
threadService
);
// Use IInstantiationService to get typechecking when instantiating
let
inst
:
IInstantiationService
;
{
let
instantiationService
=
new
TestInstantiationService
();
instantiationService
.
stub
(
IThreadService
,
threadService
);
inst
=
instantiationService
;
}
threadService
.
setTestInstance
(
MainContext
.
MainThreadCommands
,
inst
antiationService
.
createInstance
(
MainThreadCommands
));
threadService
.
setTestInstance
(
MainContext
.
MainThreadCommands
,
inst
.
createInstance
(
MainThreadCommands
,
threadService
));
target
=
new
RecordingShape
();
testObject
=
new
ExtHostTreeViews
(
target
,
new
ExtHostCommands
(
threadService
,
new
ExtHostHeapService
()));
onDidChangeTreeData
=
new
Emitter
<
string
>
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录