Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
fbbb9061
V
Vscode
项目概览
徽霖
/
Vscode
通知
9
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,发现更多精彩内容 >>
提交
fbbb9061
编写于
8月 03, 2016
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debt - add some XYZ.isXYZ methods to the ext host types.
上级
64e3c014
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
56 addition
and
6 deletion
+56
-6
src/vs/base/common/uri.ts
src/vs/base/common/uri.ts
+14
-0
src/vs/monaco.d.ts
src/vs/monaco.d.ts
+1
-0
src/vs/workbench/api/node/extHostTypes.ts
src/vs/workbench/api/node/extHostTypes.ts
+41
-6
未找到文件。
src/vs/base/common/uri.ts
浏览文件 @
fbbb9061
...
...
@@ -39,6 +39,20 @@ function encodeNoop(str: string): string {
*/
export
default
class
URI
{
static
isUri
(
thing
:
any
):
thing
is
URI
{
if
(
thing
instanceof
URI
)
{
return
true
;
}
if
(
!
thing
)
{
return
false
;
}
return
typeof
(
<
URI
>
thing
).
authority
===
'
string
'
&&
typeof
(
<
URI
>
thing
).
fragment
===
'
string
'
&&
typeof
(
<
URI
>
thing
).
path
===
'
string
'
&&
typeof
(
<
URI
>
thing
).
query
===
'
string
'
&&
typeof
(
<
URI
>
thing
).
scheme
===
'
string
'
;
}
private
static
_empty
=
''
;
private
static
_slash
=
'
/
'
;
private
static
_regexp
=
/^
(([^
:
/
?#
]
+
?)
:
)?(\/\/([^/
?#
]
*
))?([^
?#
]
*
)(\?([^
#
]
*
))?(
#
(
.*
))?
/
;
...
...
src/vs/monaco.d.ts
浏览文件 @
fbbb9061
...
...
@@ -111,6 +111,7 @@ declare module monaco {
*
*/
export
class
Uri
{
static
isUri
(
thing
:
any
):
thing
is
Uri
;
constructor
();
/**
* scheme is the 'http' part of 'http://www.msft.com/some/path?query#fragment'.
...
...
src/vs/workbench/api/node/extHostTypes.ts
浏览文件 @
fbbb9061
...
...
@@ -63,7 +63,7 @@ export class Position {
return
result
;
}
static
is
(
other
:
any
):
other
is
Position
{
static
is
Position
(
other
:
any
):
other
is
Position
{
if
(
!
other
)
{
return
false
;
}
...
...
@@ -206,15 +206,15 @@ export class Position {
export
class
Range
{
static
is
(
thing
:
any
):
thing
is
Range
{
static
is
Range
(
thing
:
any
):
thing
is
Range
{
if
(
thing
instanceof
Range
)
{
return
true
;
}
if
(
!
thing
)
{
return
false
;
}
return
Position
.
is
((
<
Range
>
thing
).
start
)
&&
Position
.
is
((
<
Range
>
thing
.
end
));
return
Position
.
is
Position
((
<
Range
>
thing
).
start
)
&&
Position
.
is
Position
((
<
Range
>
thing
.
end
));
}
protected
_start
:
Position
;
...
...
@@ -319,7 +319,7 @@ export class Range {
if
(
!
startOrChange
)
{
start
=
this
.
start
;
}
else
if
(
Position
.
is
(
startOrChange
))
{
}
else
if
(
Position
.
is
Position
(
startOrChange
))
{
start
=
startOrChange
;
}
else
{
...
...
@@ -340,6 +340,19 @@ export class Range {
export
class
Selection
extends
Range
{
static
isSelection
(
thing
:
any
):
thing
is
Selection
{
if
(
thing
instanceof
Selection
)
{
return
true
;
}
if
(
!
thing
)
{
return
false
;
}
return
Range
.
isRange
(
thing
)
&&
Position
.
isPosition
((
<
Selection
>
thing
).
anchor
)
&&
Position
.
isPosition
((
<
Selection
>
thing
).
active
)
&&
typeof
(
<
Selection
>
thing
).
isReversed
===
'
boolean
'
;
}
private
_anchor
:
Position
;
public
get
anchor
():
Position
{
...
...
@@ -392,6 +405,17 @@ export class Selection extends Range {
export
class
TextEdit
{
static
isTextEdit
(
thing
:
any
):
thing
is
TextEdit
{
if
(
thing
instanceof
TextEdit
)
{
return
true
;
}
if
(
!
thing
)
{
return
false
;
}
return
Range
.
isRange
((
<
TextEdit
>
thing
))
&&
typeof
(
<
TextEdit
>
thing
).
newText
===
'
string
'
;
}
static
replace
(
range
:
Range
,
newText
:
string
):
TextEdit
{
return
new
TextEdit
(
range
,
newText
);
}
...
...
@@ -506,6 +530,17 @@ export enum DiagnosticSeverity {
export
class
Location
{
static
isLocation
(
thing
:
any
):
thing
is
Location
{
if
(
thing
instanceof
Location
)
{
return
true
;
}
if
(
!
thing
)
{
return
false
;
}
return
Range
.
isRange
((
<
Location
>
thing
).
range
)
&&
URI
.
isUri
((
<
Location
>
thing
).
uri
);
}
uri
:
URI
;
range
:
Range
;
...
...
@@ -791,7 +826,7 @@ export class DocumentLink {
if
(
!
(
target
instanceof
URI
))
{
throw
illegalArgument
(
'
target
'
);
}
if
(
!
Range
.
is
(
range
)
||
range
.
isEmpty
)
{
if
(
!
Range
.
is
Range
(
range
)
||
range
.
isEmpty
)
{
throw
illegalArgument
(
'
range
'
);
}
this
.
range
=
range
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录