Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
2a3d7976
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2a3d7976
编写于
7月 29, 2016
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debt - editor links should use opener service, #9906
上级
659c24cb
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
20 addition
and
42 deletion
+20
-42
src/vs/editor/browser/standalone/standaloneEditor.ts
src/vs/editor/browser/standalone/standaloneEditor.ts
+5
-0
src/vs/editor/browser/standalone/standaloneServices.ts
src/vs/editor/browser/standalone/standaloneServices.ts
+5
-0
src/vs/editor/contrib/links/browser/links.ts
src/vs/editor/contrib/links/browser/links.ts
+10
-42
未找到文件。
src/vs/editor/browser/standalone/standaloneEditor.ts
浏览文件 @
2a3d7976
...
...
@@ -18,6 +18,7 @@ import {TPromise} from 'vs/base/common/winjs.base';
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
ServiceCollection
}
from
'
vs/platform/instantiation/common/serviceCollection
'
;
import
{
InstantiationService
}
from
'
vs/platform/instantiation/common/instantiationService
'
;
import
{
OpenerService
}
from
'
vs/platform/opener/browser/openerService
'
;
import
{
IModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
Colorizer
,
IColorizerElementOptions
,
IColorizerOptions
}
from
'
vs/editor/browser/standalone/colorizer
'
;
...
...
@@ -61,6 +62,10 @@ export function create(domElement:HTMLElement, options?:IEditorConstructionOptio
services
.
editorService
=
editorService
;
}
if
(
!
services
.
openerService
)
{
services
.
openerService
=
new
OpenerService
(
editorService
,
services
.
commandService
);
}
var
t
=
prepareServices
(
domElement
,
services
);
var
result
=
t
.
ctx
.
instantiationService
.
createInstance
(
StandaloneEditor
,
domElement
,
options
,
t
.
toDispose
);
...
...
src/vs/editor/browser/standalone/standaloneServices.ts
浏览文件 @
2a3d7976
...
...
@@ -19,6 +19,7 @@ import {InstantiationService} from 'vs/platform/instantiation/common/instantiati
import
{
ServiceCollection
}
from
'
vs/platform/instantiation/common/serviceCollection
'
;
import
{
ICommandService
}
from
'
vs/platform/commands/common/commands
'
;
import
{
CommandService
}
from
'
vs/platform/commands/common/commandService
'
;
import
{
IOpenerService
}
from
'
vs/platform/opener/common/opener
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
MarkerService
}
from
'
vs/platform/markers/common/markerService
'
;
import
{
IMarkerService
}
from
'
vs/platform/markers/common/markers
'
;
...
...
@@ -84,6 +85,10 @@ export interface IEditorOverrideServices {
* @internal
*/
commandService
?:
ICommandService
;
/**
* @internal
*/
openerService
?:
IOpenerService
;
/**
* @internal
*/
...
...
src/vs/editor/contrib/links/browser/links.ts
浏览文件 @
2a3d7976
...
...
@@ -14,8 +14,8 @@ import Severity from 'vs/base/common/severity';
import
URI
from
'
vs/base/common/uri
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IKeyboardEvent
}
from
'
vs/base/browser/keyboardEvent
'
;
import
{
IEditorService
,
IResourceInput
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IMessageService
}
from
'
vs/platform/message/common/message
'
;
import
{
IOpenerService
}
from
'
vs/platform/opener/common/opener
'
;
import
{
EditorAction
}
from
'
vs/editor/common/editorAction
'
;
import
{
Behaviour
}
from
'
vs/editor/common/editorActionEnablement
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
...
...
@@ -94,19 +94,19 @@ class LinkDetector implements editorCommon.IEditorContribution {
private
computePromise
:
TPromise
<
void
>
;
private
activeLinkDecorationId
:
string
;
private
lastMouseEvent
:
IEditorMouseEvent
;
private
editorService
:
IEdito
rService
;
private
openerService
:
IOpene
rService
;
private
messageService
:
IMessageService
;
private
editorWorkerService
:
IEditorWorkerService
;
private
currentOccurences
:{
[
decorationId
:
string
]:
LinkOccurence
;
};
constructor
(
editor
:
ICodeEditor
,
@
I
EditorService
editorService
:
IEdito
rService
,
@
I
OpenerService
openerService
:
IOpene
rService
,
@
IMessageService
messageService
:
IMessageService
,
@
IEditorWorkerService
editorWorkerService
:
IEditorWorkerService
)
{
this
.
editor
=
editor
;
this
.
editorService
=
edito
rService
;
this
.
openerService
=
opene
rService
;
this
.
messageService
=
messageService
;
this
.
editorWorkerService
=
editorWorkerService
;
this
.
listenersToRemove
=
[];
...
...
@@ -253,54 +253,22 @@ class LinkDetector implements editorCommon.IEditorContribution {
this
.
openLinkOccurence
(
occurence
,
mouseEvent
.
event
.
altKey
);
}
public
openLinkOccurence
(
occurence
:
LinkOccurence
,
openToSide
:
boolean
):
void
{
public
openLinkOccurence
(
occurence
:
LinkOccurence
,
openToSide
:
boolean
):
void
{
if
(
!
this
.
edito
rService
)
{
if
(
!
this
.
opene
rService
)
{
return
;
}
var
link
=
occurence
.
link
;
var
absoluteUrl
=
link
.
url
;
var
hashIndex
=
absoluteUrl
.
indexOf
(
'
#
'
);
var
lineNumber
=
-
1
;
var
column
=
-
1
;
if
(
hashIndex
>=
0
)
{
var
hash
=
absoluteUrl
.
substr
(
hashIndex
+
1
);
var
selection
=
hash
.
split
(
'
,
'
);
if
(
selection
.
length
>
0
)
{
lineNumber
=
Number
(
selection
[
0
]);
}
if
(
selection
.
length
>
1
)
{
column
=
Number
(
selection
[
1
]);
}
if
(
lineNumber
>=
0
||
column
>=
0
)
{
absoluteUrl
=
absoluteUrl
.
substr
(
0
,
hashIndex
);
}
}
var
url
:
URI
;
let
url
:
URI
;
try
{
url
=
URI
.
parse
(
absoluteU
rl
);
url
=
URI
.
parse
(
occurence
.
link
.
u
rl
);
}
catch
(
err
)
{
// invalid url
this
.
messageService
.
show
(
Severity
.
Warning
,
nls
.
localize
(
'
invalid.url
'
,
'
Invalid URI: cannot open {0}
'
,
absoluteU
rl
));
this
.
messageService
.
show
(
Severity
.
Warning
,
nls
.
localize
(
'
invalid.url
'
,
'
Invalid URI: cannot open {0}
'
,
occurence
.
link
.
u
rl
));
return
;
}
var
input
:
IResourceInput
=
{
resource
:
url
};
if
(
lineNumber
>=
0
)
{
input
.
options
=
{
selection
:
{
startLineNumber
:
lineNumber
,
startColumn
:
column
}
};
}
this
.
editorService
.
openEditor
(
input
,
openToSide
).
done
(
null
,
onUnexpectedError
);
this
.
openerService
.
open
(
url
,
{
openToSide
}).
done
(
null
,
onUnexpectedError
);
}
public
getLinkOccurence
(
position
:
editorCommon
.
IPosition
):
LinkOccurence
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录