Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
f8432f8d
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,体验更适合开发者的 AI 搜索 >>
提交
f8432f8d
编写于
4月 06, 2020
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debt - more usage of ES6 object assign
上级
6d0becaa
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
35 addition
and
44 deletion
+35
-44
src/vs/code/electron-main/main.ts
src/vs/code/electron-main/main.ts
+1
-2
src/vs/code/electron-main/sharedProcess.ts
src/vs/code/electron-main/sharedProcess.ts
+2
-3
src/vs/code/electron-main/window.ts
src/vs/code/electron-main/window.ts
+3
-3
src/vs/code/node/shellEnv.ts
src/vs/code/node/shellEnv.ts
+3
-3
src/vs/platform/files/common/fileService.ts
src/vs/platform/files/common/fileService.ts
+3
-3
src/vs/platform/product/common/product.ts
src/vs/platform/product/common/product.ts
+5
-6
src/vs/platform/windows/electron-main/windowsMainService.ts
src/vs/platform/windows/electron-main/windowsMainService.ts
+2
-2
src/vs/workbench/browser/parts/editor/editor.ts
src/vs/workbench/browser/parts/editor/editor.ts
+2
-3
src/vs/workbench/browser/parts/editor/editorPart.ts
src/vs/workbench/browser/parts/editor/editorPart.ts
+1
-2
src/vs/workbench/browser/parts/editor/textEditor.ts
src/vs/workbench/browser/parts/editor/textEditor.ts
+2
-2
src/vs/workbench/browser/parts/titlebar/menubarControl.ts
src/vs/workbench/browser/parts/titlebar/menubarControl.ts
+1
-2
src/vs/workbench/common/editor.ts
src/vs/workbench/common/editor.ts
+1
-2
src/vs/workbench/services/textfile/electron-browser/nativeTextFileService.ts
...rvices/textfile/electron-browser/nativeTextFileService.ts
+9
-11
未找到文件。
src/vs/code/electron-main/main.ts
浏览文件 @
f8432f8d
...
...
@@ -5,7 +5,6 @@
import
'
vs/platform/update/common/update.config.contribution
'
;
import
{
app
,
dialog
}
from
'
electron
'
;
import
{
assign
}
from
'
vs/base/common/objects
'
;
import
{
isWindows
,
IProcessEnvironment
,
isMacintosh
}
from
'
vs/base/common/platform
'
;
import
product
from
'
vs/platform/product/common/product
'
;
import
{
parseMainProcessArgv
,
addArg
}
from
'
vs/platform/environment/node/argvHelper
'
;
...
...
@@ -201,7 +200,7 @@ class CodeMain {
}
});
assign
(
process
.
env
,
instanceEnvironment
);
Object
.
assign
(
process
.
env
,
instanceEnvironment
);
return
instanceEnvironment
;
}
...
...
src/vs/code/electron-main/sharedProcess.ts
浏览文件 @
f8432f8d
...
...
@@ -3,7 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
assign
}
from
'
vs/base/common/objects
'
;
import
{
memoize
}
from
'
vs/base/common/decorators
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
BrowserWindow
,
ipcMain
,
WebContents
,
Event
as
ElectronEvent
}
from
'
electron
'
;
...
...
@@ -47,13 +46,13 @@ export class SharedProcess implements ISharedProcess {
disableBlinkFeatures
:
'
Auxclick
'
// do NOT change, allows us to identify this window as shared-process in the process explorer
}
});
const
config
=
assign
(
{
const
config
=
{
appRoot
:
this
.
environmentService
.
appRoot
,
machineId
:
this
.
machineId
,
nodeCachedDataDir
:
this
.
environmentService
.
nodeCachedDataDir
,
userEnv
:
this
.
userEnv
,
windowId
:
this
.
window
.
id
}
)
;
};
const
url
=
`
${
require
.
toUrl
(
'
vs/code/electron-browser/sharedProcess/sharedProcess.html
'
)}
?config=
${
encodeURIComponent
(
JSON
.
stringify
(
config
))}
`
;
this
.
window
.
loadURL
(
url
);
...
...
src/vs/code/electron-main/window.ts
浏览文件 @
f8432f8d
...
...
@@ -471,7 +471,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
// Inject headers when requests are incoming
const
urls
=
[
'
https://marketplace.visualstudio.com/*
'
,
'
https://*.vsassets.io/*
'
];
this
.
_win
.
webContents
.
session
.
webRequest
.
onBeforeSendHeaders
({
urls
},
(
details
,
cb
)
=>
this
.
marketplaceHeadersPromise
.
then
(
headers
=>
cb
({
cancel
:
false
,
requestHeaders
:
objects
.
assign
(
details
.
requestHeaders
,
headers
)
as
Record
<
string
,
string
>
})));
this
.
marketplaceHeadersPromise
.
then
(
headers
=>
cb
({
cancel
:
false
,
requestHeaders
:
Object
.
assign
(
details
.
requestHeaders
,
headers
)
})));
}
private
onWindowError
(
error
:
WindowError
):
void
{
...
...
@@ -597,7 +597,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
// Add disable-extensions to the config, but do not preserve it on currentConfig or
// pendingLoadConfig so that it is applied only on this load
const
configuration
=
objects
.
assign
({},
config
)
;
const
configuration
=
{
...
config
}
;
if
(
disableExtensions
!==
undefined
)
{
configuration
[
'
disable-extensions
'
]
=
disableExtensions
;
}
...
...
@@ -701,7 +701,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
// Config (combination of process.argv and window configuration)
const
environment
=
parseArgs
(
process
.
argv
,
OPTIONS
);
const
config
=
objects
.
assign
(
environment
,
windowConfiguration
);
const
config
=
Object
.
assign
(
environment
,
windowConfiguration
);
for
(
const
key
in
config
)
{
const
configValue
=
(
config
as
any
)[
key
];
if
(
configValue
===
undefined
||
configValue
===
null
||
configValue
===
''
||
configValue
===
false
)
{
...
...
src/vs/code/node/shellEnv.ts
浏览文件 @
f8432f8d
...
...
@@ -4,7 +4,6 @@
*--------------------------------------------------------------------------------------------*/
import
*
as
cp
from
'
child_process
'
;
import
{
assign
}
from
'
vs/base/common/objects
'
;
import
{
generateUuid
}
from
'
vs/base/common/uuid
'
;
import
{
isWindows
}
from
'
vs/base/common/platform
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
...
...
@@ -21,10 +20,11 @@ function getUnixShellEnvironment(logService: ILogService): Promise<typeof proces
const
mark
=
generateUuid
().
replace
(
/-/g
,
''
).
substr
(
0
,
12
);
const
regex
=
new
RegExp
(
mark
+
'
(.*)
'
+
mark
);
const
env
=
assign
({},
process
.
env
,
{
const
env
=
{
...
process
.
env
,
ELECTRON_RUN_AS_NODE
:
'
1
'
,
ELECTRON_NO_ATTACH_CONSOLE
:
'
1
'
}
)
;
};
const
command
=
`'
${
process
.
execPath
}
' -p '"
${
mark
}
" + JSON.stringify(process.env) + "
${
mark
}
"'`
;
logService
.
trace
(
'
getUnixShellEnvironment#env
'
,
env
);
...
...
src/vs/platform/files/common/fileService.ts
浏览文件 @
f8432f8d
...
...
@@ -18,7 +18,6 @@ import { isReadableStream, transform, ReadableStreamEvents, consumeReadableWithL
import
{
Queue
}
from
'
vs/base/common/async
'
;
import
{
CancellationTokenSource
,
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
assign
}
from
'
vs/base/common/objects
'
;
import
{
createReadStream
}
from
'
vs/platform/files/common/io
'
;
export
class
FileService
extends
Disposable
implements
IFileService
{
...
...
@@ -384,14 +383,15 @@ export class FileService extends Disposable implements IFileService {
async
readFile
(
resource
:
URI
,
options
?:
IReadFileOptions
):
Promise
<
IFileContent
>
{
const
provider
=
await
this
.
withReadProvider
(
resource
);
const
stream
=
await
this
.
doReadAsFileStream
(
provider
,
resource
,
assign
({
const
stream
=
await
this
.
doReadAsFileStream
(
provider
,
resource
,
{
...
options
,
// optimization: since we know that the caller does not
// care about buffering, we indicate this to the reader.
// this reduces all the overhead the buffered reading
// has (open, read, close) if the provider supports
// unbuffered reading.
preferUnbuffered
:
true
}
,
options
||
Object
.
create
(
null
))
);
});
return
{
...
stream
,
...
...
src/vs/platform/product/common/product.ts
浏览文件 @
f8432f8d
...
...
@@ -4,7 +4,6 @@
*--------------------------------------------------------------------------------------------*/
import
{
IProductConfiguration
}
from
'
vs/platform/product/common/productService
'
;
import
{
assign
}
from
'
vs/base/common/objects
'
;
import
{
isWeb
}
from
'
vs/base/common/platform
'
;
import
*
as
path
from
'
vs/base/common/path
'
;
import
{
getPathFromAmdModule
}
from
'
vs/base/common/amd
'
;
...
...
@@ -20,8 +19,8 @@ if (isWeb) {
// Running out of sources
if
(
Object
.
keys
(
product
).
length
===
0
)
{
assign
(
product
,
{
version
:
'
1.4
4
.0-dev
'
,
Object
.
assign
(
product
,
{
version
:
'
1.4
5
.0-dev
'
,
nameLong
:
'
Visual Studio Code Web Dev
'
,
nameShort
:
'
VSCode Web Dev
'
,
urlProtocol
:
'
code-oss
'
...
...
@@ -35,19 +34,19 @@ else if (typeof require !== 'undefined' && typeof require.__$__nodeRequire === '
// Obtain values from product.json and package.json
const
rootPath
=
path
.
dirname
(
getPathFromAmdModule
(
require
,
''
));
product
=
assign
({},
require
.
__$__nodeRequire
(
path
.
join
(
rootPath
,
'
product.json
'
))
as
IProductConfiguration
);
product
=
require
.
__$__nodeRequire
(
path
.
join
(
rootPath
,
'
product.json
'
)
);
const
pkg
=
require
.
__$__nodeRequire
(
path
.
join
(
rootPath
,
'
package.json
'
))
as
{
version
:
string
;
};
// Running out of sources
if
(
env
[
'
VSCODE_DEV
'
])
{
assign
(
product
,
{
Object
.
assign
(
product
,
{
nameShort
:
`
${
product
.
nameShort
}
Dev`
,
nameLong
:
`
${
product
.
nameLong
}
Dev`
,
dataFolderName
:
`
${
product
.
dataFolderName
}
-dev`
});
}
assign
(
product
,
{
Object
.
assign
(
product
,
{
version
:
pkg
.
version
});
}
...
...
src/vs/platform/windows/electron-main/windowsMainService.ts
浏览文件 @
f8432f8d
...
...
@@ -7,7 +7,7 @@ import * as fs from 'fs';
import
{
basename
,
normalize
,
join
,
posix
}
from
'
vs/base/common/path
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
*
as
arrays
from
'
vs/base/common/arrays
'
;
import
{
assign
,
mixin
}
from
'
vs/base/common/objects
'
;
import
{
mixin
}
from
'
vs/base/common/objects
'
;
import
{
IBackupMainService
}
from
'
vs/platform/backup/electron-main/backup
'
;
import
{
IEmptyWindowBackupInfo
}
from
'
vs/platform/backup/node/backup
'
;
import
{
IEnvironmentService
,
ParsedArgs
}
from
'
vs/platform/environment/common/environment
'
;
...
...
@@ -1358,7 +1358,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
configuration
.
nodeCachedDataDir
=
this
.
environmentService
.
nodeCachedDataDir
;
configuration
.
mainPid
=
process
.
pid
;
configuration
.
execPath
=
process
.
execPath
;
configuration
.
userEnv
=
assign
({},
this
.
initialUserEnv
,
options
.
userEnv
||
{})
;
configuration
.
userEnv
=
{
...
this
.
initialUserEnv
,
...
options
.
userEnv
}
;
configuration
.
isInitialStartup
=
options
.
initialStartup
;
configuration
.
workspace
=
options
.
workspace
;
configuration
.
folderUri
=
options
.
folderUri
;
...
...
src/vs/workbench/browser/parts/editor/editor.ts
浏览文件 @
f8432f8d
...
...
@@ -9,7 +9,6 @@ import { IEditorGroup, GroupDirection, IAddGroupOptions, IMergeGroupOptions, Gro
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
Dimension
}
from
'
vs/base/browser/dom
'
;
import
{
Event
}
from
'
vs/base/common/event
'
;
import
{
assign
}
from
'
vs/base/common/objects
'
;
import
{
IConfigurationChangeEvent
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
ISerializableView
}
from
'
vs/base/browser/ui/grid/grid
'
;
import
{
getCodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
...
...
@@ -47,7 +46,7 @@ export function impactsEditorPartOptions(event: IConfigurationChangeEvent): bool
}
export
function
getEditorPartOptions
(
config
:
IWorkbenchEditorConfiguration
):
IEditorPartOptions
{
const
options
:
IEditorPartOptions
=
assign
(
Object
.
create
(
null
),
DEFAULT_EDITOR_PART_OPTIONS
)
;
const
options
=
{
...
DEFAULT_EDITOR_PART_OPTIONS
}
;
if
(
!
config
||
!
config
.
workbench
)
{
return
options
;
...
...
@@ -58,7 +57,7 @@ export function getEditorPartOptions(config: IWorkbenchEditorConfiguration): IEd
}
if
(
config
.
workbench
.
editor
)
{
assign
(
options
,
config
.
workbench
.
editor
);
Object
.
assign
(
options
,
config
.
workbench
.
editor
);
}
return
options
;
...
...
src/vs/workbench/browser/parts/editor/editorPart.ts
浏览文件 @
f8432f8d
...
...
@@ -19,7 +19,6 @@ import { IEditorGroupsAccessor, IEditorGroupView, getEditorPartOptions, impactsE
import
{
EditorGroupView
}
from
'
vs/workbench/browser/parts/editor/editorGroupView
'
;
import
{
IConfigurationService
,
IConfigurationChangeEvent
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IDisposable
,
dispose
,
toDisposable
,
DisposableStore
}
from
'
vs/base/common/lifecycle
'
;
import
{
assign
}
from
'
vs/base/common/objects
'
;
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
import
{
ISerializedEditorGroup
,
isSerializedEditorGroup
}
from
'
vs/workbench/common/editor/editorGroup
'
;
import
{
EditorDropTarget
,
EditorDropTargetDelegate
}
from
'
vs/workbench/browser/parts/editor/editorDropTarget
'
;
...
...
@@ -175,7 +174,7 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
const
newPartOptions
=
getEditorPartOptions
(
this
.
configurationService
.
getValue
<
IWorkbenchEditorConfiguration
>
());
this
.
enforcedPartOptions
.
forEach
(
enforcedPartOptions
=>
{
assign
(
newPartOptions
,
enforcedPartOptions
);
// check for overrides
Object
.
assign
(
newPartOptions
,
enforcedPartOptions
);
// check for overrides
});
this
.
_partOptions
=
newPartOptions
;
...
...
src/vs/workbench/browser/parts/editor/textEditor.ts
浏览文件 @
f8432f8d
...
...
@@ -5,7 +5,7 @@
import
{
localize
}
from
'
vs/nls
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
distinct
,
deepClone
,
assign
}
from
'
vs/base/common/objects
'
;
import
{
distinct
,
deepClone
}
from
'
vs/base/common/objects
'
;
import
{
Event
}
from
'
vs/base/common/event
'
;
import
{
isObject
,
assertIsDefined
,
withNullAsUndefined
,
isFunction
}
from
'
vs/base/common/types
'
;
import
{
Dimension
}
from
'
vs/base/browser/dom
'
;
...
...
@@ -93,7 +93,7 @@ export abstract class BaseTextEditor extends BaseEditor implements ITextEditorPa
// Specific editor options always overwrite user configuration
const
editorConfiguration
:
IEditorOptions
=
isObject
(
configuration
.
editor
)
?
deepClone
(
configuration
.
editor
)
:
Object
.
create
(
null
);
assign
(
editorConfiguration
,
this
.
getConfigurationOverrides
());
Object
.
assign
(
editorConfiguration
,
this
.
getConfigurationOverrides
());
// ARIA label
editorConfiguration
.
ariaLabel
=
this
.
computeAriaLabel
();
...
...
src/vs/workbench/browser/parts/titlebar/menubarControl.ts
浏览文件 @
f8432f8d
...
...
@@ -29,7 +29,6 @@ import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/
import
{
MenuBar
,
IMenuBarOptions
}
from
'
vs/base/browser/ui/menu/menubar
'
;
import
{
SubmenuAction
,
Direction
}
from
'
vs/base/browser/ui/menu/menu
'
;
import
{
attachMenuStyler
}
from
'
vs/platform/theme/common/styler
'
;
import
{
assign
}
from
'
vs/base/common/objects
'
;
import
{
mnemonicMenuLabel
,
unmnemonicLabel
}
from
'
vs/base/common/labels
'
;
import
{
IAccessibilityService
}
from
'
vs/platform/accessibility/common/accessibility
'
;
import
{
IWorkbenchLayoutService
}
from
'
vs/workbench/services/layout/browser/layoutService
'
;
...
...
@@ -231,7 +230,7 @@ export abstract class MenubarControl extends Disposable {
});
});
return
assign
(
ret
,
{
uri
:
uri
});
return
Object
.
assign
(
ret
,
{
uri
});
}
private
notifyUserOfCustomMenubarAccessibility
():
void
{
...
...
src/vs/workbench/common/editor.ts
浏览文件 @
f8432f8d
...
...
@@ -5,7 +5,6 @@
import
{
localize
}
from
'
vs/nls
'
;
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
assign
}
from
'
vs/base/common/objects
'
;
import
{
withNullAsUndefined
,
assertIsDefined
}
from
'
vs/base/common/types
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
IDisposable
,
Disposable
,
toDisposable
}
from
'
vs/base/common/lifecycle
'
;
...
...
@@ -890,7 +889,7 @@ export class SideBySideEditorInput extends EditorInput {
getTelemetryDescriptor
():
{
[
key
:
string
]:
unknown
}
{
const
descriptor
=
this
.
master
.
getTelemetryDescriptor
();
return
assign
(
descriptor
,
super
.
getTelemetryDescriptor
());
return
Object
.
assign
(
descriptor
,
super
.
getTelemetryDescriptor
());
}
private
registerListeners
():
void
{
...
...
src/vs/workbench/services/textfile/electron-browser/nativeTextFileService.ts
浏览文件 @
f8432f8d
...
...
@@ -33,7 +33,6 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
IWorkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/common/environmentService
'
;
import
{
IDialogService
,
IFileDialogService
}
from
'
vs/platform/dialogs/common/dialogs
'
;
import
{
assign
}
from
'
vs/base/common/objects
'
;
import
{
IFilesConfigurationService
}
from
'
vs/workbench/services/filesConfiguration/common/filesConfigurationService
'
;
import
{
ITextModelService
}
from
'
vs/editor/common/services/resolverService
'
;
import
{
ICodeEditorService
}
from
'
vs/editor/browser/services/codeEditorService
'
;
...
...
@@ -75,16 +74,15 @@ export class NativeTextFileService extends AbstractTextFileService {
}
async
read
(
resource
:
URI
,
options
?:
IReadTextFileOptions
):
Promise
<
ITextFileContent
>
{
const
[
bufferStream
,
decoder
]
=
await
this
.
doRead
(
resource
,
assign
({
// optimization: since we know that the caller does not
// care about buffering, we indicate this to the reader.
// this reduces all the overhead the buffered reading
// has (open, read, close) if the provider supports
// unbuffered reading.
preferUnbuffered
:
true
},
options
||
Object
.
create
(
null
))
);
const
[
bufferStream
,
decoder
]
=
await
this
.
doRead
(
resource
,
{
...
options
,
// optimization: since we know that the caller does not
// care about buffering, we indicate this to the reader.
// this reduces all the overhead the buffered reading
// has (open, read, close) if the provider supports
// unbuffered reading.
preferUnbuffered
:
true
});
return
{
...
bufferStream
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录