Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
1de7a23c
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,发现更多精彩内容 >>
提交
1de7a23c
编写于
8月 23, 2016
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
code clean up
上级
a4bc82cb
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
22 addition
and
32 deletion
+22
-32
src/vs/base/node/config.ts
src/vs/base/node/config.ts
+5
-11
src/vs/code/electron-main/main.ts
src/vs/code/electron-main/main.ts
+1
-1
src/vs/platform/configuration/node/configurationService.ts
src/vs/platform/configuration/node/configurationService.ts
+8
-8
src/vs/platform/files/common/files.ts
src/vs/platform/files/common/files.ts
+2
-1
src/vs/platform/keybinding/browser/keybindingServiceImpl.ts
src/vs/platform/keybinding/browser/keybindingServiceImpl.ts
+2
-4
src/vs/workbench/services/files/node/fileService.ts
src/vs/workbench/services/files/node/fileService.ts
+2
-1
src/vs/workbench/services/keybinding/electron-browser/keybindingService.ts
...services/keybinding/electron-browser/keybindingService.ts
+2
-6
未找到文件。
src/vs/base/node/config.ts
浏览文件 @
1de7a23c
...
...
@@ -44,7 +44,7 @@ export class ConfigWatcher<T> implements IConfigWatcher<T>, IDisposable {
private
loaded
:
boolean
;
private
timeoutHandle
:
number
;
private
disposables
:
IDisposable
[];
private
_onDidUpdateConfiguration
:
Emitter
<
IConfigurationChangeEvent
<
T
>>
;
private
_onDidUpdateConfiguration
:
Emitter
<
IConfigurationChangeEvent
<
T
>>
;
constructor
(
private
_path
:
string
,
private
options
:
IConfigOptions
<
T
>
=
{
changeBufferDelay
:
0
,
defaultConfig
:
Object
.
create
(
null
)
})
{
this
.
disposables
=
[];
...
...
@@ -82,14 +82,11 @@ export class ConfigWatcher<T> implements IConfigWatcher<T>, IDisposable {
}
private
loadSync
():
T
{
let
raw
:
string
;
try
{
r
aw
=
fs
.
readFileSync
(
this
.
_path
).
toString
(
);
r
eturn
this
.
parse
(
fs
.
readFileSync
(
this
.
_path
).
toString
()
);
}
catch
(
error
)
{
return
this
.
options
.
defaultConfig
;
}
return
this
.
parse
(
raw
);
}
private
loadAsync
(
callback
:
(
config
:
T
)
=>
void
):
void
{
...
...
@@ -108,7 +105,7 @@ export class ConfigWatcher<T> implements IConfigWatcher<T>, IDisposable {
this
.
parseErrors
=
[];
res
=
json
.
parse
(
raw
,
this
.
parseErrors
);
}
catch
(
error
)
{
// Ignore
loading and
parsing errors
// Ignore parsing errors
}
return
res
||
this
.
options
.
defaultConfig
;
...
...
@@ -155,16 +152,13 @@ export class ConfigWatcher<T> implements IConfigWatcher<T>, IDisposable {
}
private
onConfigFileChange
():
void
{
// we can get multiple change events for one change, so we buffer through a timeout
if
(
this
.
timeoutHandle
)
{
global
.
clearTimeout
(
this
.
timeoutHandle
);
this
.
timeoutHandle
=
null
;
}
this
.
timeoutHandle
=
global
.
setTimeout
(()
=>
{
this
.
reload
();
},
this
.
options
.
changeBufferDelay
);
// we can get multiple change events for one change, so we buffer through a timeout
this
.
timeoutHandle
=
global
.
setTimeout
(()
=>
this
.
reload
(),
this
.
options
.
changeBufferDelay
);
}
public
reload
(
callback
?:
(
config
:
T
)
=>
void
):
void
{
...
...
src/vs/code/electron-main/main.ts
浏览文件 @
1de7a23c
...
...
@@ -69,7 +69,7 @@ function main(accessor: ServicesAccessor, mainIpcServer: Server, userEnv: IProce
const
windowsService
=
accessor
.
get
(
IWindowsService
);
const
lifecycleService
=
accessor
.
get
(
ILifecycleService
);
const
updateService
=
accessor
.
get
(
IUpdateService
);
const
configurationService
=
<
ConfigurationService
>
accessor
.
get
(
IConfigurationService
);
const
configurationService
=
<
ConfigurationService
<
any
>
>
accessor
.
get
(
IConfigurationService
);
// We handle uncaught exceptions here to prevent electron from opening a dialog to the user
process
.
on
(
'
uncaughtException
'
,
(
err
:
any
)
=>
{
...
...
src/vs/platform/configuration/node/configurationService.ts
浏览文件 @
1de7a23c
...
...
@@ -16,14 +16,14 @@ import {IConfigurationService, IConfigurationServiceEvent } from 'vs/platform/co
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
export
class
ConfigurationService
implements
IConfigurationService
,
IDisposable
{
export
class
ConfigurationService
<
T
>
implements
IConfigurationService
,
IDisposable
{
_serviceBrand
:
any
;
private
disposables
:
IDisposable
[];
private
rawConfig
:
ConfigWatcher
<
any
>
;
private
cache
:
any
;
private
rawConfig
:
ConfigWatcher
<
T
>
;
private
cache
:
T
;
private
_onDidUpdateConfiguration
:
Emitter
<
IConfigurationServiceEvent
>
;
...
...
@@ -53,17 +53,17 @@ export class ConfigurationService implements IConfigurationService, IDisposable
return
this
.
_onDidUpdateConfiguration
.
event
;
}
public
loadConfiguration
<
T
>
(
section
?:
string
):
TPromise
<
T
>
{
return
new
TPromise
<
T
>
(
c
=>
{
public
loadConfiguration
<
C
>
(
section
?:
string
):
TPromise
<
C
>
{
return
new
TPromise
<
C
>
(
c
=>
{
this
.
rawConfig
.
reload
(()
=>
{
this
.
cache
=
void
0
;
// reset our caches
c
(
this
.
getConfiguration
<
T
>
(
section
));
c
(
this
.
getConfiguration
<
C
>
(
section
));
});
});
}
public
getConfiguration
<
T
>
(
section
?:
string
):
T
{
public
getConfiguration
<
C
>
(
section
?:
string
):
C
{
let
consolidatedConfig
=
this
.
cache
;
if
(
!
consolidatedConfig
)
{
consolidatedConfig
=
this
.
getConsolidatedConfig
();
...
...
@@ -73,7 +73,7 @@ export class ConfigurationService implements IConfigurationService, IDisposable
return
section
?
consolidatedConfig
[
section
]
:
consolidatedConfig
;
}
private
getConsolidatedConfig
():
any
{
private
getConsolidatedConfig
():
T
{
const
defaults
=
getDefaultValues
();
// defaults coming from contributions to registries
const
user
=
flatten
(
this
.
rawConfig
.
getConfig
());
// user configured settings
...
...
src/vs/platform/files/common/files.ts
浏览文件 @
1de7a23c
...
...
@@ -452,7 +452,8 @@ export enum FileOperationResult {
FILE_MODIFIED_SINCE
,
FILE_MOVE_CONFLICT
,
FILE_READ_ONLY
,
FILE_TOO_LARGE
FILE_TOO_LARGE
,
FILE_INVALID_PATH
}
export
const
MAX_FILE_SIZE
=
50
*
1024
*
1024
;
...
...
src/vs/platform/keybinding/browser/keybindingServiceImpl.ts
浏览文件 @
1de7a23c
...
...
@@ -25,7 +25,7 @@ export abstract class KeybindingService implements IKeybindingService {
public
_serviceBrand
:
any
;
protected
toDispose
:
IDisposable
[]
=
[];
private
_cachedResolver
:
KeybindingResolver
;
private
_firstTimeComputingResolver
:
boolean
;
private
_currentChord
:
number
;
...
...
@@ -181,6 +181,4 @@ export abstract class KeybindingService implements IKeybindingService {
});
}
}
}
}
\ No newline at end of file
src/vs/workbench/services/files/node/fileService.ts
浏览文件 @
1de7a23c
...
...
@@ -153,7 +153,8 @@ export class FileService implements IFileService {
// Guard early against attempts to resolve an invalid file path
if
(
resource
.
scheme
!==
'
file
'
||
!
resource
.
fsPath
)
{
return
TPromise
.
wrapError
(
<
IFileOperationResult
>
{
message
:
nls
.
localize
(
'
fileInvalidPath
'
,
"
Invalid file resource ({0})
"
,
resource
.
toString
())
message
:
nls
.
localize
(
'
fileInvalidPath
'
,
"
Invalid file resource ({0})
"
,
resource
.
toString
()),
fileOperationResult
:
FileOperationResult
.
FILE_INVALID_PATH
});
}
...
...
src/vs/workbench/services/keybinding/electron-browser/keybindingService.ts
浏览文件 @
1de7a23c
...
...
@@ -9,6 +9,7 @@ import {IHTMLContentElement} from 'vs/base/common/htmlContent';
import
{
IJSONSchema
}
from
'
vs/base/common/jsonSchema
'
;
import
{
Keybinding
}
from
'
vs/base/common/keyCodes
'
;
import
*
as
platform
from
'
vs/base/common/platform
'
;
import
{
toDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IEventService
}
from
'
vs/platform/event/common/event
'
;
import
{
IExtensionMessageCollector
,
ExtensionsRegistry
}
from
'
vs/platform/extensions/common/extensionsRegistry
'
;
import
{
Extensions
,
IJSONContributionRegistry
}
from
'
vs/platform/jsonschemas/common/jsonContributionRegistry
'
;
...
...
@@ -131,6 +132,7 @@ export class WorkbenchKeybindingService extends KeybindingService {
super
(
contextKeyService
,
commandService
,
messageService
,
statusBarService
);
this
.
userKeybindings
=
new
ConfigWatcher
(
environmentService
.
appKeybindingsPath
,
{
defaultConfig
:
[]
});
this
.
toDispose
.
push
(
toDisposable
(()
=>
this
.
userKeybindings
.
dispose
()));
keybindingsExtPoint
.
setHandler
((
extensions
)
=>
{
let
commandAdded
=
false
;
...
...
@@ -168,12 +170,6 @@ export class WorkbenchKeybindingService extends KeybindingService {
return
extraUserKeybindings
.
map
((
k
,
i
)
=>
IOSupport
.
readKeybindingItem
(
k
,
i
));
}
public
dispose
():
void
{
super
.
dispose
();
this
.
userKeybindings
.
dispose
();
}
public
getLabelFor
(
keybinding
:
Keybinding
):
string
{
return
keybinding
.
toCustomLabel
(
getNativeLabelProvider
());
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录