Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
ee27818f
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,发现更多精彩内容 >>
提交
ee27818f
编写于
4月 23, 2019
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
💄
- less usage of URI.fsPath
上级
58b38d5e
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
23 addition
and
15 deletion
+23
-15
src/vs/base/common/resources.ts
src/vs/base/common/resources.ts
+1
-1
src/vs/platform/workspaces/common/workspaces.ts
src/vs/platform/workspaces/common/workspaces.ts
+5
-3
src/vs/platform/workspaces/electron-main/workspacesMainService.ts
...latform/workspaces/electron-main/workspacesMainService.ts
+1
-1
src/vs/workbench/api/common/apiCommands.ts
src/vs/workbench/api/common/apiCommands.ts
+1
-1
src/vs/workbench/browser/dnd.ts
src/vs/workbench/browser/dnd.ts
+1
-1
src/vs/workbench/browser/parts/editor/editorGroupView.ts
src/vs/workbench/browser/parts/editor/editorGroupView.ts
+5
-3
src/vs/workbench/browser/parts/editor/editorWidgets.ts
src/vs/workbench/browser/parts/editor/editorWidgets.ts
+1
-1
src/vs/workbench/browser/parts/titlebar/titlebarPart.ts
src/vs/workbench/browser/parts/titlebar/titlebarPart.ts
+2
-1
src/vs/workbench/contrib/files/browser/files.contribution.ts
src/vs/workbench/contrib/files/browser/files.contribution.ts
+2
-1
src/vs/workbench/services/textfile/common/textFileEditorModel.ts
...workbench/services/textfile/common/textFileEditorModel.ts
+4
-2
未找到文件。
src/vs/base/common/resources.ts
浏览文件 @
ee27818f
...
@@ -146,7 +146,7 @@ export function normalizePath(resource: URI): URI {
...
@@ -146,7 +146,7 @@ export function normalizePath(resource: URI): URI {
export
function
originalFSPath
(
uri
:
URI
):
string
{
export
function
originalFSPath
(
uri
:
URI
):
string
{
let
value
:
string
;
let
value
:
string
;
const
uriPath
=
uri
.
path
;
const
uriPath
=
uri
.
path
;
if
(
uri
.
authority
&&
uriPath
.
length
>
1
&&
uri
.
scheme
===
'
file
'
)
{
if
(
uri
.
authority
&&
uriPath
.
length
>
1
&&
uri
.
scheme
===
Schemas
.
file
)
{
// unc path: file://shares/c$/far/boo
// unc path: file://shares/c$/far/boo
value
=
`//
${
uri
.
authority
}${
uriPath
}
`
;
value
=
`//
${
uri
.
authority
}${
uriPath
}
`
;
}
else
if
(
}
else
if
(
...
...
src/vs/platform/workspaces/common/workspaces.ts
浏览文件 @
ee27818f
...
@@ -10,7 +10,7 @@ import { IWorkspaceFolder, IWorkspace } from 'vs/platform/workspace/common/works
...
@@ -10,7 +10,7 @@ import { IWorkspaceFolder, IWorkspace } from 'vs/platform/workspace/common/works
import
{
URI
,
UriComponents
}
from
'
vs/base/common/uri
'
;
import
{
URI
,
UriComponents
}
from
'
vs/base/common/uri
'
;
import
{
isWindows
,
isLinux
,
isMacintosh
}
from
'
vs/base/common/platform
'
;
import
{
isWindows
,
isLinux
,
isMacintosh
}
from
'
vs/base/common/platform
'
;
import
{
extname
}
from
'
vs/base/common/path
'
;
import
{
extname
}
from
'
vs/base/common/path
'
;
import
{
dirname
,
resolvePath
,
isEqualAuthority
,
isEqualOrParent
,
relativePath
}
from
'
vs/base/common/resources
'
;
import
{
dirname
,
resolvePath
,
isEqualAuthority
,
isEqualOrParent
,
relativePath
,
extname
as
resourceExtname
}
from
'
vs/base/common/resources
'
;
import
*
as
jsonEdit
from
'
vs/base/common/jsonEdit
'
;
import
*
as
jsonEdit
from
'
vs/base/common/jsonEdit
'
;
import
*
as
json
from
'
vs/base/common/json
'
;
import
*
as
json
from
'
vs/base/common/json
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
...
@@ -158,8 +158,10 @@ export function isSingleFolderWorkspaceInitializationPayload(obj: any): obj is I
...
@@ -158,8 +158,10 @@ export function isSingleFolderWorkspaceInitializationPayload(obj: any): obj is I
const
WORKSPACE_SUFFIX
=
'
.
'
+
WORKSPACE_EXTENSION
;
const
WORKSPACE_SUFFIX
=
'
.
'
+
WORKSPACE_EXTENSION
;
export
function
hasWorkspaceFileExtension
(
path
:
string
)
{
export
function
hasWorkspaceFileExtension
(
path
:
string
|
URI
)
{
return
extname
(
path
)
===
WORKSPACE_SUFFIX
;
const
ext
=
(
typeof
path
===
'
string
'
)
?
extname
(
path
)
:
resourceExtname
(
path
);
return
ext
===
WORKSPACE_SUFFIX
;
}
}
const
SLASH
=
'
/
'
;
const
SLASH
=
'
/
'
;
...
...
src/vs/platform/workspaces/electron-main/workspacesMainService.ts
浏览文件 @
ee27818f
...
@@ -61,7 +61,7 @@ export class WorkspacesMainService extends Disposable implements IWorkspacesMain
...
@@ -61,7 +61,7 @@ export class WorkspacesMainService extends Disposable implements IWorkspacesMain
}
}
private
isWorkspacePath
(
uri
:
URI
):
boolean
{
private
isWorkspacePath
(
uri
:
URI
):
boolean
{
return
this
.
isInsideWorkspacesHome
(
uri
)
||
hasWorkspaceFileExtension
(
uri
.
path
);
return
this
.
isInsideWorkspacesHome
(
uri
)
||
hasWorkspaceFileExtension
(
uri
);
}
}
private
doResolveWorkspace
(
path
:
URI
,
contents
:
string
):
IResolvedWorkspace
|
null
{
private
doResolveWorkspace
(
path
:
URI
,
contents
:
string
):
IResolvedWorkspace
|
null
{
...
...
src/vs/workbench/api/common/apiCommands.ts
浏览文件 @
ee27818f
...
@@ -52,7 +52,7 @@ export class OpenFolderAPICommand {
...
@@ -52,7 +52,7 @@ export class OpenFolderAPICommand {
}
}
const
options
:
IOpenSettings
=
{
forceNewWindow
:
arg
.
forceNewWindow
,
noRecentEntry
:
arg
.
noRecentEntry
};
const
options
:
IOpenSettings
=
{
forceNewWindow
:
arg
.
forceNewWindow
,
noRecentEntry
:
arg
.
noRecentEntry
};
uri
=
URI
.
revive
(
uri
);
uri
=
URI
.
revive
(
uri
);
const
uriToOpen
:
IURIToOpen
=
(
hasWorkspaceFileExtension
(
uri
.
path
)
||
uri
.
scheme
===
Schemas
.
untitled
)
?
{
workspaceUri
:
uri
}
:
{
folderUri
:
uri
};
const
uriToOpen
:
IURIToOpen
=
(
hasWorkspaceFileExtension
(
uri
)
||
uri
.
scheme
===
Schemas
.
untitled
)
?
{
workspaceUri
:
uri
}
:
{
folderUri
:
uri
};
return
executor
.
executeCommand
(
'
_files.windowOpen
'
,
[
uriToOpen
],
options
);
return
executor
.
executeCommand
(
'
_files.windowOpen
'
,
[
uriToOpen
],
options
);
}
}
}
}
...
...
src/vs/workbench/browser/dnd.ts
浏览文件 @
ee27818f
...
@@ -260,7 +260,7 @@ export class ResourcesDropHandler {
...
@@ -260,7 +260,7 @@ export class ResourcesDropHandler {
return
Promise
.
all
(
fileOnDiskResources
.
map
(
fileOnDiskResource
=>
{
return
Promise
.
all
(
fileOnDiskResources
.
map
(
fileOnDiskResource
=>
{
// Check for Workspace
// Check for Workspace
if
(
hasWorkspaceFileExtension
(
fileOnDiskResource
.
fsPath
))
{
if
(
hasWorkspaceFileExtension
(
fileOnDiskResource
))
{
urisToOpen
.
push
({
workspaceUri
:
fileOnDiskResource
});
urisToOpen
.
push
({
workspaceUri
:
fileOnDiskResource
});
return
undefined
;
return
undefined
;
...
...
src/vs/workbench/browser/parts/editor/editorGroupView.ts
浏览文件 @
ee27818f
...
@@ -47,7 +47,8 @@ import { IVisibleEditor } from 'vs/workbench/services/editor/common/editorServic
...
@@ -47,7 +47,8 @@ import { IVisibleEditor } from 'vs/workbench/services/editor/common/editorServic
import
{
withNullAsUndefined
}
from
'
vs/base/common/types
'
;
import
{
withNullAsUndefined
}
from
'
vs/base/common/types
'
;
import
{
hash
}
from
'
vs/base/common/hash
'
;
import
{
hash
}
from
'
vs/base/common/hash
'
;
import
{
guessMimeTypes
}
from
'
vs/base/common/mime
'
;
import
{
guessMimeTypes
}
from
'
vs/base/common/mime
'
;
import
{
extname
}
from
'
vs/base/common/path
'
;
import
{
extname
}
from
'
vs/base/common/resources
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
export
class
EditorGroupView
extends
Themable
implements
IEditorGroupView
{
export
class
EditorGroupView
extends
Themable
implements
IEditorGroupView
{
...
@@ -520,8 +521,9 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
...
@@ -520,8 +521,9 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
const
descriptor
=
editor
.
getTelemetryDescriptor
();
const
descriptor
=
editor
.
getTelemetryDescriptor
();
const
resource
=
editor
.
getResource
();
const
resource
=
editor
.
getResource
();
if
(
resource
&&
resource
.
fsPath
)
{
const
path
=
resource
?
resource
.
scheme
===
Schemas
.
file
?
resource
.
fsPath
:
resource
.
path
:
undefined
;
descriptor
[
'
resource
'
]
=
{
mimeType
:
guessMimeTypes
(
resource
.
fsPath
).
join
(
'
,
'
),
scheme
:
resource
.
scheme
,
ext
:
extname
(
resource
.
fsPath
),
path
:
hash
(
resource
.
fsPath
)
};
if
(
resource
&&
path
)
{
descriptor
[
'
resource
'
]
=
{
mimeType
:
guessMimeTypes
(
path
).
join
(
'
,
'
),
scheme
:
resource
.
scheme
,
ext
:
extname
(
resource
),
path
:
hash
(
path
)
};
/* __GDPR__FRAGMENT__
/* __GDPR__FRAGMENT__
"EditorTelemetryDescriptor" : {
"EditorTelemetryDescriptor" : {
...
...
src/vs/workbench/browser/parts/editor/editorWidgets.ts
浏览文件 @
ee27818f
...
@@ -139,7 +139,7 @@ export class OpenWorkspaceButtonContribution extends Disposable implements IEdit
...
@@ -139,7 +139,7 @@ export class OpenWorkspaceButtonContribution extends Disposable implements IEdit
return
false
;
// we need a model
return
false
;
// we need a model
}
}
if
(
!
hasWorkspaceFileExtension
(
model
.
uri
.
fsPath
))
{
if
(
!
hasWorkspaceFileExtension
(
model
.
uri
))
{
return
false
;
// we need a workspace file
return
false
;
// we need a workspace file
}
}
...
...
src/vs/workbench/browser/parts/titlebar/titlebarPart.ts
浏览文件 @
ee27818f
...
@@ -36,6 +36,7 @@ import { IStorageService } from 'vs/platform/storage/common/storage';
...
@@ -36,6 +36,7 @@ import { IStorageService } from 'vs/platform/storage/common/storage';
import
{
Parts
,
IWorkbenchLayoutService
}
from
'
vs/workbench/services/layout/browser/layoutService
'
;
import
{
Parts
,
IWorkbenchLayoutService
}
from
'
vs/workbench/services/layout/browser/layoutService
'
;
import
{
RunOnceScheduler
}
from
'
vs/base/common/async
'
;
import
{
RunOnceScheduler
}
from
'
vs/base/common/async
'
;
import
{
registerSingleton
}
from
'
vs/platform/instantiation/common/extensions
'
;
import
{
registerSingleton
}
from
'
vs/platform/instantiation/common/extensions
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
export
class
TitlebarPart
extends
Part
implements
ITitleService
{
export
class
TitlebarPart
extends
Part
implements
ITitleService
{
...
@@ -179,7 +180,7 @@ export class TitlebarPart extends Part implements ITitleService {
...
@@ -179,7 +180,7 @@ export class TitlebarPart extends Part implements ITitleService {
}
}
private
updateRepresentedFilename
():
void
{
private
updateRepresentedFilename
():
void
{
const
file
=
toResource
(
this
.
editorService
.
activeEditor
,
{
supportSideBySide
:
SideBySideEditor
.
MASTER
,
filterByScheme
:
'
file
'
});
const
file
=
toResource
(
this
.
editorService
.
activeEditor
,
{
supportSideBySide
:
SideBySideEditor
.
MASTER
,
filterByScheme
:
Schemas
.
file
});
const
path
=
file
?
file
.
fsPath
:
''
;
const
path
=
file
?
file
.
fsPath
:
''
;
// Apply to window
// Apply to window
...
...
src/vs/workbench/contrib/files/browser/files.contribution.ts
浏览文件 @
ee27818f
...
@@ -38,6 +38,7 @@ import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/la
...
@@ -38,6 +38,7 @@ import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/la
import
{
registerSingleton
}
from
'
vs/platform/instantiation/common/extensions
'
;
import
{
registerSingleton
}
from
'
vs/platform/instantiation/common/extensions
'
;
import
{
ExplorerService
}
from
'
vs/workbench/contrib/files/common/explorerService
'
;
import
{
ExplorerService
}
from
'
vs/workbench/contrib/files/common/explorerService
'
;
import
{
SUPPORTED_ENCODINGS
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
SUPPORTED_ENCODINGS
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
// Viewlet Action
// Viewlet Action
export
class
OpenExplorerViewletAction
extends
ShowViewletAction
{
export
class
OpenExplorerViewletAction
extends
ShowViewletAction
{
...
@@ -59,7 +60,7 @@ class FileUriLabelContribution implements IWorkbenchContribution {
...
@@ -59,7 +60,7 @@ class FileUriLabelContribution implements IWorkbenchContribution {
constructor
(@
ILabelService
labelService
:
ILabelService
)
{
constructor
(@
ILabelService
labelService
:
ILabelService
)
{
labelService
.
registerFormatter
({
labelService
.
registerFormatter
({
scheme
:
'
file
'
,
scheme
:
Schemas
.
file
,
formatting
:
{
formatting
:
{
label
:
'
${authority}${path}
'
,
label
:
'
${authority}${path}
'
,
separator
:
sep
,
separator
:
sep
,
...
...
src/vs/workbench/services/textfile/common/textFileEditorModel.ts
浏览文件 @
ee27818f
...
@@ -31,6 +31,7 @@ import { IDisposable, toDisposable } from 'vs/base/common/lifecycle';
...
@@ -31,6 +31,7 @@ import { IDisposable, toDisposable } from 'vs/base/common/lifecycle';
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
isEqual
,
isEqualOrParent
,
extname
,
basename
}
from
'
vs/base/common/resources
'
;
import
{
isEqual
,
isEqualOrParent
,
extname
,
basename
}
from
'
vs/base/common/resources
'
;
import
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
import
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
/**
/**
* The text file editor model listens to changes to its underlying code editor model and saves these changes through the file service back to the disk.
* The text file editor model listens to changes to its underlying code editor model and saves these changes through the file service back to the disk.
...
@@ -824,10 +825,11 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil
...
@@ -824,10 +825,11 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil
private
getTelemetryData
(
reason
:
number
|
undefined
):
object
{
private
getTelemetryData
(
reason
:
number
|
undefined
):
object
{
const
ext
=
extname
(
this
.
resource
);
const
ext
=
extname
(
this
.
resource
);
const
fileName
=
basename
(
this
.
resource
);
const
fileName
=
basename
(
this
.
resource
);
const
path
=
this
.
resource
.
scheme
===
Schemas
.
file
?
this
.
resource
.
fsPath
:
this
.
resource
.
path
;
const
telemetryData
=
{
const
telemetryData
=
{
mimeType
:
guessMimeTypes
(
this
.
resource
.
fsP
ath
).
join
(
'
,
'
),
mimeType
:
guessMimeTypes
(
p
ath
).
join
(
'
,
'
),
ext
,
ext
,
path
:
hash
(
this
.
resource
.
fsP
ath
),
path
:
hash
(
p
ath
),
reason
reason
};
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录