Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
66db1a70
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 搜索 >>
提交
66db1a70
编写于
9月 08, 2020
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#103454 remove objects.assign usage
上级
b1a66b59
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
97 addition
and
91 deletion
+97
-91
src/vs/base/parts/request/browser/request.ts
src/vs/base/parts/request/browser/request.ts
+4
-2
src/vs/platform/extensionManagement/common/extensionGalleryService.ts
...orm/extensionManagement/common/extensionGalleryService.ts
+16
-15
src/vs/platform/extensionManagement/node/extensionManagementService.ts
...rm/extensionManagement/node/extensionManagementService.ts
+6
-3
src/vs/platform/extensionManagement/node/extensionsScanner.ts
...vs/platform/extensionManagement/node/extensionsScanner.ts
+4
-3
src/vs/platform/request/electron-main/requestMainService.ts
src/vs/platform/request/electron-main/requestMainService.ts
+1
-2
src/vs/platform/request/node/requestService.ts
src/vs/platform/request/node/requestService.ts
+7
-4
src/vs/platform/userDataSync/common/userDataSyncStoreService.ts
.../platform/userDataSync/common/userDataSyncStoreService.ts
+4
-3
src/vs/workbench/contrib/extensions/browser/extensionEditor.ts
...s/workbench/contrib/extensions/browser/extensionEditor.ts
+2
-3
src/vs/workbench/contrib/extensions/browser/extensionRecommendationsService.ts
...rib/extensions/browser/extensionRecommendationsService.ts
+1
-2
src/vs/workbench/contrib/extensions/browser/extensionsViews.ts
...s/workbench/contrib/extensions/browser/extensionsViews.ts
+11
-8
src/vs/workbench/contrib/extensions/test/electron-browser/extensionRecommendationsService.test.ts
.../electron-browser/extensionRecommendationsService.test.ts
+3
-5
src/vs/workbench/contrib/extensions/test/electron-browser/extensionsActions.test.ts
...xtensions/test/electron-browser/extensionsActions.test.ts
+8
-9
src/vs/workbench/contrib/extensions/test/electron-browser/extensionsViews.test.ts
.../extensions/test/electron-browser/extensionsViews.test.ts
+9
-10
src/vs/workbench/contrib/extensions/test/electron-browser/extensionsWorkbenchService.test.ts
.../test/electron-browser/extensionsWorkbenchService.test.ts
+8
-9
src/vs/workbench/services/extensionManagement/test/browser/extensionEnablementService.test.ts
...anagement/test/browser/extensionEnablementService.test.ts
+5
-5
src/vs/workbench/services/preferences/browser/preferencesService.ts
...kbench/services/preferences/browser/preferencesService.ts
+2
-3
src/vs/workbench/test/browser/api/extHostConfiguration.test.ts
...s/workbench/test/browser/api/extHostConfiguration.test.ts
+6
-5
未找到文件。
src/vs/base/parts/request/browser/request.ts
浏览文件 @
66db1a70
...
...
@@ -5,13 +5,15 @@
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
canceled
}
from
'
vs/base/common/errors
'
;
import
{
assign
}
from
'
vs/base/common/objects
'
;
import
{
VSBuffer
,
bufferToStream
}
from
'
vs/base/common/buffer
'
;
import
{
IRequestOptions
,
IRequestContext
}
from
'
vs/base/parts/request/common/request
'
;
export
function
request
(
options
:
IRequestOptions
,
token
:
CancellationToken
):
Promise
<
IRequestContext
>
{
if
(
options
.
proxyAuthorization
)
{
options
.
headers
=
assign
(
options
.
headers
||
{},
{
'
Proxy-Authorization
'
:
options
.
proxyAuthorization
});
options
.
headers
=
{
...(
options
.
headers
||
{}),
'
Proxy-Authorization
'
:
options
.
proxyAuthorization
};
}
const
xhr
=
new
XMLHttpRequest
();
...
...
src/vs/platform/extensionManagement/common/extensionGalleryService.ts
浏览文件 @
66db1a70
...
...
@@ -6,7 +6,7 @@
import
{
getErrorMessage
,
isPromiseCanceledError
,
canceled
}
from
'
vs/base/common/errors
'
;
import
{
StatisticType
,
IGalleryExtension
,
IExtensionGalleryService
,
IGalleryExtensionAsset
,
IQueryOptions
,
SortBy
,
SortOrder
,
IExtensionIdentifier
,
IReportedExtension
,
InstallOperation
,
ITranslation
,
IGalleryExtensionVersion
,
IGalleryExtensionAssets
,
isIExtensionIdentifier
,
DefaultIconPath
}
from
'
vs/platform/extensionManagement/common/extensionManagement
'
;
import
{
getGalleryExtensionId
,
getGalleryExtensionTelemetryData
,
adoptToGalleryExtensionId
}
from
'
vs/platform/extensionManagement/common/extensionManagementUtil
'
;
import
{
assign
,
getOrDefault
}
from
'
vs/base/common/objects
'
;
import
{
getOrDefault
}
from
'
vs/base/common/objects
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IPager
}
from
'
vs/base/common/paging
'
;
import
{
IRequestService
,
asJson
,
asText
}
from
'
vs/platform/request/common/request
'
;
...
...
@@ -158,7 +158,7 @@ class Query {
get
flags
():
number
{
return
this
.
state
.
flags
;
}
withPage
(
pageNumber
:
number
,
pageSize
:
number
=
this
.
state
.
pageSize
):
Query
{
return
new
Query
(
assign
({},
this
.
state
,
{
pageNumber
,
pageSize
})
);
return
new
Query
(
{
...
this
.
state
,
pageNumber
,
pageSize
}
);
}
withFilter
(
filterType
:
FilterType
,
...
values
:
string
[]):
Query
{
...
...
@@ -167,23 +167,23 @@ class Query {
...
values
.
length
?
values
.
map
(
value
=>
({
filterType
,
value
}))
:
[{
filterType
}]
];
return
new
Query
(
assign
({},
this
.
state
,
{
criteria
})
);
return
new
Query
(
{
...
this
.
state
,
criteria
}
);
}
withSortBy
(
sortBy
:
SortBy
):
Query
{
return
new
Query
(
assign
({},
this
.
state
,
{
sortBy
})
);
return
new
Query
(
{
...
this
.
state
,
sortBy
}
);
}
withSortOrder
(
sortOrder
:
SortOrder
):
Query
{
return
new
Query
(
assign
({},
this
.
state
,
{
sortOrder
})
);
return
new
Query
(
{
...
this
.
state
,
sortOrder
}
);
}
withFlags
(...
flags
:
Flags
[]):
Query
{
return
new
Query
(
assign
({},
this
.
state
,
{
flags
:
flags
.
reduce
((
r
,
f
)
=>
r
|
f
,
0
)
})
);
return
new
Query
(
{
...
this
.
state
,
flags
:
flags
.
reduce
<
number
>
((
r
,
f
)
=>
r
|
f
,
0
)
}
);
}
withAssetTypes
(...
assetTypes
:
string
[]):
Query
{
return
new
Query
(
assign
({},
this
.
state
,
{
assetTypes
})
);
return
new
Query
(
{
...
this
.
state
,
assetTypes
}
);
}
get
raw
():
any
{
...
...
@@ -524,12 +524,13 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
}
return
this
.
commonHeadersPromise
.
then
(
commonHeaders
=>
{
const
data
=
JSON
.
stringify
(
query
.
raw
);
const
headers
=
assign
({},
commonHeaders
,
{
const
headers
=
{
...
commonHeaders
,
'
Content-Type
'
:
'
application/json
'
,
'
Accept
'
:
'
application/json;api-version=3.0-preview.1
'
,
'
Accept-Encoding
'
:
'
gzip
'
,
'
Content-Length
'
:
data
.
length
}
)
;
'
Content-Length
'
:
String
(
data
.
length
)
};
return
this
.
requestService
.
request
({
type
:
'
POST
'
,
...
...
@@ -585,7 +586,7 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
]
}
*/
const
log
=
(
duration
:
number
)
=>
this
.
telemetryService
.
publicLog
(
'
galleryService:downloadVSIX
'
,
assign
(
data
,
{
duration
})
);
const
log
=
(
duration
:
number
)
=>
this
.
telemetryService
.
publicLog
(
'
galleryService:downloadVSIX
'
,
{
...
data
,
duration
}
);
const
operationParam
=
operation
===
InstallOperation
.
Install
?
'
install
'
:
operation
===
InstallOperation
.
Update
?
'
update
'
:
''
;
const
downloadAsset
=
operationParam
?
{
...
...
@@ -670,12 +671,12 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
private
getAsset
(
asset
:
IGalleryExtensionAsset
,
options
:
IRequestOptions
=
{},
token
:
CancellationToken
=
CancellationToken
.
None
):
Promise
<
IRequestContext
>
{
return
this
.
commonHeadersPromise
.
then
(
commonHeaders
=>
{
const
baseOptions
=
{
type
:
'
GET
'
};
const
headers
=
assign
({},
commonHeaders
,
options
.
headers
||
{})
;
options
=
assign
({},
options
,
baseOptions
,
{
headers
})
;
const
headers
=
{
...
commonHeaders
,
...(
options
.
headers
||
{})
}
;
options
=
{
...
options
,
...
baseOptions
,
headers
}
;
const
url
=
asset
.
uri
;
const
fallbackUrl
=
asset
.
fallbackUri
;
const
firstOptions
=
assign
({},
options
,
{
url
})
;
const
firstOptions
=
{
...
options
,
url
}
;
return
this
.
requestService
.
request
(
firstOptions
,
token
)
.
then
(
context
=>
{
...
...
@@ -702,7 +703,7 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
};
this
.
telemetryService
.
publicLog2
<
GalleryServiceCDNFallbackEvent
,
GalleryServiceCDNFallbackClassification
>
(
'
galleryService:cdnFallback
'
,
{
url
,
message
});
const
fallbackOptions
=
assign
({},
options
,
{
url
:
fallbackUrl
})
;
const
fallbackOptions
=
{
...
options
,
url
:
fallbackUrl
}
;
return
this
.
requestService
.
request
(
fallbackOptions
,
token
);
});
});
...
...
src/vs/platform/extensionManagement/node/extensionManagementService.ts
浏览文件 @
66db1a70
...
...
@@ -6,7 +6,6 @@
import
*
as
nls
from
'
vs/nls
'
;
import
*
as
path
from
'
vs/base/common/path
'
;
import
*
as
pfs
from
'
vs/base/node/pfs
'
;
import
{
assign
}
from
'
vs/base/common/objects
'
;
import
{
toDisposable
,
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
isNonEmptyArray
}
from
'
vs/base/common/arrays
'
;
import
{
zip
,
IFile
}
from
'
vs/base/node/zip
'
;
...
...
@@ -46,6 +45,7 @@ import { IExtensionManifest, ExtensionType } from 'vs/platform/extensions/common
import
{
ExtensionsDownloader
}
from
'
vs/platform/extensionManagement/node/extensionDownloader
'
;
import
{
ExtensionsScanner
,
IMetadata
}
from
'
vs/platform/extensionManagement/node/extensionsScanner
'
;
import
{
ExtensionsLifecycle
}
from
'
vs/platform/extensionManagement/node/extensionLifecycle
'
;
import
{
IStringDictionary
}
from
'
vs/base/common/collections
'
;
const
INSTALL_ERROR_UNSET_UNINSTALLED
=
'
unsetUninstalled
'
;
const
INSTALL_ERROR_DOWNLOADING
=
'
downloading
'
;
...
...
@@ -677,7 +677,10 @@ export class ExtensionManagementService extends Disposable implements IExtension
private
setUninstalled
(...
extensions
:
ILocalExtension
[]):
Promise
<
{
[
id
:
string
]:
boolean
}
>
{
const
ids
:
ExtensionIdentifierWithVersion
[]
=
extensions
.
map
(
e
=>
new
ExtensionIdentifierWithVersion
(
e
.
identifier
,
e
.
manifest
.
version
));
return
this
.
extensionsScanner
.
withUninstalledExtensions
(
uninstalled
=>
assign
(
uninstalled
,
ids
.
reduce
((
result
,
id
)
=>
{
result
[
id
.
key
()]
=
true
;
return
result
;
},
{}
as
{
[
id
:
string
]:
boolean
})));
return
this
.
extensionsScanner
.
withUninstalledExtensions
(
uninstalled
=>
{
const
newUninstalled
=
(
ids
.
reduce
<
IStringDictionary
<
boolean
>>
((
result
,
id
)
=>
{
result
[
id
.
key
()]
=
true
;
return
result
;
},
{}));
return
{
...
uninstalled
,
...
newUninstalled
};
});
}
private
unsetUninstalled
(
extensionIdentifier
:
ExtensionIdentifierWithVersion
):
Promise
<
void
>
{
...
...
@@ -745,6 +748,6 @@ export class ExtensionManagementService extends Disposable implements IExtension
]
}
*/
this
.
telemetryService
.
publicLogError
(
eventName
,
assign
(
extensionData
,
{
success
:
!
error
,
duration
,
errorcode
})
);
this
.
telemetryService
.
publicLogError
(
eventName
,
{
...
extensionData
,
success
:
!
error
,
duration
,
errorcode
}
);
}
}
src/vs/platform/extensionManagement/node/extensionsScanner.ts
浏览文件 @
66db1a70
...
...
@@ -22,7 +22,7 @@ import { CancellationToken } from 'vscode';
import
{
extract
,
ExtractError
}
from
'
vs/base/node/zip
'
;
import
{
isWindows
}
from
'
vs/base/common/platform
'
;
import
{
flatten
}
from
'
vs/base/common/arrays
'
;
import
{
assign
}
from
'
vs/base/common/object
s
'
;
import
{
IStringDictionary
}
from
'
vs/base/common/collection
s
'
;
const
ERROR_SCANNING_SYS_EXTENSIONS
=
'
scanningSystem
'
;
const
ERROR_SCANNING_USER_EXTENSIONS
=
'
scanningUser
'
;
...
...
@@ -31,6 +31,7 @@ const INSTALL_ERROR_DELETING = 'deleting';
const
INSTALL_ERROR_RENAMING
=
'
renaming
'
;
export
type
IMetadata
=
Partial
<
IGalleryMetadata
&
{
isMachineScoped
:
boolean
;
}
>
;
type
ILocalExtensionManifest
=
IExtensionManifest
&
{
__metadata
?:
IMetadata
};
export
class
ExtensionsScanner
extends
Disposable
{
...
...
@@ -133,7 +134,7 @@ export class ExtensionsScanner extends Disposable {
const
manifestPath
=
path
.
join
(
local
.
location
.
fsPath
,
'
package.json
'
);
const
raw
=
await
pfs
.
readFile
(
manifestPath
,
'
utf8
'
);
const
{
manifest
}
=
await
this
.
parseManifest
(
raw
);
assign
(
manifest
,
{
__metadata
:
metadata
})
;
(
manifest
as
ILocalExtensionManifest
).
__metadata
=
metadata
;
await
pfs
.
writeFile
(
manifestPath
,
JSON
.
stringify
(
manifest
,
null
,
'
\t
'
));
return
local
;
}
...
...
@@ -142,7 +143,7 @@ export class ExtensionsScanner extends Disposable {
return
this
.
withUninstalledExtensions
(
uninstalled
=>
uninstalled
);
}
async
withUninstalledExtensions
<
T
>
(
fn
:
(
uninstalled
:
{
[
id
:
string
]:
boolean
;
}
)
=>
T
):
Promise
<
T
>
{
async
withUninstalledExtensions
<
T
>
(
fn
:
(
uninstalled
:
IStringDictionary
<
boolean
>
)
=>
T
):
Promise
<
T
>
{
return
this
.
uninstalledFileLimiter
.
queue
(
async
()
=>
{
let
result
:
T
|
null
=
null
;
return
pfs
.
readFile
(
this
.
uninstalledPath
,
'
utf8
'
)
...
...
src/vs/platform/request/electron-main/requestMainService.ts
浏览文件 @
66db1a70
...
...
@@ -5,7 +5,6 @@
import
{
IRequestOptions
,
IRequestContext
}
from
'
vs/base/parts/request/common/request
'
;
import
{
RequestService
as
NodeRequestService
,
IRawRequestFunction
}
from
'
vs/platform/request/node/requestService
'
;
import
{
assign
}
from
'
vs/base/common/objects
'
;
import
{
net
}
from
'
electron
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
...
...
@@ -16,6 +15,6 @@ function getRawRequest(options: IRequestOptions): IRawRequestFunction {
export
class
RequestMainService
extends
NodeRequestService
{
request
(
options
:
IRequestOptions
,
token
:
CancellationToken
):
Promise
<
IRequestContext
>
{
return
super
.
request
(
assign
({},
options
||
{},
{
getRawRequest
})
,
token
);
return
super
.
request
(
{
...(
options
||
{}),
getRawRequest
}
,
token
);
}
}
src/vs/platform/request/node/requestService.ts
浏览文件 @
66db1a70
...
...
@@ -9,7 +9,6 @@ import * as streams from 'vs/base/common/stream';
import
{
createGunzip
}
from
'
zlib
'
;
import
{
parse
as
parseUrl
}
from
'
url
'
;
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
assign
}
from
'
vs/base/common/objects
'
;
import
{
isBoolean
,
isNumber
}
from
'
vs/base/common/types
'
;
import
{
canceled
}
from
'
vs/base/common/errors
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
...
...
@@ -67,7 +66,10 @@ export class RequestService extends Disposable implements IRequestService {
options
.
strictSSL
=
strictSSL
;
if
(
this
.
authorization
)
{
options
.
headers
=
assign
(
options
.
headers
||
{},
{
'
Proxy-Authorization
'
:
this
.
authorization
});
options
.
headers
=
{
...(
options
.
headers
||
{}),
'
Proxy-Authorization
'
:
this
.
authorization
};
}
return
this
.
_request
(
options
,
token
);
...
...
@@ -107,10 +109,11 @@ export class RequestService extends Disposable implements IRequestService {
req
=
rawRequest
(
opts
,
(
res
:
http
.
IncomingMessage
)
=>
{
const
followRedirects
:
number
=
isNumber
(
options
.
followRedirects
)
?
options
.
followRedirects
:
3
;
if
(
res
.
statusCode
&&
res
.
statusCode
>=
300
&&
res
.
statusCode
<
400
&&
followRedirects
>
0
&&
res
.
headers
[
'
location
'
])
{
this
.
_request
(
assign
({},
options
,
{
this
.
_request
({
...
options
,
url
:
res
.
headers
[
'
location
'
],
followRedirects
:
followRedirects
-
1
}
)
,
token
).
then
(
c
,
e
);
},
token
).
then
(
c
,
e
);
}
else
{
let
stream
:
streams
.
ReadableStreamEvents
<
Uint8Array
>
=
res
;
...
...
src/vs/platform/userDataSync/common/userDataSyncStoreService.ts
浏览文件 @
66db1a70
...
...
@@ -15,7 +15,6 @@ import { getServiceMachineId } from 'vs/platform/serviceMachineId/common/service
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
import
{
assign
}
from
'
vs/base/common/objects
'
;
import
{
generateUuid
}
from
'
vs/base/common/uuid
'
;
import
{
isWeb
}
from
'
vs/base/common/platform
'
;
import
{
Emitter
,
Event
}
from
'
vs/base/common/event
'
;
...
...
@@ -355,10 +354,12 @@ export class UserDataSyncStoreClient extends Disposable implements IUserDataSync
this
.
setDonotMakeRequestsUntil
(
undefined
);
const
commonHeaders
=
await
this
.
commonHeadersPromise
;
options
.
headers
=
assign
(
options
.
headers
||
{},
commonHeaders
,
{
options
.
headers
=
{
...(
options
.
headers
||
{}),
...
commonHeaders
,
'
X-Account-Type
'
:
this
.
authToken
.
type
,
'
authorization
'
:
`Bearer
${
this
.
authToken
.
token
}
`
,
}
)
;
};
// Add session headers
this
.
addSessionHeaders
(
options
.
headers
);
...
...
src/vs/workbench/contrib/extensions/browser/extensionEditor.ts
浏览文件 @
66db1a70
...
...
@@ -37,7 +37,6 @@ import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import
{
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
KeybindingWeight
}
from
'
vs/platform/keybinding/common/keybindingsRegistry
'
;
import
{
Color
}
from
'
vs/base/common/color
'
;
import
{
assign
}
from
'
vs/base/common/objects
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
ExtensionsTree
,
ExtensionData
,
ExtensionsGridView
,
getExtensions
}
from
'
vs/workbench/contrib/extensions/browser/extensionsViewer
'
;
...
...
@@ -361,7 +360,7 @@ export class ExtensionEditor extends EditorPane {
]
}
*/
this
.
telemetryService
.
publicLog
(
'
extensionGallery:openExtension
'
,
assign
(
extension
.
telemetryData
,
recommendationsData
)
);
this
.
telemetryService
.
publicLog
(
'
extensionGallery:openExtension
'
,
{
...
extension
.
telemetryData
,
...
recommendationsData
}
);
toggleClass
(
template
.
name
,
'
clickable
'
,
!!
extension
.
url
);
toggleClass
(
template
.
publisher
,
'
clickable
'
,
!!
extension
.
url
);
...
...
@@ -556,7 +555,7 @@ export class ExtensionEditor extends EditorPane {
]
}
*/
this
.
telemetryService
.
publicLog
(
'
extensionEditor:navbarChange
'
,
assign
(
extension
.
telemetryData
,
{
navItem
:
id
})
);
this
.
telemetryService
.
publicLog
(
'
extensionEditor:navbarChange
'
,
{
...
extension
.
telemetryData
,
navItem
:
id
}
);
}
this
.
contentDisposables
.
clear
();
...
...
src/vs/workbench/contrib/extensions/browser/extensionRecommendationsService.ts
浏览文件 @
66db1a70
...
...
@@ -13,7 +13,6 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
distinct
,
shuffle
}
from
'
vs/base/common/arrays
'
;
import
{
Emitter
,
Event
}
from
'
vs/base/common/event
'
;
import
{
assign
}
from
'
vs/base/common/objects
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
LifecyclePhase
,
ILifecycleService
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
DynamicWorkspaceRecommendations
}
from
'
vs/workbench/contrib/extensions/browser/dynamicWorkspaceRecommendations
'
;
...
...
@@ -260,7 +259,7 @@ export class ExtensionRecommendationsService extends Disposable implements IExte
]
}
*/
this
.
telemetryService
.
publicLog
(
'
extensionGallery:install:recommendations
'
,
assign
(
e
.
gallery
.
telemetryData
,
{
recommendationReason
:
recommendationReason
.
reasonId
})
);
this
.
telemetryService
.
publicLog
(
'
extensionGallery:install:recommendations
'
,
{
...
e
.
gallery
.
telemetryData
,
recommendationReason
:
recommendationReason
.
reasonId
}
);
}
}
}
...
...
src/vs/workbench/contrib/extensions/browser/extensionsViews.ts
浏览文件 @
66db1a70
...
...
@@ -5,7 +5,6 @@
import
{
localize
}
from
'
vs/nls
'
;
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
assign
}
from
'
vs/base/common/objects
'
;
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
isPromiseCanceledError
,
getErrorMessage
}
from
'
vs/base/common/errors
'
;
import
{
PagedModel
,
IPagedModel
,
IPager
,
DelayedPagedModel
}
from
'
vs/base/common/paging
'
;
...
...
@@ -198,10 +197,10 @@ export class ExtensionsListView extends ViewPane {
};
switch
(
parsedQuery
.
sortBy
)
{
case
'
installs
'
:
options
=
assign
(
options
,
{
sortBy
:
SortBy
.
InstallCount
})
;
break
;
case
'
rating
'
:
options
=
assign
(
options
,
{
sortBy
:
SortBy
.
WeightedRating
})
;
break
;
case
'
name
'
:
options
=
assign
(
options
,
{
sortBy
:
SortBy
.
Title
})
;
break
;
case
'
publishedDate
'
:
options
=
assign
(
options
,
{
sortBy
:
SortBy
.
PublishedDate
})
;
break
;
case
'
installs
'
:
options
.
sortBy
=
SortBy
.
InstallCount
;
break
;
case
'
rating
'
:
options
.
sortBy
=
SortBy
.
WeightedRating
;
break
;
case
'
name
'
:
options
.
sortBy
=
SortBy
.
Title
;
break
;
case
'
publishedDate
'
:
options
.
sortBy
=
SortBy
.
PublishedDate
;
break
;
}
const
successCallback
=
(
model
:
IPagedModel
<
IExtension
>
)
=>
{
...
...
@@ -472,13 +471,15 @@ export class ExtensionsListView extends ViewPane {
const
text
=
query
.
value
;
if
(
/
\b
ext:
([^\s]
+
)\b
/g
.
test
(
text
))
{
options
=
assign
(
options
,
{
text
,
source
:
'
file-extension-tags
'
});
options
.
text
=
text
;
options
.
source
=
'
file-extension-tags
'
;
return
this
.
extensionsWorkbenchService
.
queryGallery
(
options
,
token
).
then
(
pager
=>
this
.
getPagedModel
(
pager
));
}
let
preferredResults
:
string
[]
=
[];
if
(
text
)
{
options
=
assign
(
options
,
{
text
:
text
.
substr
(
0
,
350
),
source
:
'
searchText
'
});
options
.
text
=
text
.
substr
(
0
,
350
);
options
.
source
=
'
searchText
'
;
if
(
!
hasUserDefinedSortOrder
)
{
const
searchExperiments
=
await
this
.
getSearchExperiments
();
for
(
const
experiment
of
searchExperiments
)
{
...
...
@@ -544,7 +545,9 @@ export class ExtensionsListView extends ViewPane {
const
names
=
await
this
.
experimentService
.
getCuratedExtensionsList
(
value
);
if
(
Array
.
isArray
(
names
)
&&
names
.
length
)
{
options
.
source
=
`curated:
${
value
}
`
;
const
pager
=
await
this
.
extensionsWorkbenchService
.
queryGallery
(
assign
(
options
,
{
names
,
pageSize
:
names
.
length
}),
token
);
options
.
names
=
names
;
options
.
pageSize
=
names
.
length
;
const
pager
=
await
this
.
extensionsWorkbenchService
.
queryGallery
(
options
,
token
);
this
.
sortFirstPage
(
pager
,
names
);
return
this
.
getPagedModel
(
pager
||
[]);
}
...
...
src/vs/workbench/contrib/extensions/test/electron-browser/extensionRecommendationsService.test.ts
浏览文件 @
66db1a70
...
...
@@ -30,7 +30,6 @@ import { URI } from 'vs/base/common/uri';
import
{
testWorkspace
}
from
'
vs/platform/workspace/test/common/testWorkspace
'
;
import
{
TestConfigurationService
}
from
'
vs/platform/configuration/test/common/testConfigurationService
'
;
import
{
IPager
}
from
'
vs/base/common/paging
'
;
import
{
assign
}
from
'
vs/base/common/objects
'
;
import
{
getGalleryExtensionId
}
from
'
vs/platform/extensionManagement/common/extensionManagementUtil
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
ConfigurationKey
,
IExtensionsWorkbenchService
}
from
'
vs/workbench/contrib/extensions/common/extensions
'
;
...
...
@@ -166,10 +165,9 @@ const noAssets: IGalleryExtensionAssets = {
};
function
aGalleryExtension
(
name
:
string
,
properties
:
any
=
{},
galleryExtensionProperties
:
any
=
{},
assets
:
IGalleryExtensionAssets
=
noAssets
):
IGalleryExtension
{
const
galleryExtension
=
<
IGalleryExtension
>
Object
.
create
({});
assign
(
galleryExtension
,
{
name
,
publisher
:
'
pub
'
,
version
:
'
1.0.0
'
,
properties
:
{},
assets
:
{}
},
properties
);
assign
(
galleryExtension
.
properties
,
{
dependencies
:
[]
},
galleryExtensionProperties
);
assign
(
galleryExtension
.
assets
,
assets
);
const
galleryExtension
=
<
IGalleryExtension
>
Object
.
create
({
name
,
publisher
:
'
pub
'
,
version
:
'
1.0.0
'
,
properties
:
{},
assets
:
{},
...
properties
});
galleryExtension
.
properties
=
{
...
galleryExtension
.
properties
,
dependencies
:
[],
...
galleryExtensionProperties
};
galleryExtension
.
assets
=
{
...
galleryExtension
.
assets
,
...
assets
};
galleryExtension
.
identifier
=
{
id
:
getGalleryExtensionId
(
galleryExtension
.
publisher
,
galleryExtension
.
name
),
uuid
:
uuid
.
generateUuid
()
};
return
<
IGalleryExtension
>
galleryExtension
;
}
...
...
src/vs/workbench/contrib/extensions/test/electron-browser/extensionsActions.test.ts
浏览文件 @
66db1a70
...
...
@@ -4,7 +4,6 @@
*--------------------------------------------------------------------------------------------*/
import
*
as
assert
from
'
assert
'
;
import
{
assign
}
from
'
vs/base/common/objects
'
;
import
{
generateUuid
}
from
'
vs/base/common/uuid
'
;
import
{
IExtensionsWorkbenchService
,
ExtensionContainers
}
from
'
vs/workbench/contrib/extensions/common/extensions
'
;
import
*
as
ExtensionsActions
from
'
vs/workbench/contrib/extensions/browser/extensionsActions
'
;
...
...
@@ -2494,20 +2493,20 @@ suite('LocalInstallAction', () => {
});
function
aLocalExtension
(
name
:
string
=
'
someext
'
,
manifest
:
any
=
{},
properties
:
any
=
{}):
ILocalExtension
{
manifest
=
assign
({
name
,
publisher
:
'
pub
'
,
version
:
'
1.0.0
'
},
manifest
)
;
properties
=
assign
(
{
manifest
=
{
name
,
publisher
:
'
pub
'
,
version
:
'
1.0.0
'
,
...
manifest
}
;
properties
=
{
type
:
ExtensionType
.
User
,
location
:
URI
.
file
(
`pub.
${
name
}
`
),
identifier
:
{
id
:
getGalleryExtensionId
(
manifest
.
publisher
,
manifest
.
name
)
}
},
properties
);
identifier
:
{
id
:
getGalleryExtensionId
(
manifest
.
publisher
,
manifest
.
name
)
},
...
properties
};
return
<
ILocalExtension
>
Object
.
create
({
manifest
,
...
properties
});
}
function
aGalleryExtension
(
name
:
string
,
properties
:
any
=
{},
galleryExtensionProperties
:
any
=
{},
assets
:
any
=
{}):
IGalleryExtension
{
const
galleryExtension
=
<
IGalleryExtension
>
Object
.
create
({});
assign
(
galleryExtension
,
{
name
,
publisher
:
'
pub
'
,
version
:
'
1.0.0
'
,
properties
:
{},
assets
:
{}
},
properties
);
assign
(
galleryExtension
.
properties
,
{
dependencies
:
[]
},
galleryExtensionProperties
);
assign
(
galleryExtension
.
assets
,
assets
);
const
galleryExtension
=
<
IGalleryExtension
>
Object
.
create
({
name
,
publisher
:
'
pub
'
,
version
:
'
1.0.0
'
,
properties
:
{},
assets
:
{},
...
properties
});
galleryExtension
.
properties
=
{
...
galleryExtension
.
properties
,
dependencies
:
[],
...
galleryExtensionProperties
};
galleryExtension
.
assets
=
{
...
galleryExtension
.
assets
,
...
assets
};
galleryExtension
.
identifier
=
{
id
:
getGalleryExtensionId
(
galleryExtension
.
publisher
,
galleryExtension
.
name
),
uuid
:
generateUuid
()
};
return
<
IGalleryExtension
>
galleryExtension
;
}
...
...
src/vs/workbench/contrib/extensions/test/electron-browser/extensionsViews.test.ts
浏览文件 @
66db1a70
...
...
@@ -4,7 +4,6 @@
*--------------------------------------------------------------------------------------------*/
import
*
as
assert
from
'
assert
'
;
import
{
assign
}
from
'
vs/base/common/objects
'
;
import
{
generateUuid
}
from
'
vs/base/common/uuid
'
;
import
{
ExtensionsListView
}
from
'
vs/workbench/contrib/extensions/browser/extensionsViews
'
;
import
{
TestInstantiationService
}
from
'
vs/platform/instantiation/test/common/instantiationServiceMock
'
;
...
...
@@ -525,21 +524,21 @@ suite('ExtensionsListView Tests', () => {
});
function
aLocalExtension
(
name
:
string
=
'
someext
'
,
manifest
:
any
=
{},
properties
:
any
=
{}):
ILocalExtension
{
manifest
=
assign
({
name
,
publisher
:
'
pub
'
,
version
:
'
1.0.0
'
},
manifest
)
;
properties
=
assign
(
{
manifest
=
{
name
,
publisher
:
'
pub
'
,
version
:
'
1.0.0
'
,
...
manifest
}
;
properties
=
{
type
:
ExtensionType
.
User
,
location
:
URI
.
file
(
`pub.
${
name
}
`
),
identifier
:
{
id
:
getGalleryExtensionId
(
manifest
.
publisher
,
manifest
.
name
),
uuid
:
undefined
},
metadata
:
{
id
:
getGalleryExtensionId
(
manifest
.
publisher
,
manifest
.
name
),
publisherId
:
manifest
.
publisher
,
publisherDisplayName
:
'
somename
'
}
},
properties
);
identifier
:
{
id
:
getGalleryExtensionId
(
manifest
.
publisher
,
manifest
.
name
)
},
metadata
:
{
id
:
getGalleryExtensionId
(
manifest
.
publisher
,
manifest
.
name
),
publisherId
:
manifest
.
publisher
,
publisherDisplayName
:
'
somename
'
},
...
properties
};
return
<
ILocalExtension
>
Object
.
create
({
manifest
,
...
properties
});
}
function
aGalleryExtension
(
name
:
string
,
properties
:
any
=
{},
galleryExtensionProperties
:
any
=
{},
assets
:
any
=
{}):
IGalleryExtension
{
const
galleryExtension
=
<
IGalleryExtension
>
Object
.
create
({});
assign
(
galleryExtension
,
{
name
,
publisher
:
'
pub
'
,
version
:
'
1.0.0
'
,
properties
:
{},
assets
:
{}
},
properties
);
assign
(
galleryExtension
.
properties
,
{
dependencies
:
[]
},
galleryExtensionProperties
);
assign
(
galleryExtension
.
assets
,
assets
);
const
galleryExtension
=
<
IGalleryExtension
>
Object
.
create
({
name
,
publisher
:
'
pub
'
,
version
:
'
1.0.0
'
,
properties
:
{},
assets
:
{},
...
properties
});
galleryExtension
.
properties
=
{
...
galleryExtension
.
properties
,
dependencies
:
[],
...
galleryExtensionProperties
};
galleryExtension
.
assets
=
{
...
galleryExtension
.
assets
,
...
assets
};
galleryExtension
.
identifier
=
{
id
:
getGalleryExtensionId
(
galleryExtension
.
publisher
,
galleryExtension
.
name
),
uuid
:
generateUuid
()
};
return
<
IGalleryExtension
>
galleryExtension
;
}
...
...
src/vs/workbench/contrib/extensions/test/electron-browser/extensionsWorkbenchService.test.ts
浏览文件 @
66db1a70
...
...
@@ -6,7 +6,6 @@
import
*
as
sinon
from
'
sinon
'
;
import
*
as
assert
from
'
assert
'
;
import
*
as
fs
from
'
fs
'
;
import
{
assign
}
from
'
vs/base/common/objects
'
;
import
{
generateUuid
}
from
'
vs/base/common/uuid
'
;
import
{
IExtensionsWorkbenchService
,
ExtensionState
,
AutoCheckUpdatesConfigurationKey
,
AutoUpdateConfigurationKey
}
from
'
vs/workbench/contrib/extensions/common/extensions
'
;
import
{
ExtensionsWorkbenchService
}
from
'
vs/workbench/contrib/extensions/browser/extensionsWorkbenchService
'
;
...
...
@@ -1368,12 +1367,13 @@ suite('ExtensionsWorkbenchServiceTest', () => {
}
function
aLocalExtension
(
name
:
string
=
'
someext
'
,
manifest
:
any
=
{},
properties
:
any
=
{}):
ILocalExtension
{
manifest
=
assign
({
name
,
publisher
:
'
pub
'
,
version
:
'
1.0.0
'
},
manifest
)
;
properties
=
assign
(
{
manifest
=
{
name
,
publisher
:
'
pub
'
,
version
:
'
1.0.0
'
,
...
manifest
}
;
properties
=
{
type
:
ExtensionType
.
User
,
location
:
URI
.
file
(
`pub.
${
name
}
`
),
identifier
:
{
id
:
getGalleryExtensionId
(
manifest
.
publisher
,
manifest
.
name
)
}
},
properties
);
identifier
:
{
id
:
getGalleryExtensionId
(
manifest
.
publisher
,
manifest
.
name
)
},
...
properties
};
return
<
ILocalExtension
>
Object
.
create
({
manifest
,
...
properties
});
}
...
...
@@ -1389,10 +1389,9 @@ suite('ExtensionsWorkbenchServiceTest', () => {
};
function
aGalleryExtension
(
name
:
string
,
properties
:
any
=
{},
galleryExtensionProperties
:
any
=
{},
assets
:
IGalleryExtensionAssets
=
noAssets
):
IGalleryExtension
{
const
galleryExtension
=
<
IGalleryExtension
>
Object
.
create
({});
assign
(
galleryExtension
,
{
name
,
publisher
:
'
pub
'
,
version
:
'
1.0.0
'
,
properties
:
{},
assets
:
{}
},
properties
);
assign
(
galleryExtension
.
properties
,
{
dependencies
:
[]
},
galleryExtensionProperties
);
assign
(
galleryExtension
.
assets
,
assets
);
const
galleryExtension
=
<
IGalleryExtension
>
Object
.
create
({
name
,
publisher
:
'
pub
'
,
version
:
'
1.0.0
'
,
properties
:
{},
assets
:
{},
...
properties
});
galleryExtension
.
properties
=
{
...
galleryExtension
.
properties
,
dependencies
:
[],
...
galleryExtensionProperties
};
galleryExtension
.
assets
=
{
...
galleryExtension
.
assets
,
...
assets
};
galleryExtension
.
identifier
=
{
id
:
getGalleryExtensionId
(
galleryExtension
.
publisher
,
galleryExtension
.
name
),
uuid
:
generateUuid
()
};
return
<
IGalleryExtension
>
galleryExtension
;
}
...
...
src/vs/workbench/services/extensionManagement/test/browser/extensionEnablementService.test.ts
浏览文件 @
66db1a70
...
...
@@ -19,7 +19,6 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
REMOTE_HOST_SCHEME
}
from
'
vs/platform/remote/common/remoteHosts
'
;
import
{
assign
}
from
'
vs/base/common/objects
'
;
import
{
TestConfigurationService
}
from
'
vs/platform/configuration/test/common/testConfigurationService
'
;
import
{
productService
}
from
'
vs/workbench/test/browser/workbenchTestServices
'
;
import
{
GlobalExtensionEnablementService
}
from
'
vs/platform/extensionManagement/common/extensionEnablementService
'
;
...
...
@@ -608,11 +607,12 @@ function aLocalExtension(id: string, contributes?: IExtensionContributions, type
function
aLocalExtension2
(
id
:
string
,
manifest
:
any
=
{},
properties
:
any
=
{}):
ILocalExtension
{
const
[
publisher
,
name
]
=
id
.
split
(
'
.
'
);
properties
=
assign
({
manifest
=
{
name
,
publisher
,
...
manifest
};
properties
=
{
identifier
:
{
id
},
galleryIdentifier
:
{
id
,
uuid
:
undefined
},
type
:
ExtensionType
.
User
},
properties
);
manifest
=
assign
({
name
,
publisher
},
manifest
)
;
type
:
ExtensionType
.
User
,
...
properties
}
;
return
<
ILocalExtension
>
Object
.
create
({
manifest
,
...
properties
});
}
src/vs/workbench/services/preferences/browser/preferencesService.ts
浏览文件 @
66db1a70
...
...
@@ -7,7 +7,6 @@ import { Emitter } from 'vs/base/common/event';
import
{
parse
}
from
'
vs/base/common/json
'
;
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
*
as
network
from
'
vs/base/common/network
'
;
import
{
assign
}
from
'
vs/base/common/objects
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
getCodeEditor
,
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
IPosition
}
from
'
vs/editor/common/core/position
'
;
...
...
@@ -346,7 +345,7 @@ export class PreferencesService extends Disposable implements IPreferencesServic
if
(
!
options
)
{
options
=
{
pinned
:
true
};
}
else
{
options
=
assign
(
options
,
{
pinned
:
true
})
;
options
=
{
...
options
,
pinned
:
true
}
;
}
if
(
openDefaultSettings
)
{
...
...
@@ -368,7 +367,7 @@ export class PreferencesService extends Disposable implements IPreferencesServic
if
(
!
options
)
{
options
=
{
pinned
:
true
};
}
else
{
options
=
assign
(
options
,
{
pinned
:
true
})
;
options
=
{
...
options
,
pinned
:
true
}
;
}
const
defaultPreferencesEditorInput
=
this
.
instantiationService
.
createInstance
(
DefaultPreferencesEditorInput
,
this
.
getDefaultSettingsResource
(
configurationTarget
));
...
...
src/vs/workbench/test/browser/api/extHostConfiguration.test.ts
浏览文件 @
66db1a70
...
...
@@ -14,7 +14,6 @@ import { mock } from 'vs/base/test/common/mock';
import
{
IWorkspaceFolder
,
WorkspaceFolder
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
ConfigurationTarget
,
IConfigurationModel
,
IConfigurationChange
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
NullLogService
}
from
'
vs/platform/log/common/log
'
;
import
{
assign
}
from
'
vs/base/common/objects
'
;
import
{
IExtHostInitDataService
}
from
'
vs/workbench/api/common/extHostInitDataService
'
;
suite
(
'
ExtHostConfiguration
'
,
function
()
{
...
...
@@ -211,20 +210,22 @@ suite('ExtHostConfiguration', function () {
}),
JSON
.
stringify
(
actual
));
actual
=
all
.
getConfiguration
(
'
workbench
'
).
get
(
'
emptyobjectkey
'
);
actual
=
assign
(
actual
||
{},
{
actual
=
{
...(
actual
||
{}),
'
statusBar.background
'
:
`#0ff`
,
'
statusBar.foreground
'
:
`#ff0`
,
}
)
;
};
assert
.
deepEqual
(
JSON
.
stringify
({
'
statusBar.background
'
:
`#0ff`
,
'
statusBar.foreground
'
:
`#ff0`
,
}),
JSON
.
stringify
(
actual
));
actual
=
all
.
getConfiguration
(
'
workbench
'
).
get
(
'
unknownkey
'
);
actual
=
assign
(
actual
||
{},
{
actual
=
{
...(
actual
||
{}),
'
statusBar.background
'
:
`#0ff`
,
'
statusBar.foreground
'
:
`#ff0`
,
}
)
;
};
assert
.
deepEqual
(
JSON
.
stringify
({
'
statusBar.background
'
:
`#0ff`
,
'
statusBar.foreground
'
:
`#ff0`
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录