Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
6a13b526
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,发现更多精彩内容 >>
提交
6a13b526
编写于
5月 17, 2018
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
grid - make code editor service proper (standalone)
上级
e01a7836
变更
12
显示空白变更内容
内联
并排
Showing
12 changed file
with
36 addition
and
64 deletion
+36
-64
src/vs/editor/browser/services/abstractCodeEditorService.ts
src/vs/editor/browser/services/abstractCodeEditorService.ts
+1
-1
src/vs/editor/browser/services/codeEditorService.ts
src/vs/editor/browser/services/codeEditorService.ts
+1
-1
src/vs/editor/browser/services/codeEditorServiceImpl.ts
src/vs/editor/browser/services/codeEditorServiceImpl.ts
+1
-1
src/vs/editor/browser/services/openerService.ts
src/vs/editor/browser/services/openerService.ts
+1
-1
src/vs/editor/contrib/goToDefinition/goToDefinitionCommands.ts
...s/editor/contrib/goToDefinition/goToDefinitionCommands.ts
+5
-5
src/vs/editor/contrib/gotoError/gotoError.ts
src/vs/editor/contrib/gotoError/gotoError.ts
+2
-2
src/vs/editor/contrib/referenceSearch/referencesController.ts
...vs/editor/contrib/referenceSearch/referencesController.ts
+2
-2
src/vs/editor/standalone/browser/standaloneCodeServiceImpl.ts
...vs/editor/standalone/browser/standaloneCodeServiceImpl.ts
+19
-47
src/vs/editor/test/browser/editorTestServices.ts
src/vs/editor/test/browser/editorTestServices.ts
+1
-1
src/vs/editor/test/browser/services/decorationRenderOptions.test.ts
...tor/test/browser/services/decorationRenderOptions.test.ts
+1
-1
src/vs/workbench/services/codeEditor/browser/codeEditorService.ts
...orkbench/services/codeEditor/browser/codeEditorService.ts
+1
-1
src/vs/workbench/test/workbenchTestServices.ts
src/vs/workbench/test/workbenchTestServices.ts
+1
-1
未找到文件。
src/vs/editor/browser/services/abstractCodeEditorService.ts
浏览文件 @
6a13b526
...
...
@@ -134,7 +134,7 @@ export abstract class AbstractCodeEditorService implements ICodeEditorService {
}
abstract
getActiveCodeEditor
():
ICodeEditor
;
abstract
openCodeEditor
(
input
:
IResourceInput
,
sideBySide
?:
boolean
):
TPromise
<
ICodeEditor
>
;
abstract
openCodeEditor
(
input
:
IResourceInput
,
s
ource
:
ICodeEditor
,
s
ideBySide
?:
boolean
):
TPromise
<
ICodeEditor
>
;
}
export
class
ModelTransientSettingWatcher
{
...
...
src/vs/editor/browser/services/codeEditorService.ts
浏览文件 @
6a13b526
...
...
@@ -44,7 +44,7 @@ export interface ICodeEditorService {
getTransientModelProperty
(
model
:
ITextModel
,
key
:
string
):
any
;
getActiveCodeEditor
():
ICodeEditor
;
openCodeEditor
(
input
:
IResourceInput
,
sideBySide
?:
boolean
):
TPromise
<
ICodeEditor
>
;
openCodeEditor
(
input
:
IResourceInput
,
s
ource
:
ICodeEditor
,
s
ideBySide
?:
boolean
):
TPromise
<
ICodeEditor
>
;
}
/**
...
...
src/vs/editor/browser/services/codeEditorServiceImpl.ts
浏览文件 @
6a13b526
...
...
@@ -69,7 +69,7 @@ export abstract class CodeEditorServiceImpl extends AbstractCodeEditorService {
}
abstract
getActiveCodeEditor
():
ICodeEditor
;
abstract
openCodeEditor
(
input
:
IResourceInput
,
sideBySide
?:
boolean
):
TPromise
<
ICodeEditor
>
;
abstract
openCodeEditor
(
input
:
IResourceInput
,
s
ource
:
ICodeEditor
,
s
ideBySide
?:
boolean
):
TPromise
<
ICodeEditor
>
;
}
interface
IModelDecorationOptionsProvider
extends
IDisposable
{
...
...
src/vs/editor/browser/services/openerService.ts
浏览文件 @
6a13b526
...
...
@@ -81,7 +81,7 @@ export class OpenerService implements IOpenerService {
}
else
if
(
resource
.
scheme
===
Schemas
.
file
)
{
resource
=
resource
.
with
({
path
:
normalize
(
resource
.
path
)
});
// workaround for non-normalized paths (https://github.com/Microsoft/vscode/issues/12954)
}
promise
=
this
.
_editorService
.
openCodeEditor
({
resource
,
options
:
{
selection
,
}
},
options
&&
options
.
openToSide
);
promise
=
this
.
_editorService
.
openCodeEditor
({
resource
,
options
:
{
selection
,
}
},
this
.
_editorService
.
getFocusedCodeEditor
(),
options
&&
options
.
openToSide
);
}
return
promise
;
...
...
src/vs/editor/contrib/goToDefinition/goToDefinitionCommands.ts
浏览文件 @
6a13b526
...
...
@@ -95,7 +95,7 @@ export class DefinitionAction extends EditorAction {
}
else
if
(
result
.
length
===
1
&&
idxOfCurrent
!==
-
1
)
{
// only the position at which we are -> adjust selection
let
[
current
]
=
result
;
this
.
_openReference
(
editorService
,
current
,
false
);
this
.
_openReference
(
editor
,
editor
Service
,
current
,
false
);
}
else
{
// handle multile results
...
...
@@ -134,7 +134,7 @@ export class DefinitionAction extends EditorAction {
this
.
_openInPeek
(
editorService
,
editor
,
model
);
}
else
{
let
next
=
model
.
nearestReference
(
editor
.
getModel
().
uri
,
editor
.
getPosition
());
this
.
_openReference
(
editorService
,
next
,
this
.
_configuration
.
openToSide
).
then
(
editor
=>
{
this
.
_openReference
(
editor
,
editor
Service
,
next
,
this
.
_configuration
.
openToSide
).
then
(
editor
=>
{
if
(
editor
&&
model
.
references
.
length
>
1
)
{
this
.
_openInPeek
(
editorService
,
editor
,
model
);
}
else
{
...
...
@@ -144,7 +144,7 @@ export class DefinitionAction extends EditorAction {
}
}
private
_openReference
(
editorService
:
ICodeEditorService
,
reference
:
Location
,
sideBySide
:
boolean
):
TPromise
<
ICodeEditor
>
{
private
_openReference
(
editor
:
ICodeEditor
,
editor
Service
:
ICodeEditorService
,
reference
:
Location
,
sideBySide
:
boolean
):
TPromise
<
ICodeEditor
>
{
let
{
uri
,
range
}
=
reference
;
return
editorService
.
openCodeEditor
({
resource
:
uri
,
...
...
@@ -153,7 +153,7 @@ export class DefinitionAction extends EditorAction {
revealIfVisible
:
true
,
revealInCenterIfOutsideViewport
:
true
}
},
sideBySide
);
},
editor
,
sideBySide
);
}
private
_openInPeek
(
editorService
:
ICodeEditorService
,
target
:
ICodeEditor
,
model
:
ReferencesModel
)
{
...
...
@@ -165,7 +165,7 @@ export class DefinitionAction extends EditorAction {
},
onGoto
:
(
reference
)
=>
{
controller
.
closeWidget
();
return
this
.
_openReference
(
editorService
,
reference
,
false
);
return
this
.
_openReference
(
target
,
editorService
,
reference
,
false
);
}
});
}
else
{
...
...
src/vs/editor/contrib/gotoError/gotoError.ts
浏览文件 @
6a13b526
...
...
@@ -242,7 +242,7 @@ class MarkerController implements editorCommon.IEditorContribution {
this
.
_editorService
.
openCodeEditor
({
resource
:
related
.
resource
,
options
:
{
pinned
:
true
,
revealIfOpened
:
true
,
selection
:
Range
.
lift
(
related
).
collapseToStart
()
}
}).
then
(
undefined
,
onUnexpectedError
);
}
,
this
.
_editor
).
then
(
undefined
,
onUnexpectedError
);
this
.
closeMarkersNavigation
(
false
);
}));
this
.
_disposeOnClose
.
push
(
this
.
_editor
.
onDidChangeModel
(()
=>
this
.
_cleanUp
()));
...
...
@@ -350,7 +350,7 @@ class MarkerNavigationAction extends EditorAction {
return
editorService
.
openCodeEditor
({
resource
:
newMarker
.
resource
,
options
:
{
pinned
:
false
,
revealIfOpened
:
true
,
revealInCenterIfOutsideViewport
:
true
,
selection
:
newMarker
}
}).
then
(
editor
=>
{
}
,
editor
).
then
(
editor
=>
{
if
(
!
editor
)
{
return
undefined
;
}
...
...
src/vs/editor/contrib/referenceSearch/referencesController.ts
浏览文件 @
6a13b526
...
...
@@ -212,7 +212,7 @@ export abstract class ReferencesController implements editorCommon.IEditorContri
return
this
.
_editorService
.
openCodeEditor
({
resource
:
ref
.
uri
,
options
:
{
selection
:
range
}
}).
then
(
openedEditor
=>
{
}
,
this
.
_editor
).
then
(
openedEditor
=>
{
this
.
_ignoreModelChangeEvent
=
false
;
if
(
!
openedEditor
||
openedEditor
!==
this
.
_editor
)
{
...
...
@@ -241,7 +241,7 @@ export abstract class ReferencesController implements editorCommon.IEditorContri
this
.
_editorService
.
openCodeEditor
({
resource
:
uri
,
options
:
{
selection
:
range
}
},
sideBySide
);
},
this
.
_editor
,
sideBySide
);
// clear stage
if
(
!
sideBySide
)
{
...
...
src/vs/editor/standalone/browser/standaloneCodeServiceImpl.ts
浏览文件 @
6a13b526
...
...
@@ -6,69 +6,51 @@
import
{
IResourceInput
}
from
'
vs/platform/editor/common/editor
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
ICodeEditor
,
IDiffEditor
,
isCodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
CodeEditorServiceImpl
}
from
'
vs/editor/browser/services/codeEditorServiceImpl
'
;
import
{
IEditor
,
ScrollType
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ScrollType
}
from
'
vs/editor/common/editorCommon
'
;
import
{
windowOpenNoOpener
}
from
'
vs/base/browser/dom
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
IRange
}
from
'
vs/editor/common/core/range
'
;
import
{
ITextModel
}
from
'
vs/editor/common/model
'
;
import
URI
from
'
vs/base/common/uri
'
;
export
class
StandaloneCodeEditorServiceImpl
extends
CodeEditorServiceImpl
{
private
editor
:
IEditor
;
addCodeEditor
(
editor
:
ICodeEditor
):
void
{
super
.
addCodeEditor
(
editor
);
if
(
!
this
.
editor
)
{
this
.
editor
=
editor
;
}
}
addDiffEditor
(
editor
:
IDiffEditor
):
void
{
super
.
addDiffEditor
(
editor
);
if
(
!
this
.
editor
)
{
this
.
editor
=
editor
;
}
}
public
getActiveCodeEditor
():
ICodeEditor
{
return
null
;
// not supported in the standalone case
}
public
openCodeEditor
(
typedData
:
IResourceInput
,
sideBySide
?:
boolean
):
TPromise
<
ICodeEditor
>
{
return
TPromise
.
as
(
withTypedEditor
(
this
.
editor
,
(
editor
)
=>
this
.
doOpenEditor
(
editor
,
typedData
),
(
diffEditor
)
=>
(
this
.
doOpenEditor
(
diffEditor
.
getOriginalEditor
(),
typedData
)
||
this
.
doOpenEditor
(
diffEditor
.
getModifiedEditor
(),
typedData
)
)
));
public
openCodeEditor
(
input
:
IResourceInput
,
source
:
ICodeEditor
,
sideBySide
?:
boolean
):
TPromise
<
ICodeEditor
>
{
if
(
!
source
)
{
return
TPromise
.
as
(
null
);
}
return
TPromise
.
as
(
this
.
doOpenEditor
(
source
,
input
));
}
private
doOpenEditor
(
editor
:
ICodeEditor
,
data
:
IResourceInput
):
ICodeEditor
{
let
model
=
this
.
findModel
(
editor
,
data
);
private
doOpenEditor
(
editor
:
ICodeEditor
,
input
:
IResourceInput
):
ICodeEditor
{
const
model
=
this
.
findModel
(
editor
,
input
.
resource
);
if
(
!
model
)
{
if
(
data
.
resource
)
{
if
(
input
.
resource
)
{
let
schema
=
data
.
resource
.
scheme
;
const
schema
=
input
.
resource
.
scheme
;
if
(
schema
===
Schemas
.
http
||
schema
===
Schemas
.
https
)
{
// This is a fully qualified http or https URL
windowOpenNoOpener
(
data
.
resource
.
toString
());
windowOpenNoOpener
(
input
.
resource
.
toString
());
return
editor
;
}
}
return
null
;
}
let
selection
=
<
IRange
>
data
.
options
.
selection
;
const
selection
=
<
IRange
>
input
.
options
.
selection
;
if
(
selection
)
{
if
(
typeof
selection
.
endLineNumber
===
'
number
'
&&
typeof
selection
.
endColumn
===
'
number
'
)
{
editor
.
setSelection
(
selection
);
editor
.
revealRangeInCenter
(
selection
,
ScrollType
.
Immediate
);
}
else
{
le
t
pos
=
{
cons
t
pos
=
{
lineNumber
:
selection
.
startLineNumber
,
column
:
selection
.
startColumn
};
...
...
@@ -80,22 +62,12 @@ export class StandaloneCodeEditorServiceImpl extends CodeEditorServiceImpl {
return
editor
;
}
private
findModel
(
editor
:
ICodeEditor
,
data
:
IResourceInput
):
ITextModel
{
le
t
model
=
editor
.
getModel
();
if
(
model
.
uri
.
toString
()
!==
data
.
resource
.
toString
())
{
private
findModel
(
editor
:
ICodeEditor
,
resource
:
URI
):
ITextModel
{
cons
t
model
=
editor
.
getModel
();
if
(
model
.
uri
.
toString
()
!==
resource
.
toString
())
{
return
null
;
}
return
model
;
}
}
function
withTypedEditor
<
T
>
(
widget
:
IEditor
,
codeEditorCallback
:
(
editor
:
ICodeEditor
)
=>
T
,
diffEditorCallback
:
(
editor
:
IDiffEditor
)
=>
T
):
T
{
if
(
isCodeEditor
(
widget
))
{
// Single Editor
return
codeEditorCallback
(
<
ICodeEditor
>
widget
);
}
else
{
// Diff Editor
return
diffEditorCallback
(
<
IDiffEditor
>
widget
);
}
}
\ No newline at end of file
src/vs/editor/test/browser/editorTestServices.ts
浏览文件 @
6a13b526
...
...
@@ -17,7 +17,7 @@ import { IResourceInput } from 'vs/platform/editor/common/editor';
export
class
TestCodeEditorService
extends
AbstractCodeEditorService
{
public
lastInput
:
IResourceInput
;
public
getActiveCodeEditor
():
ICodeEditor
{
return
null
;
}
public
openCodeEditor
(
input
:
IResourceInput
,
sideBySide
?:
boolean
):
TPromise
<
ICodeEditor
>
{
public
openCodeEditor
(
input
:
IResourceInput
,
s
ource
:
ICodeEditor
,
s
ideBySide
?:
boolean
):
TPromise
<
ICodeEditor
>
{
this
.
lastInput
=
input
;
return
TPromise
.
as
(
null
);
}
...
...
src/vs/editor/test/browser/services/decorationRenderOptions.test.ts
浏览文件 @
6a13b526
...
...
@@ -21,7 +21,7 @@ export class TestCodeEditorServiceImpl extends CodeEditorServiceImpl {
return
null
;
}
openCodeEditor
(
input
:
IResourceInput
,
sideBySide
?:
boolean
):
TPromise
<
ICodeEditor
>
{
openCodeEditor
(
input
:
IResourceInput
,
s
ource
:
ICodeEditor
,
s
ideBySide
?:
boolean
):
TPromise
<
ICodeEditor
>
{
return
TPromise
.
as
(
null
);
}
}
...
...
src/vs/workbench/services/codeEditor/browser/codeEditorService.ts
浏览文件 @
6a13b526
...
...
@@ -34,7 +34,7 @@ export class CodeEditorService extends CodeEditorServiceImpl {
return
null
;
}
openCodeEditor
(
input
:
IResourceInput
,
sideBySide
?:
boolean
):
TPromise
<
ICodeEditor
>
{
openCodeEditor
(
input
:
IResourceInput
,
s
ource
:
ICodeEditor
,
s
ideBySide
?:
boolean
):
TPromise
<
ICodeEditor
>
{
return
this
.
editorService
.
openEditor
(
input
,
sideBySide
?
SIDE_GROUP
:
ACTIVE_GROUP
).
then
(
control
=>
{
if
(
control
)
{
const
widget
=
control
.
getControl
();
...
...
src/vs/workbench/test/workbenchTestServices.ts
浏览文件 @
6a13b526
...
...
@@ -1132,7 +1132,7 @@ export class TestCodeEditorService implements ICodeEditorService {
setTransientModelProperty
(
model
:
ITextModel
,
key
:
string
,
value
:
any
):
void
{
}
getTransientModelProperty
(
model
:
ITextModel
,
key
:
string
)
{
}
getActiveCodeEditor
():
ICodeEditor
{
return
null
;
}
openCodeEditor
(
input
:
IResourceInput
,
sideBySide
?:
boolean
):
TPromise
<
ICodeEditor
>
{
return
TPromise
.
as
(
null
);
}
openCodeEditor
(
input
:
IResourceInput
,
s
ource
:
ICodeEditor
,
s
ideBySide
?:
boolean
):
TPromise
<
ICodeEditor
>
{
return
TPromise
.
as
(
null
);
}
}
export
class
TestWindowService
implements
IWindowService
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录