Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
ee8378e8
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,发现更多精彩内容 >>
提交
ee8378e8
编写于
9月 25, 2020
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
file access - merge asDomUri into
上级
dab1430b
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
17 addition
and
27 deletion
+17
-27
src/vs/base/browser/dom.ts
src/vs/base/browser/dom.ts
+2
-14
src/vs/base/browser/markdownRenderer.ts
src/vs/base/browser/markdownRenderer.ts
+2
-2
src/vs/base/common/network.ts
src/vs/base/common/network.ts
+4
-0
src/vs/workbench/browser/dnd.ts
src/vs/workbench/browser/dnd.ts
+3
-3
src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts
.../contrib/extensions/browser/extensionsWorkbenchService.ts
+1
-2
src/vs/workbench/contrib/files/browser/fileActions.ts
src/vs/workbench/contrib/files/browser/fileActions.ts
+3
-3
src/vs/workbench/services/extensionResourceLoader/browser/extensionResourceLoaderService.ts
...nResourceLoader/browser/extensionResourceLoaderService.ts
+2
-3
未找到文件。
src/vs/base/browser/dom.ts
浏览文件 @
ee8378e8
...
...
@@ -13,7 +13,7 @@ import { Emitter, Event } from 'vs/base/common/event';
import
{
Disposable
,
IDisposable
,
toDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
*
as
platform
from
'
vs/base/common/platform
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
Schemas
,
FileAccess
,
RemoteAuthorities
}
from
'
vs/base/common/network
'
;
import
{
FileAccess
,
RemoteAuthorities
}
from
'
vs/base/common/network
'
;
import
{
BrowserFeatures
}
from
'
vs/base/browser/canIUse
'
;
export
function
clearNode
(
node
:
HTMLElement
):
void
{
...
...
@@ -1219,18 +1219,6 @@ export function animate(fn: () => void): IDisposable {
RemoteAuthorities
.
setPreferredWebSchema
(
/^https:/
.
test
(
window
.
location
.
href
)
?
'
https
'
:
'
http
'
);
export
function
asDomUri
(
uri
:
URI
):
URI
{
if
(
!
uri
)
{
return
uri
;
}
if
(
uri
.
scheme
===
Schemas
.
vscodeRemote
)
{
return
RemoteAuthorities
.
rewrite
(
uri
);
}
return
FileAccess
.
asBrowserUri
(
uri
);
}
/**
* returns url('...')
*/
...
...
@@ -1238,7 +1226,7 @@ export function asCSSUrl(uri: URI): string {
if
(
!
uri
)
{
return
`url('')`
;
}
return
`url('
${
asDom
Uri
(
uri
).
toString
(
true
).
replace
(
/'/g
,
'
%27
'
)}
')`
;
return
`url('
${
FileAccess
.
asBrowser
Uri
(
uri
).
toString
(
true
).
replace
(
/'/g
,
'
%27
'
)}
')`
;
}
...
...
src/vs/base/browser/markdownRenderer.ts
浏览文件 @
ee8378e8
...
...
@@ -14,7 +14,7 @@ import { parse } from 'vs/base/common/marshalling';
import
{
cloneAndChange
}
from
'
vs/base/common/objects
'
;
import
{
escape
}
from
'
vs/base/common/strings
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
FileAccess
,
Schemas
}
from
'
vs/base/common/network
'
;
import
{
markdownEscapeEscapedCodicons
}
from
'
vs/base/common/codicons
'
;
import
{
resolvePath
}
from
'
vs/base/common/resources
'
;
import
{
StandardMouseEvent
}
from
'
vs/base/browser/mouseEvent
'
;
...
...
@@ -70,7 +70,7 @@ export function renderMarkdown(markdown: IMarkdownString, options: MarkdownRende
// and because of that special rewriting needs to be done
// so that the URI uses a protocol that's understood by
// browsers (like http or https)
return
DOM
.
asDom
Uri
(
uri
).
toString
(
true
);
return
FileAccess
.
asBrowser
Uri
(
uri
).
toString
(
true
);
}
if
(
uri
.
query
)
{
uri
=
uri
.
with
({
query
:
_uriMassage
(
uri
.
query
)
});
...
...
src/vs/base/common/network.ts
浏览文件 @
ee8378e8
...
...
@@ -141,6 +141,10 @@ class FileAccessImpl {
asBrowserUri
(
uriOrModule
:
URI
|
string
,
moduleIdToUrl
?:
{
toUrl
(
moduleId
:
string
):
string
}):
URI
{
const
uri
=
this
.
toUri
(
uriOrModule
,
moduleIdToUrl
);
if
(
uri
.
scheme
===
Schemas
.
vscodeRemote
)
{
return
RemoteAuthorities
.
rewrite
(
uri
);
}
return
uri
;
}
...
...
src/vs/workbench/browser/dnd.ts
浏览文件 @
ee8378e8
...
...
@@ -10,7 +10,7 @@ import { IFileService } from 'vs/platform/files/common/files';
import
{
IWindowOpenable
}
from
'
vs/platform/windows/common/windows
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
ITextFileService
,
stringToSnapshot
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
FileAccess
,
Schemas
}
from
'
vs/base/common/network
'
;
import
{
ITextEditorOptions
}
from
'
vs/platform/editor/common/editor
'
;
import
{
DataTransfers
,
IDragAndDropData
}
from
'
vs/base/browser/dnd
'
;
import
{
DragMouseEvent
}
from
'
vs/base/browser/mouseEvent
'
;
...
...
@@ -22,7 +22,7 @@ import { isCodeEditor } from 'vs/editor/browser/editorBrowser';
import
{
IEditorIdentifier
,
GroupIdentifier
}
from
'
vs/workbench/common/editor
'
;
import
{
IEditorService
,
IResourceEditorInputType
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
Disposable
,
IDisposable
,
DisposableStore
}
from
'
vs/base/common/lifecycle
'
;
import
{
addDisposableListener
,
EventType
,
asDomUri
}
from
'
vs/base/browser/dom
'
;
import
{
addDisposableListener
,
EventType
}
from
'
vs/base/browser/dom
'
;
import
{
IEditorGroup
}
from
'
vs/workbench/services/editor/common/editorGroupsService
'
;
import
{
IWorkspaceEditingService
}
from
'
vs/workbench/services/workspaces/common/workspaceEditing
'
;
import
{
withNullAsUndefined
}
from
'
vs/base/common/types
'
;
...
...
@@ -322,7 +322,7 @@ export function fillResourceDataTransfers(accessor: ServicesAccessor, resources:
// Download URL: enables support to drag a tab as file to desktop (only single file supported)
// Disabled for PWA web due to: https://github.com/microsoft/vscode/issues/83441
if
(
!
sources
[
0
].
isDirectory
&&
(
!
isWeb
||
!
isStandalone
))
{
event
.
dataTransfer
.
setData
(
DataTransfers
.
DOWNLOAD_URL
,
[
MIME_BINARY
,
basename
(
sources
[
0
].
resource
),
asDom
Uri
(
sources
[
0
].
resource
).
toString
()].
join
(
'
:
'
));
event
.
dataTransfer
.
setData
(
DataTransfers
.
DOWNLOAD_URL
,
[
MIME_BINARY
,
basename
(
sources
[
0
].
resource
),
FileAccess
.
asBrowser
Uri
(
sources
[
0
].
resource
).
toString
()].
join
(
'
:
'
));
}
// Resource URLs: allows to drop multiple resources to a target in VS Code (not directories)
...
...
src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts
浏览文件 @
ee8378e8
...
...
@@ -36,7 +36,6 @@ import { IFileService } from 'vs/platform/files/common/files';
import
{
IExtensionManifest
,
ExtensionType
,
IExtension
as
IPlatformExtension
,
isLanguagePackExtension
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
IProductService
}
from
'
vs/platform/product/common/productService
'
;
import
{
asDomUri
}
from
'
vs/base/browser/dom
'
;
import
{
getIgnoredExtensions
}
from
'
vs/platform/userDataSync/common/extensionsMerge
'
;
import
{
isWeb
}
from
'
vs/base/common/platform
'
;
import
{
getExtensionKind
}
from
'
vs/workbench/services/extensions/common/extensionsUtil
'
;
...
...
@@ -135,7 +134,7 @@ class Extension implements IExtension {
private
get
localIconUrl
():
string
|
null
{
if
(
this
.
local
&&
this
.
local
.
manifest
.
icon
)
{
return
asDom
Uri
(
resources
.
joinPath
(
this
.
local
.
location
,
this
.
local
.
manifest
.
icon
)).
toString
(
true
);
return
FileAccess
.
asBrowser
Uri
(
resources
.
joinPath
(
this
.
local
.
location
,
this
.
local
.
manifest
.
icon
)).
toString
(
true
);
}
return
null
;
}
...
...
src/vs/workbench/contrib/files/browser/fileActions.ts
浏览文件 @
ee8378e8
...
...
@@ -30,7 +30,7 @@ import { IModeService } from 'vs/editor/common/services/modeService';
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
ICommandService
,
CommandsRegistry
}
from
'
vs/platform/commands/common/commands
'
;
import
{
RawContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
FileAccess
,
Schemas
}
from
'
vs/base/common/network
'
;
import
{
IDialogService
,
IConfirmationResult
,
getFileNamesMessage
,
IFileDialogService
}
from
'
vs/platform/dialogs/common/dialogs
'
;
import
{
INotificationService
,
Severity
}
from
'
vs/platform/notification/common/notification
'
;
import
{
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
...
...
@@ -39,7 +39,7 @@ import { CLOSE_EDITORS_AND_GROUP_COMMAND_ID } from 'vs/workbench/browser/parts/e
import
{
coalesce
}
from
'
vs/base/common/arrays
'
;
import
{
ExplorerItem
,
NewExplorerItem
}
from
'
vs/workbench/contrib/files/common/explorerModel
'
;
import
{
getErrorMessage
}
from
'
vs/base/common/errors
'
;
import
{
triggerDownload
,
asDomUri
}
from
'
vs/base/browser/dom
'
;
import
{
triggerDownload
}
from
'
vs/base/browser/dom
'
;
import
{
mnemonicButtonLabel
}
from
'
vs/base/common/labels
'
;
import
{
IFilesConfigurationService
}
from
'
vs/workbench/services/filesConfiguration/common/filesConfigurationService
'
;
import
{
IWorkingCopyService
,
IWorkingCopy
}
from
'
vs/workbench/services/workingCopy/common/workingCopyService
'
;
...
...
@@ -1015,7 +1015,7 @@ const downloadFileHandler = (accessor: ServicesAccessor) => {
try
{
bufferOrUri
=
(
await
fileService
.
readFile
(
s
.
resource
,
{
limits
:
{
size
:
1024
*
1024
/* set a limit to reduce memory pressure */
}
})).
value
.
buffer
;
}
catch
(
error
)
{
bufferOrUri
=
asDom
Uri
(
s
.
resource
);
bufferOrUri
=
FileAccess
.
asBrowser
Uri
(
s
.
resource
);
}
triggerDownload
(
bufferOrUri
,
s
.
name
);
...
...
src/vs/workbench/services/extensionResourceLoader/browser/extensionResourceLoaderService.ts
浏览文件 @
ee8378e8
...
...
@@ -7,8 +7,7 @@ import { URI } from 'vs/base/common/uri';
import
{
registerSingleton
}
from
'
vs/platform/instantiation/common/extensions
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
IExtensionResourceLoaderService
}
from
'
vs/workbench/services/extensionResourceLoader/common/extensionResourceLoader
'
;
import
*
as
dom
from
'
vs/base/browser/dom
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
FileAccess
,
Schemas
}
from
'
vs/base/common/network
'
;
class
ExtensionResourceLoaderService
implements
IExtensionResourceLoaderService
{
...
...
@@ -19,7 +18,7 @@ class ExtensionResourceLoaderService implements IExtensionResourceLoaderService
)
{
}
async
readExtensionResource
(
uri
:
URI
):
Promise
<
string
>
{
uri
=
dom
.
asDom
Uri
(
uri
);
uri
=
FileAccess
.
asBrowser
Uri
(
uri
);
if
(
uri
.
scheme
!==
Schemas
.
http
&&
uri
.
scheme
!==
Schemas
.
https
)
{
const
result
=
await
this
.
_fileService
.
readFile
(
uri
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录