Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
91f26f80
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,发现更多精彩内容 >>
提交
91f26f80
编写于
5月 30, 2016
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debt - refactor URI.withXYZ methods, #6678
上级
213699e0
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
17 addition
and
37 deletion
+17
-37
src/vs/base/common/uri.ts
src/vs/base/common/uri.ts
+7
-27
src/vs/base/test/common/uri.test.ts
src/vs/base/test/common/uri.test.ts
+7
-7
src/vs/editor/common/model/mirrorModel.ts
src/vs/editor/common/model/mirrorModel.ts
+1
-1
src/vs/languages/html/common/htmlWorker.ts
src/vs/languages/html/common/htmlWorker.ts
+1
-1
src/vs/workbench/parts/git/browser/gitWorkbenchContributions.ts
.../workbench/parts/git/browser/gitWorkbenchContributions.ts
+1
-1
未找到文件。
src/vs/base/common/uri.ts
浏览文件 @
91f26f80
...
...
@@ -132,37 +132,17 @@ export default class URI {
// ---- modify to new -------------------------
public
with
(
scheme
:
string
,
authority
:
string
,
path
:
string
,
query
:
string
,
fragment
:
string
):
URI
{
public
with
(
change
:
{
scheme
?:
string
;
authority
?:
string
;
path
?:
string
;
query
?:
string
;
fragment
?:
string
}
):
URI
{
var
ret
=
new
URI
();
ret
.
_scheme
=
scheme
||
this
.
scheme
;
ret
.
_authority
=
authority
||
this
.
authority
;
ret
.
_path
=
path
||
this
.
path
;
ret
.
_query
=
query
||
this
.
query
;
ret
.
_fragment
=
fragment
||
this
.
fragment
;
ret
.
_scheme
=
change
.
scheme
||
this
.
scheme
;
ret
.
_authority
=
change
.
authority
||
this
.
authority
;
ret
.
_path
=
change
.
path
||
this
.
path
;
ret
.
_query
=
change
.
query
||
this
.
query
;
ret
.
_fragment
=
change
.
fragment
||
this
.
fragment
;
URI
.
_validate
(
ret
);
return
ret
;
}
public
withScheme
(
value
:
string
):
URI
{
return
this
.
with
(
value
,
undefined
,
undefined
,
undefined
,
undefined
);
}
public
withAuthority
(
value
:
string
):
URI
{
return
this
.
with
(
undefined
,
value
,
undefined
,
undefined
,
undefined
);
}
public
withPath
(
value
:
string
):
URI
{
return
this
.
with
(
undefined
,
undefined
,
value
,
undefined
,
undefined
);
}
public
withQuery
(
value
:
string
):
URI
{
return
this
.
with
(
undefined
,
undefined
,
undefined
,
value
,
undefined
);
}
public
withFragment
(
value
:
string
):
URI
{
return
this
.
with
(
undefined
,
undefined
,
undefined
,
undefined
,
value
);
}
// ---- parse & validate ------------------------
public
static
parse
(
value
:
string
):
URI
{
...
...
@@ -232,7 +212,7 @@ export default class URI {
}
public
static
create
(
scheme
?:
string
,
authority
?:
string
,
path
?:
string
,
query
?:
string
,
fragment
?:
string
):
URI
{
return
new
URI
().
with
(
scheme
,
authority
,
path
,
query
,
fragment
);
return
new
URI
().
with
(
{
scheme
,
authority
,
path
,
query
,
fragment
}
);
}
private
static
_validate
(
ret
:
URI
):
void
{
...
...
src/vs/base/test/common/uri.test.ts
浏览文件 @
91f26f80
...
...
@@ -45,7 +45,7 @@ suite('URI', () => {
test
(
'
http#toString, encode=FALSE
'
,
()
=>
{
assert
.
equal
(
URI
.
create
(
'
http
'
,
'
a-test-site.com
'
,
'
/
'
,
'
test=true
'
).
toString
(
true
),
'
http://a-test-site.com/?test=true
'
);
assert
.
equal
(
URI
.
create
(
'
http
'
,
'
a-test-site.com
'
,
'
/
'
,
''
,
'
test=true
'
).
toString
(
true
),
'
http://a-test-site.com/#test=true
'
);
assert
.
equal
(
URI
.
create
().
with
Scheme
(
'
http
'
).
withPath
(
'
/api/files/test.me
'
).
withQuery
(
'
t=1234
'
).
toString
(
true
),
'
http:/api/files/test.me?t=1234
'
);
assert
.
equal
(
URI
.
create
().
with
({
scheme
:
'
http
'
,
path
:
'
/api/files/test.me
'
,
query
:
'
t=1234
'
}
).
toString
(
true
),
'
http:/api/files/test.me?t=1234
'
);
var
value
=
URI
.
parse
(
'
file://shares/pröjects/c%23/#l12
'
);
assert
.
equal
(
value
.
authority
,
'
shares
'
);
...
...
@@ -63,12 +63,12 @@ suite('URI', () => {
});
test
(
'
with
'
,
()
=>
{
assert
.
equal
(
URI
.
create
().
with
Scheme
(
'
http
'
).
withPath
(
'
/api/files/test.me
'
).
withQuery
(
'
t=1234
'
).
toString
(),
'
http:/api/files/test.me?t%3D1234
'
);
assert
.
equal
(
URI
.
create
().
with
(
'
http
'
,
''
,
'
/api/files/test.me
'
,
'
t=1234
'
,
''
).
toString
(),
'
http:/api/files/test.me?t%3D1234
'
);
assert
.
equal
(
URI
.
create
().
with
(
'
https
'
,
''
,
'
/api/files/test.me
'
,
'
t=1234
'
,
''
).
toString
(),
'
https:/api/files/test.me?t%3D1234
'
);
assert
.
equal
(
URI
.
create
().
with
(
'
HTTP
'
,
''
,
'
/api/files/test.me
'
,
'
t=1234
'
,
''
).
toString
(),
'
HTTP:/api/files/test.me?t%3D1234
'
);
assert
.
equal
(
URI
.
create
().
with
(
'
HTTPS
'
,
''
,
'
/api/files/test.me
'
,
'
t=1234
'
,
''
).
toString
(),
'
HTTPS:/api/files/test.me?t%3D1234
'
);
assert
.
equal
(
URI
.
create
().
with
(
'
boo
'
,
''
,
'
/api/files/test.me
'
,
'
t=1234
'
,
''
).
toString
(),
'
boo:/api/files/test.me?t%3D1234
'
);
assert
.
equal
(
URI
.
create
().
with
({
scheme
:
'
http
'
,
path
:
'
/api/files/test.me
'
,
query
:
'
t=1234
'
}
).
toString
(),
'
http:/api/files/test.me?t%3D1234
'
);
assert
.
equal
(
URI
.
create
().
with
(
{
scheme
:
'
http
'
,
authority
:
''
,
path
:
'
/api/files/test.me
'
,
query
:
'
t=1234
'
,
fragment
:
''
}
).
toString
(),
'
http:/api/files/test.me?t%3D1234
'
);
assert
.
equal
(
URI
.
create
().
with
(
{
scheme
:
'
https
'
,
authority
:
''
,
path
:
'
/api/files/test.me
'
,
query
:
'
t=1234
'
,
fragment
:
''
}
).
toString
(),
'
https:/api/files/test.me?t%3D1234
'
);
assert
.
equal
(
URI
.
create
().
with
(
{
scheme
:
'
HTTP
'
,
authority
:
''
,
path
:
'
/api/files/test.me
'
,
query
:
'
t=1234
'
,
fragment
:
''
}
).
toString
(),
'
HTTP:/api/files/test.me?t%3D1234
'
);
assert
.
equal
(
URI
.
create
().
with
(
{
scheme
:
'
HTTPS
'
,
authority
:
''
,
path
:
'
/api/files/test.me
'
,
query
:
'
t=1234
'
,
fragment
:
''
}
).
toString
(),
'
HTTPS:/api/files/test.me?t%3D1234
'
);
assert
.
equal
(
URI
.
create
().
with
(
{
scheme
:
'
boo
'
,
authority
:
''
,
path
:
'
/api/files/test.me
'
,
query
:
'
t=1234
'
,
fragment
:
''
}
).
toString
(),
'
boo:/api/files/test.me?t%3D1234
'
);
});
test
(
'
parse
'
,
()
=>
{
...
...
src/vs/editor/common/model/mirrorModel.ts
浏览文件 @
91f26f80
...
...
@@ -376,7 +376,7 @@ export class MirrorModel extends AbstractMirrorModel implements editorCommon.IMi
this
.
_embeddedModels
[
newNestedModeId
].
setIncludedRanges
(
newModesRanges
[
newNestedModeId
].
ranges
);
}
else
{
// TODO@Alex: implement derived resources (embedded mirror models) better
var
embeddedModelUrl
=
this
.
uri
.
with
Fragment
(
this
.
uri
.
fragment
+
'
URL_MARSHAL_REMOVE
'
+
newNestedModeId
);
var
embeddedModelUrl
=
this
.
uri
.
with
({
fragment
:
this
.
uri
.
fragment
+
'
URL_MARSHAL_REMOVE
'
+
newNestedModeId
}
);
this
.
_embeddedModels
[
newNestedModeId
]
=
new
MirrorModelEmbedded
(
this
,
newModesRanges
[
newNestedModeId
].
ranges
,
newModesRanges
[
newNestedModeId
].
mode
,
embeddedModelUrl
);
this
.
_resourceService
.
insert
(
this
.
_embeddedModels
[
newNestedModeId
].
uri
,
this
.
_embeddedModels
[
newNestedModeId
]);
}
...
...
src/vs/languages/html/common/htmlWorker.ts
浏览文件 @
91f26f80
...
...
@@ -548,7 +548,7 @@ export class HTMLWorker {
alternativeResultPath
=
paths
.
join
(
modelPath
,
tokenContent
);
alternativeResultPath
=
alternativeResultPath
.
replace
(
/^
(\/\.\.)
+/
,
''
);
}
let
potentialResult
=
modelAbsoluteUri
.
with
Path
(
alternativeResultPath
).
toString
();
let
potentialResult
=
modelAbsoluteUri
.
with
({
path
:
alternativeResultPath
}
).
toString
();
let
rootAbsoluteUrlStr
=
(
rootAbsoluteUri
?
rootAbsoluteUri
.
toString
()
:
null
);
if
(
rootAbsoluteUrlStr
&&
strings
.
startsWith
(
modelAbsoluteUri
.
toString
(),
rootAbsoluteUrlStr
))
{
...
...
src/vs/workbench/parts/git/browser/gitWorkbenchContributions.ts
浏览文件 @
91f26f80
...
...
@@ -166,7 +166,7 @@ class DirtyDiffModelDecorator {
this
.
gitService
=
gitService
;
this
.
model
=
model
;
this
.
_originalContentsURI
=
model
.
uri
.
with
Scheme
(
DirtyDiffModelDecorator
.
GIT_ORIGINAL_SCHEME
);
this
.
_originalContentsURI
=
model
.
uri
.
with
({
scheme
:
DirtyDiffModelDecorator
.
GIT_ORIGINAL_SCHEME
}
);
this
.
path
=
path
;
this
.
decorations
=
[];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录