Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
6d7d9d99
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,发现更多精彩内容 >>
提交
6d7d9d99
编写于
1月 12, 2017
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
perf - uri.toJSON() over toString() (fixes #18215)
上级
961ff966
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
30 addition
and
31 deletion
+30
-31
src/vs/base/common/uri.ts
src/vs/base/common/uri.ts
+18
-7
src/vs/workbench/browser/parts/editor/editor.contribution.ts
src/vs/workbench/browser/parts/editor/editor.contribution.ts
+3
-3
src/vs/workbench/parts/files/browser/files.contribution.ts
src/vs/workbench/parts/files/browser/files.contribution.ts
+3
-3
src/vs/workbench/services/files/node/watcher/unix/chokidarWatcherService.ts
...ervices/files/node/watcher/unix/chokidarWatcherService.ts
+3
-12
src/vs/workbench/services/history/browser/history.ts
src/vs/workbench/services/history/browser/history.ts
+3
-3
src/vs/workbench/test/node/api/extHostTypes.test.ts
src/vs/workbench/test/node/api/extHostTypes.test.ts
+0
-3
未找到文件。
src/vs/base/common/uri.ts
浏览文件 @
6d7d9d99
...
...
@@ -378,25 +378,36 @@ export default class URI {
}
public
toJSON
():
any
{
return
<
UriState
>
{
const
res
=
<
UriState
>
{
scheme
:
this
.
scheme
,
authority
:
this
.
authority
,
path
:
this
.
path
,
fsPath
:
this
.
fsPath
,
query
:
this
.
query
,
fragment
:
this
.
fragment
,
external
:
this
.
toString
(),
$mid
:
1
};
if
(
this
.
authority
)
{
res
.
authority
=
this
.
authority
;
}
if
(
this
.
query
)
{
res
.
query
=
this
.
query
;
}
if
(
this
.
fragment
)
{
res
.
fragment
=
this
.
fragment
;
}
return
res
;
}
static
revive
(
data
:
any
):
URI
{
let
result
=
new
URI
();
result
.
_scheme
=
(
<
UriState
>
data
).
scheme
;
result
.
_authority
=
(
<
UriState
>
data
).
authority
;
result
.
_authority
=
(
<
UriState
>
data
).
authority
||
URI
.
_empty
;
result
.
_path
=
(
<
UriState
>
data
).
path
;
result
.
_query
=
(
<
UriState
>
data
).
query
;
result
.
_fragment
=
(
<
UriState
>
data
).
fragment
;
result
.
_query
=
(
<
UriState
>
data
).
query
||
URI
.
_empty
;
result
.
_fragment
=
(
<
UriState
>
data
).
fragment
||
URI
.
_empty
;
result
.
_fsPath
=
(
<
UriState
>
data
).
fsPath
;
result
.
_formatted
=
(
<
UriState
>
data
).
external
;
URI
.
_validate
(
result
);
...
...
src/vs/workbench/browser/parts/editor/editor.contribution.ts
浏览文件 @
6d7d9d99
...
...
@@ -95,7 +95,7 @@ Registry.as<IEditorRegistry>(EditorExtensions.Editors).registerEditor(
);
interface
ISerializedUntitledEditorInput
{
resource
:
string
;
resource
:
any
|
string
;
// TODO@Ben migration
modeId
:
string
;
}
...
...
@@ -120,7 +120,7 @@ class UntitledEditorInputFactory implements IEditorInputFactory {
resource
=
URI
.
file
(
resource
.
fsPath
);
// untitled with associated file path use the file schema
}
const
serialized
:
ISerializedUntitledEditorInput
=
{
resource
:
resource
.
to
String
(),
modeId
:
untitledEditorInput
.
getModeId
()
};
const
serialized
:
ISerializedUntitledEditorInput
=
{
resource
:
resource
.
to
JSON
(),
modeId
:
untitledEditorInput
.
getModeId
()
};
return
JSON
.
stringify
(
serialized
);
}
...
...
@@ -128,7 +128,7 @@ class UntitledEditorInputFactory implements IEditorInputFactory {
public
deserialize
(
instantiationService
:
IInstantiationService
,
serializedEditorInput
:
string
):
EditorInput
{
const
deserialized
:
ISerializedUntitledEditorInput
=
JSON
.
parse
(
serializedEditorInput
);
return
this
.
untitledEditorService
.
createOrGet
(
URI
.
pars
e
(
deserialized
.
resource
),
deserialized
.
modeId
);
return
this
.
untitledEditorService
.
createOrGet
(
typeof
deserialized
.
resource
===
'
string
'
?
URI
.
parse
(
deserialized
.
resource
)
:
URI
.
reviv
e
(
deserialized
.
resource
),
deserialized
.
modeId
);
}
}
...
...
src/vs/workbench/parts/files/browser/files.contribution.ts
浏览文件 @
6d7d9d99
...
...
@@ -105,7 +105,7 @@ const descriptor = new AsyncDescriptor<IFileEditorInput>('vs/workbench/parts/fil
Registry
.
as
<
IEditorRegistry
>
(
EditorExtensions
.
Editors
).
registerDefaultFileInput
(
descriptor
);
interface
ISerializedFileInput
{
resource
:
string
;
resource
:
any
|
string
;
// TODO@Ben migration
encoding
?:
string
;
}
...
...
@@ -133,7 +133,7 @@ class FileEditorInputFactory implements IEditorInputFactory {
const
fileEditorInput
=
<
FileEditorInput
>
editorInput
;
const
fileInput
:
ISerializedFileInput
=
{
resource
:
fileEditorInput
.
getResource
().
to
String
()
resource
:
fileEditorInput
.
getResource
().
to
JSON
()
};
const
encoding
=
fileEditorInput
.
getPreferredEncoding
();
...
...
@@ -147,7 +147,7 @@ class FileEditorInputFactory implements IEditorInputFactory {
public
deserialize
(
instantiationService
:
IInstantiationService
,
serializedEditorInput
:
string
):
EditorInput
{
const
fileInput
:
ISerializedFileInput
=
JSON
.
parse
(
serializedEditorInput
);
return
instantiationService
.
createInstance
(
FileEditorInput
,
URI
.
pars
e
(
fileInput
.
resource
),
fileInput
.
encoding
);
return
instantiationService
.
createInstance
(
FileEditorInput
,
typeof
fileInput
.
resource
===
'
string
'
?
URI
.
parse
(
fileInput
.
resource
)
:
URI
.
reviv
e
(
fileInput
.
resource
),
fileInput
.
encoding
);
}
}
...
...
src/vs/workbench/services/files/node/watcher/unix/chokidarWatcherService.ts
浏览文件 @
6d7d9d99
...
...
@@ -56,26 +56,17 @@ export class ChokidarWatcherService implements IWatcherService {
// Change
if
(
type
===
'
change
'
)
{
event
=
{
type
:
0
,
path
:
path
};
event
=
{
type
:
0
,
path
};
}
// Add
else
if
(
type
===
'
add
'
||
type
===
'
addDir
'
)
{
event
=
{
type
:
1
,
path
:
path
};
event
=
{
type
:
1
,
path
};
}
// Delete
else
if
(
type
===
'
unlink
'
||
type
===
'
unlinkDir
'
)
{
event
=
{
type
:
2
,
path
:
path
};
event
=
{
type
:
2
,
path
};
}
if
(
event
)
{
...
...
src/vs/workbench/services/history/browser/history.ts
浏览文件 @
6d7d9d99
...
...
@@ -71,7 +71,7 @@ export class EditorState {
}
interface
ISerializedFileHistoryEntry
{
resource
:
string
;
resource
:
any
|
string
;
// TODO@Ben migration
}
export
abstract
class
BaseHistoryService
{
...
...
@@ -708,7 +708,7 @@ export class HistoryService extends BaseHistoryService implements IHistoryServic
return
void
0
;
// only file resource inputs are serializable currently
}
return
{
resource
:
(
input
as
IResourceInput
).
resource
.
to
String
()
};
return
{
resource
:
(
input
as
IResourceInput
).
resource
.
to
JSON
()
};
}).
filter
(
serialized
=>
!!
serialized
);
this
.
storageService
.
store
(
HistoryService
.
STORAGE_KEY
,
JSON
.
stringify
(
entries
),
StorageScope
.
WORKSPACE
);
...
...
@@ -725,7 +725,7 @@ export class HistoryService extends BaseHistoryService implements IHistoryServic
this
.
history
=
entries
.
map
(
entry
=>
{
const
serializedFileInput
=
entry
as
ISerializedFileHistoryEntry
;
if
(
serializedFileInput
.
resource
)
{
return
{
resource
:
URI
.
pars
e
(
serializedFileInput
.
resource
)
}
as
IResourceInput
;
return
{
resource
:
typeof
serializedFileInput
.
resource
===
'
string
'
?
URI
.
parse
(
serializedFileInput
.
resource
)
:
URI
.
reviv
e
(
serializedFileInput
.
resource
)
}
as
IResourceInput
;
}
return
void
0
;
...
...
src/vs/workbench/test/node/api/extHostTypes.test.ts
浏览文件 @
6d7d9d99
...
...
@@ -25,11 +25,8 @@ suite('ExtHostTypes', function () {
assert
.
deepEqual
(
data
,
{
$mid
:
1
,
scheme
:
'
file
'
,
authority
:
''
,
path
:
'
/path/test.file
'
,
fsPath
:
'
/path/test.file
'
.
replace
(
/
\/
/g
,
isWindows
?
'
\\
'
:
'
/
'
),
query
:
''
,
fragment
:
''
,
external
:
'
file:///path/test.file
'
});
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录