Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
旅途_2012
vscode
提交
30886e2f
V
vscode
项目概览
旅途_2012
/
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,发现更多精彩内容 >>
未验证
提交
30886e2f
编写于
10月 24, 2019
作者:
J
Johannes Rieken
提交者:
GitHub
10月 24, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #83060 from microsoft/joh/uri-parse
Rework Uri.parse and Uri.toString
上级
525f1e47
10fe0865
变更
13
展开全部
隐藏空白更改
内联
并排
Showing
13 changed file
with
642 addition
and
305 deletion
+642
-305
src/vs/base/common/strings.ts
src/vs/base/common/strings.ts
+29
-1
src/vs/base/common/uri.ts
src/vs/base/common/uri.ts
+265
-216
src/vs/base/test/node/uri.test.ts
src/vs/base/test/node/uri.test.ts
+312
-65
src/vs/editor/browser/services/openerService.ts
src/vs/editor/browser/services/openerService.ts
+1
-1
src/vs/monaco.d.ts
src/vs/monaco.d.ts
+3
-1
src/vs/vscode.d.ts
src/vs/vscode.d.ts
+2
-2
src/vs/workbench/api/common/extHostTypeConverters.ts
src/vs/workbench/api/common/extHostTypeConverters.ts
+1
-1
src/vs/workbench/contrib/debug/test/common/debugSource.test.ts
...s/workbench/contrib/debug/test/common/debugSource.test.ts
+1
-1
src/vs/workbench/contrib/webview/common/portMapping.ts
src/vs/workbench/contrib/webview/common/portMapping.ts
+4
-4
src/vs/workbench/electron-browser/window.ts
src/vs/workbench/electron-browser/window.ts
+1
-1
src/vs/workbench/services/search/test/node/ripgrepTextSearchEngine.test.ts
...services/search/test/node/ripgrepTextSearchEngine.test.ts
+18
-7
src/vs/workbench/test/electron-browser/api/extHostTypeConverter.test.ts
...ch/test/electron-browser/api/extHostTypeConverter.test.ts
+2
-4
src/vs/workbench/test/electron-browser/api/extHostTypes.test.ts
.../workbench/test/electron-browser/api/extHostTypes.test.ts
+3
-1
未找到文件。
src/vs/base/common/strings.ts
浏览文件 @
30886e2f
...
...
@@ -338,6 +338,34 @@ export function compareIgnoreCase(a: string, b: string): number {
}
}
/**
* [0-9]
*/
export
function
isAsciiDigit
(
code
:
number
):
boolean
{
return
code
>=
CharCode
.
Digit0
&&
code
<=
CharCode
.
Digit9
;
}
/**
* [a-f]
*/
export
function
isLowerAsciiHex
(
code
:
number
):
boolean
{
return
code
>=
CharCode
.
a
&&
code
<=
CharCode
.
f
;
}
/**
* [A-F]
*/
export
function
isUpperAsciiHex
(
code
:
number
):
boolean
{
return
code
>=
CharCode
.
A
&&
code
<=
CharCode
.
F
;
}
/**
* [0-9a-fA-F]
*/
export
function
isAsciiHex
(
code
:
number
):
boolean
{
return
isAsciiDigit
(
code
)
||
isLowerAsciiHex
(
code
)
||
isUpperAsciiHex
(
code
);
}
export
function
isLowerAsciiLetter
(
code
:
number
):
boolean
{
return
code
>=
CharCode
.
a
&&
code
<=
CharCode
.
z
;
}
...
...
@@ -346,7 +374,7 @@ export function isUpperAsciiLetter(code: number): boolean {
return
code
>=
CharCode
.
A
&&
code
<=
CharCode
.
Z
;
}
function
isAsciiLetter
(
code
:
number
):
boolean
{
export
function
isAsciiLetter
(
code
:
number
):
boolean
{
return
isLowerAsciiLetter
(
code
)
||
isUpperAsciiLetter
(
code
);
}
...
...
src/vs/base/common/uri.ts
浏览文件 @
30886e2f
此差异已折叠。
点击以展开。
src/vs/base/test/
common
/uri.test.ts
→
src/vs/base/test/
node
/uri.test.ts
浏览文件 @
30886e2f
此差异已折叠。
点击以展开。
src/vs/editor/browser/services/openerService.ts
浏览文件 @
30886e2f
...
...
@@ -149,7 +149,7 @@ export class OpenerService extends Disposable implements IOpenerService {
private
async
_doOpenExternal
(
resource
:
URI
,
options
:
OpenOptions
|
undefined
):
Promise
<
boolean
>
{
const
{
resolved
}
=
await
this
.
resolveExternalUri
(
resource
,
options
);
dom
.
windowOpenNoOpener
(
encodeURI
(
resolved
.
toString
(
true
)
));
dom
.
windowOpenNoOpener
(
resolved
.
toString
(
));
return
true
;
}
...
...
src/vs/monaco.d.ts
浏览文件 @
30886e2f
...
...
@@ -129,9 +129,11 @@ declare namespace monaco {
* Creates a new Uri from a string, e.g. `http://www.msft.com/some/path`,
* `file:///usr/home`, or `scheme:with/path`.
*
* *Note:* When the input lacks a scheme then `file` is used.
*
* @param value A string which represents an Uri (see `Uri#toString`).
*/
static
parse
(
value
:
string
):
Uri
;
static
parse
(
value
:
string
,
strict
?:
boolean
):
Uri
;
/**
* Creates a new Uri from a file system path, e.g. `c:\my\files`,
* `/usr/home`, or `\\server\share\some\path`.
...
...
src/vs/vscode.d.ts
浏览文件 @
30886e2f
...
...
@@ -1236,8 +1236,8 @@ declare module 'vscode' {
* `file:///usr/home`, or `scheme:with/path`.
*
* *Note* that for a while uris without a `scheme` were accepted. That is not correct
* as all uris should have a scheme.
To avoid breakage of existing code the optional
*
`strict`-argument has been added. We *strongly* advise to use it, e.g. `Uri.parse('my:uri', true)`
* as all uris should have a scheme.
When missing the `file`-scheme is being used unless
*
the `strict`-argument is `true` in which case an error is thrown.
*
* @see [Uri.toString](#Uri.toString)
* @param value The string value of an Uri.
...
...
src/vs/workbench/api/common/extHostTypeConverters.ts
浏览文件 @
30886e2f
...
...
@@ -260,7 +260,7 @@ export namespace MarkdownString {
const
collectUri
=
(
href
:
string
):
string
=>
{
try
{
let
uri
=
URI
.
parse
(
href
);
let
uri
=
URI
.
parse
(
href
,
true
);
uri
=
uri
.
with
({
query
:
_uriMassage
(
uri
.
query
,
resUris
)
});
resUris
[
href
]
=
uri
;
}
catch
(
e
)
{
...
...
src/vs/workbench/contrib/debug/test/common/debugSource.test.ts
浏览文件 @
30886e2f
...
...
@@ -36,7 +36,7 @@ suite('Debug - Source', () => {
assert
.
equal
(
source
.
name
,
'
internalModule.js
'
);
assert
.
equal
(
source
.
inMemory
,
true
);
assert
.
equal
(
source
.
reference
,
11
);
assert
.
equal
(
source
.
uri
.
toString
(),
'
debug:internalModule.js?session
%3DaDebugSessionId%26ref%3D
11
'
);
assert
.
equal
(
source
.
uri
.
toString
(),
'
debug:internalModule.js?session
=aDebugSessionId&ref=
11
'
);
});
test
(
'
get encoded debug data
'
,
()
=>
{
...
...
src/vs/workbench/contrib/webview/common/portMapping.ts
浏览文件 @
30886e2f
...
...
@@ -37,16 +37,16 @@ export class WebviewPortMappingManager extends Disposable {
if
(
tunnel
.
tunnelLocalPort
===
mapping
.
webviewPort
)
{
return
undefined
;
}
return
encodeURI
(
uri
.
with
({
return
uri
.
with
({
authority
:
`127.0.0.1:
${
tunnel
.
tunnelLocalPort
}
`
,
}).
toString
(
true
)
);
}).
toString
();
}
}
if
(
mapping
.
webviewPort
!==
mapping
.
extensionHostPort
)
{
return
encodeURI
(
uri
.
with
({
return
uri
.
with
({
authority
:
`
${
requestLocalHostInfo
.
address
}
:
${
mapping
.
extensionHostPort
}
`
}).
toString
(
true
)
);
}).
toString
();
}
}
}
...
...
src/vs/workbench/electron-browser/window.ts
浏览文件 @
30886e2f
...
...
@@ -408,7 +408,7 @@ export class ElectronWindow extends Disposable {
// the main process to prevent window focus issues.
if
(
this
.
shouldOpenExternal
(
resource
,
options
))
{
const
{
resolved
}
=
await
this
.
openerService
.
resolveExternalUri
(
resource
,
options
);
const
success
=
await
this
.
electronService
.
openExternal
(
encodeURI
(
resolved
.
toString
(
true
)
));
const
success
=
await
this
.
electronService
.
openExternal
(
resolved
.
toString
(
));
if
(
!
success
&&
resolved
.
scheme
===
Schemas
.
file
)
{
// if opening failed, and this is a file, we can still try to reveal it
await
this
.
electronService
.
showItemInFolder
(
resolved
.
fsPath
);
...
...
src/vs/workbench/services/search/test/node/ripgrepTextSearchEngine.test.ts
浏览文件 @
30886e2f
...
...
@@ -72,6 +72,17 @@ suite('RipgrepTextSearchEngine', () => {
suite
(
'
RipgrepParser
'
,
()
=>
{
const
TEST_FOLDER
=
URI
.
file
(
'
/foo/bar
'
);
function
joinPathExt
(
uri
:
URI
,
path
:
string
):
URI
{
const
result
=
joinPath
(
uri
,
path
);
result
.
toString
();
// ^^^^^^^^
// doing this to init the URI._formatted-field because this
// test compares the output of URI.toJSON and because
// calling URI.file (called by RipgrepParser) will also
// initialize URI._formatted
return
result
;
}
function
testParser
(
inputData
:
string
[],
expectedResults
:
TextSearchResult
[]):
void
{
const
testParser
=
new
RipgrepParser
(
1000
,
TEST_FOLDER
.
fsPath
);
...
...
@@ -119,7 +130,7 @@ suite('RipgrepTextSearchEngine', () => {
text
:
'
foobar
'
,
matches
:
[
new
Range
(
0
,
3
,
0
,
6
)]
},
uri
:
joinPath
(
TEST_FOLDER
,
'
file1.js
'
),
uri
:
joinPath
Ext
(
TEST_FOLDER
,
'
file1.js
'
),
ranges
:
[
new
Range
(
3
,
3
,
3
,
6
)]
}
]);
...
...
@@ -138,7 +149,7 @@ suite('RipgrepTextSearchEngine', () => {
text
:
'
foobar
'
,
matches
:
[
new
Range
(
0
,
3
,
0
,
6
)]
},
uri
:
joinPath
(
TEST_FOLDER
,
'
file1.js
'
),
uri
:
joinPath
Ext
(
TEST_FOLDER
,
'
file1.js
'
),
ranges
:
[
new
Range
(
3
,
3
,
3
,
6
)]
},
{
...
...
@@ -146,7 +157,7 @@ suite('RipgrepTextSearchEngine', () => {
text
:
'
foobar
'
,
matches
:
[
new
Range
(
0
,
3
,
0
,
6
)]
},
uri
:
joinPath
(
TEST_FOLDER
,
'
app/file2.js
'
),
uri
:
joinPath
Ext
(
TEST_FOLDER
,
'
app/file2.js
'
),
ranges
:
[
new
Range
(
3
,
3
,
3
,
6
)]
},
{
...
...
@@ -154,7 +165,7 @@ suite('RipgrepTextSearchEngine', () => {
text
:
'
foobar
'
,
matches
:
[
new
Range
(
0
,
3
,
0
,
6
)]
},
uri
:
joinPath
(
TEST_FOLDER
,
'
app2/file3.js
'
),
uri
:
joinPath
Ext
(
TEST_FOLDER
,
'
app2/file3.js
'
),
ranges
:
[
new
Range
(
3
,
3
,
3
,
6
)]
}
]);
...
...
@@ -183,7 +194,7 @@ suite('RipgrepTextSearchEngine', () => {
text
:
'
foo bar
'
,
matches
:
[
new
Range
(
0
,
3
,
0
,
7
)]
},
uri
:
joinPath
(
TEST_FOLDER
,
'
file1.js
'
),
uri
:
joinPath
Ext
(
TEST_FOLDER
,
'
file1.js
'
),
ranges
:
[
new
Range
(
3
,
3
,
3
,
7
)]
},
{
...
...
@@ -191,7 +202,7 @@ suite('RipgrepTextSearchEngine', () => {
text
:
'
foobar
'
,
matches
:
[
new
Range
(
0
,
3
,
0
,
6
)]
},
uri
:
joinPath
(
TEST_FOLDER
,
'
app/file2.js
'
),
uri
:
joinPath
Ext
(
TEST_FOLDER
,
'
app/file2.js
'
),
ranges
:
[
new
Range
(
3
,
3
,
3
,
6
)]
},
{
...
...
@@ -199,7 +210,7 @@ suite('RipgrepTextSearchEngine', () => {
text
:
'
foobar
'
,
matches
:
[
new
Range
(
0
,
3
,
0
,
6
)]
},
uri
:
joinPath
(
TEST_FOLDER
,
'
app2/file3.js
'
),
uri
:
joinPath
Ext
(
TEST_FOLDER
,
'
app2/file3.js
'
),
ranges
:
[
new
Range
(
3
,
3
,
3
,
6
)]
}
]);
...
...
src/vs/workbench/test/electron-browser/api/extHostTypeConverter.test.ts
浏览文件 @
30886e2f
...
...
@@ -22,13 +22,11 @@ suite('ExtHostTypeConverter', function () {
data
=
MarkdownString
.
from
(
'
Hello [link](foo)
'
);
assert
.
equal
(
data
.
value
,
'
Hello [link](foo)
'
);
assert
.
equal
(
size
(
data
.
uris
!
),
1
);
assert
.
ok
(
!!
data
.
uris
!
[
'
foo
'
]);
assert
.
equal
(
size
(
data
.
uris
!
),
0
);
data
=
MarkdownString
.
from
(
'
Hello [link](www.noscheme.bad)
'
);
assert
.
equal
(
data
.
value
,
'
Hello [link](www.noscheme.bad)
'
);
assert
.
equal
(
size
(
data
.
uris
!
),
1
);
assert
.
ok
(
!!
data
.
uris
!
[
'
www.noscheme.bad
'
]);
assert
.
equal
(
size
(
data
.
uris
!
),
0
);
data
=
MarkdownString
.
from
(
'
Hello [link](foo:path)
'
);
assert
.
equal
(
data
.
value
,
'
Hello [link](foo:path)
'
);
...
...
src/vs/workbench/test/electron-browser/api/extHostTypes.test.ts
浏览文件 @
30886e2f
...
...
@@ -22,7 +22,8 @@ suite('ExtHostTypes', function () {
assert
.
deepEqual
(
uri
.
toJSON
(),
{
$mid
:
1
,
scheme
:
'
file
'
,
path
:
'
/path/test.file
'
path
:
'
/path/test.file
'
,
external
:
'
file:///path/test.file
'
});
assert
.
ok
(
uri
.
fsPath
);
...
...
@@ -30,6 +31,7 @@ suite('ExtHostTypes', function () {
$mid
:
1
,
scheme
:
'
file
'
,
path
:
'
/path/test.file
'
,
external
:
'
file:///path/test.file
'
,
fsPath
:
'
/path/test.file
'
.
replace
(
/
\/
/g
,
isWindows
?
'
\\
'
:
'
/
'
),
_sep
:
isWindows
?
1
:
undefined
,
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录