Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
98953dd9
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 搜索 >>
提交
98953dd9
编写于
2月 15, 2019
作者:
M
Martin Aeschlimann
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rename resources.fsPath to resources.originalFSPath
上级
833fc7aa
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
33 addition
and
41 deletion
+33
-41
src/vs/base/common/resources.ts
src/vs/base/common/resources.ts
+6
-6
src/vs/code/electron-main/windows.ts
src/vs/code/electron-main/windows.ts
+2
-2
src/vs/platform/history/electron-main/historyMainService.ts
src/vs/platform/history/electron-main/historyMainService.ts
+4
-4
src/vs/platform/workspaces/common/workspaces.ts
src/vs/platform/workspaces/common/workspaces.ts
+3
-3
src/vs/platform/workspaces/electron-main/workspacesMainService.ts
...latform/workspaces/electron-main/workspacesMainService.ts
+5
-5
src/vs/workbench/api/node/extHost.api.impl.ts
src/vs/workbench/api/node/extHost.api.impl.ts
+1
-12
src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts
...ration/test/electron-browser/configurationService.test.ts
+2
-2
src/vs/workbench/services/extensions/electron-browser/cachedExtensionScanner.ts
...ces/extensions/electron-browser/cachedExtensionScanner.ts
+2
-2
src/vs/workbench/test/electron-browser/api/extHost.api.impl.test.ts
...kbench/test/electron-browser/api/extHost.api.impl.test.ts
+8
-5
未找到文件。
src/vs/base/common/resources.ts
浏览文件 @
98953dd9
...
...
@@ -33,7 +33,7 @@ export function basenameOrAuthority(resource: URI): string {
export
function
isEqualOrParent
(
base
:
URI
,
parentCandidate
:
URI
,
ignoreCase
=
hasToIgnoreCase
(
base
)):
boolean
{
if
(
base
.
scheme
===
parentCandidate
.
scheme
)
{
if
(
base
.
scheme
===
Schemas
.
file
)
{
return
extpath
.
isEqualOrParent
(
fsPath
(
base
),
fs
Path
(
parentCandidate
),
ignoreCase
);
return
extpath
.
isEqualOrParent
(
originalFSPath
(
base
),
originalFS
Path
(
parentCandidate
),
ignoreCase
);
}
if
(
isEqualAuthority
(
base
.
authority
,
parentCandidate
.
authority
))
{
return
extpath
.
isEqualOrParent
(
base
.
path
,
parentCandidate
.
path
,
ignoreCase
,
'
/
'
);
...
...
@@ -82,7 +82,7 @@ export function dirname(resource: URI): URI {
return
resource
;
}
if
(
resource
.
scheme
===
Schemas
.
file
)
{
return
URI
.
file
(
paths
.
dirname
(
fs
Path
(
resource
)));
return
URI
.
file
(
paths
.
dirname
(
originalFS
Path
(
resource
)));
}
let
dirname
=
paths
.
posix
.
dirname
(
resource
.
path
);
if
(
resource
.
authority
&&
dirname
.
length
&&
dirname
.
charCodeAt
(
0
)
!==
CharCode
.
Slash
)
{
...
...
@@ -104,7 +104,7 @@ export function dirname(resource: URI): URI {
export
function
joinPath
(
resource
:
URI
,
...
pathFragment
:
string
[]):
URI
{
let
joinedPath
:
string
;
if
(
resource
.
scheme
===
Schemas
.
file
)
{
joinedPath
=
URI
.
file
(
paths
.
join
(
fs
Path
(
resource
),
...
pathFragment
)).
path
;
joinedPath
=
URI
.
file
(
paths
.
join
(
originalFS
Path
(
resource
),
...
pathFragment
)).
path
;
}
else
{
joinedPath
=
paths
.
posix
.
join
(
resource
.
path
||
'
/
'
,
...
pathFragment
);
}
...
...
@@ -125,7 +125,7 @@ export function normalizePath(resource: URI): URI {
}
let
normalizedPath
:
string
;
if
(
resource
.
scheme
===
Schemas
.
file
)
{
normalizedPath
=
URI
.
file
(
paths
.
normalize
(
fs
Path
(
resource
))).
path
;
normalizedPath
=
URI
.
file
(
paths
.
normalize
(
originalFS
Path
(
resource
))).
path
;
}
else
{
normalizedPath
=
paths
.
posix
.
normalize
(
resource
.
path
);
}
...
...
@@ -138,7 +138,7 @@ export function normalizePath(resource: URI): URI {
* Returns the fsPath of an URI where the drive letter is not normalized.
* See #56403.
*/
export
function
fs
Path
(
uri
:
URI
):
string
{
export
function
originalFS
Path
(
uri
:
URI
):
string
{
let
value
:
string
;
const
uriPath
=
uri
.
path
;
if
(
uri
.
authority
&&
uriPath
.
length
>
1
&&
uri
.
scheme
===
'
file
'
)
{
...
...
@@ -173,7 +173,7 @@ export function isAbsolutePath(resource: URI): boolean {
*/
export
function
hasTrailingPathSeparator
(
resource
:
URI
):
boolean
{
if
(
resource
.
scheme
===
Schemas
.
file
)
{
const
fsp
=
fs
Path
(
resource
);
const
fsp
=
originalFS
Path
(
resource
);
return
fsp
.
length
>
extpath
.
getRoot
(
fsp
).
length
&&
fsp
[
fsp
.
length
-
1
]
===
paths
.
sep
;
}
else
{
let
p
=
resource
.
path
;
...
...
src/vs/code/electron-main/windows.ts
浏览文件 @
98953dd9
...
...
@@ -34,7 +34,7 @@ import { normalizeNFC } from 'vs/base/common/normalization';
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
Queue
,
timeout
}
from
'
vs/base/common/async
'
;
import
{
exists
}
from
'
vs/base/node/pfs
'
;
import
{
getComparisonKey
,
isEqual
,
normalizePath
,
basename
as
resourcesBasename
,
fs
Path
,
hasTrailingPathSeparator
,
removeTrailingPathSeparator
}
from
'
vs/base/common/resources
'
;
import
{
getComparisonKey
,
isEqual
,
normalizePath
,
basename
as
resourcesBasename
,
originalFS
Path
,
hasTrailingPathSeparator
,
removeTrailingPathSeparator
}
from
'
vs/base/common/resources
'
;
import
{
getRemoteAuthority
}
from
'
vs/platform/remote/common/remoteHosts
'
;
import
{
restoreWindowsState
,
WindowsStateStorageData
,
getWindowsStateStoreData
}
from
'
vs/code/electron-main/windowsStateStorage
'
;
...
...
@@ -1150,7 +1150,7 @@ export class WindowsManager implements IWindowsMainService {
}
}
else
{
if
(
workspaceToOpen
.
configPath
.
scheme
===
Schemas
.
file
)
{
cliArgs
=
[
fs
Path
(
workspaceToOpen
.
configPath
)];
cliArgs
=
[
originalFS
Path
(
workspaceToOpen
.
configPath
)];
}
else
{
fileUris
=
[
workspaceToOpen
.
configPath
.
toString
()];
}
...
...
src/vs/platform/history/electron-main/historyMainService.ts
浏览文件 @
98953dd9
...
...
@@ -16,7 +16,7 @@ import { IWorkspaceIdentifier, IWorkspacesMainService, ISingleFolderWorkspaceIde
import
{
IHistoryMainService
,
IRecentlyOpened
}
from
'
vs/platform/history/common/history
'
;
import
{
isEqual
}
from
'
vs/base/common/extpath
'
;
import
{
RunOnceScheduler
}
from
'
vs/base/common/async
'
;
import
{
getComparisonKey
,
isEqual
as
areResourcesEqual
,
dirname
,
fs
Path
}
from
'
vs/base/common/resources
'
;
import
{
getComparisonKey
,
isEqual
as
areResourcesEqual
,
dirname
,
originalFS
Path
}
from
'
vs/base/common/resources
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
...
...
@@ -169,12 +169,12 @@ export class HistoryMainService implements IHistoryMainService {
const
workspace
=
mru
.
workspaces
[
i
];
if
(
isSingleFolderWorkspaceIdentifier
(
workspace
))
{
if
(
workspace
.
scheme
===
Schemas
.
file
)
{
app
.
addRecentDocument
(
fs
Path
(
workspace
));
app
.
addRecentDocument
(
originalFS
Path
(
workspace
));
entries
++
;
}
}
else
{
if
(
workspace
.
configPath
.
scheme
===
Schemas
.
file
)
{
app
.
addRecentDocument
(
fs
Path
(
workspace
.
configPath
));
app
.
addRecentDocument
(
originalFS
Path
(
workspace
.
configPath
));
entries
++
;
}
}
...
...
@@ -185,7 +185,7 @@ export class HistoryMainService implements IHistoryMainService {
for
(
let
i
=
0
;
i
<
mru
.
files
.
length
&&
entries
<
HistoryMainService
.
MAX_MACOS_DOCK_RECENT_FILES
;
i
++
)
{
const
file
=
mru
.
files
[
i
];
if
(
file
.
scheme
===
Schemas
.
file
)
{
app
.
addRecentDocument
(
fs
Path
(
file
));
app
.
addRecentDocument
(
originalFS
Path
(
file
));
entries
++
;
}
}
...
...
src/vs/platform/workspaces/common/workspaces.ts
浏览文件 @
98953dd9
...
...
@@ -12,7 +12,7 @@ import { isEqualOrParent, normalizeWithSlashes } from 'vs/base/common/extpath';
import
{
isWindows
,
isLinux
,
isMacintosh
}
from
'
vs/base/common/platform
'
;
import
{
isAbsolute
,
relative
,
posix
,
resolve
,
extname
}
from
'
vs/base/common/path
'
;
import
{
normalizeDriveLetter
}
from
'
vs/base/common/labels
'
;
import
{
fs
Path
,
dirname
}
from
'
vs/base/common/resources
'
;
import
{
originalFS
Path
,
dirname
}
from
'
vs/base/common/resources
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
*
as
jsonEdit
from
'
vs/base/common/jsonEdit
'
;
import
*
as
json
from
'
vs/base/common/json
'
;
...
...
@@ -166,7 +166,7 @@ const SLASH = '/';
export
function
massageFolderPathForWorkspace
(
absoluteFolderPath
:
string
,
targetConfigFolderURI
:
URI
,
existingFolders
:
IStoredWorkspaceFolder
[]):
string
{
if
(
targetConfigFolderURI
.
scheme
===
Schemas
.
file
)
{
const
targetFolderPath
=
fs
Path
(
targetConfigFolderURI
);
const
targetFolderPath
=
originalFS
Path
(
targetConfigFolderURI
);
// Convert path to relative path if the target config folder
// is a parent of the path.
if
(
isEqualOrParent
(
absoluteFolderPath
,
targetFolderPath
,
!
isLinux
))
{
...
...
@@ -213,7 +213,7 @@ export function rewriteWorkspaceFileForNewLocation(rawWorkspaceContents: string,
if
(
isRawFileWorkspaceFolder
(
folder
))
{
if
(
sourceConfigFolder
.
scheme
===
Schemas
.
file
)
{
if
(
!
isAbsolute
(
folder
.
path
))
{
folder
.
path
=
resolve
(
fs
Path
(
sourceConfigFolder
),
folder
.
path
);
// relative paths get resolved against the workspace location
folder
.
path
=
resolve
(
originalFS
Path
(
sourceConfigFolder
),
folder
.
path
);
// relative paths get resolved against the workspace location
}
folder
.
path
=
massageFolderPathForWorkspace
(
folder
.
path
,
targetConfigFolder
,
storedWorkspace
.
folders
);
}
...
...
src/vs/platform/workspaces/electron-main/workspacesMainService.ts
浏览文件 @
98953dd9
...
...
@@ -19,7 +19,7 @@ import { toWorkspaceFolders } from 'vs/platform/workspace/common/workspace';
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
fs
Path
,
dirname
as
resourcesDirname
,
isEqualOrParent
,
joinPath
}
from
'
vs/base/common/resources
'
;
import
{
originalFS
Path
,
dirname
as
resourcesDirname
,
isEqualOrParent
,
joinPath
}
from
'
vs/base/common/resources
'
;
export
interface
IStoredWorkspace
{
folders
:
IStoredWorkspaceFolder
[];
...
...
@@ -142,7 +142,7 @@ export class WorkspacesMainService extends Disposable implements IWorkspacesMain
// File URI
if
(
folderResource
.
scheme
===
Schemas
.
file
)
{
storedWorkspace
=
{
path
:
massageFolderPathForWorkspace
(
fs
Path
(
folderResource
),
untitledWorkspaceConfigFolder
,
[])
};
storedWorkspace
=
{
path
:
massageFolderPathForWorkspace
(
originalFS
Path
(
folderResource
),
untitledWorkspaceConfigFolder
,
[])
};
}
// Any URI
...
...
@@ -165,7 +165,7 @@ export class WorkspacesMainService extends Disposable implements IWorkspacesMain
}
getWorkspaceId
(
configPath
:
URI
):
string
{
let
workspaceConfigPath
=
configPath
.
scheme
===
Schemas
.
file
?
fs
Path
(
configPath
)
:
configPath
.
toString
();
let
workspaceConfigPath
=
configPath
.
scheme
===
Schemas
.
file
?
originalFS
Path
(
configPath
)
:
configPath
.
toString
();
if
(
!
isLinux
)
{
workspaceConfigPath
=
workspaceConfigPath
.
toLowerCase
();
// sanitize for platform file system
}
...
...
@@ -190,7 +190,7 @@ export class WorkspacesMainService extends Disposable implements IWorkspacesMain
throw
new
Error
(
'
Only local workspaces can be saved with this API. Use WorkspaceEditingService.saveWorkspaceAs on the renderer instead.
'
);
}
const
configPath
=
fs
Path
(
workspace
.
configPath
);
const
configPath
=
originalFS
Path
(
workspace
.
configPath
);
// Return early if target is same as source
if
(
isEqual
(
configPath
,
targetConfigPath
,
!
isLinux
))
{
...
...
@@ -221,7 +221,7 @@ export class WorkspacesMainService extends Disposable implements IWorkspacesMain
}
private
doDeleteUntitledWorkspaceSync
(
workspace
:
IWorkspaceIdentifier
):
void
{
const
configPath
=
fs
Path
(
workspace
.
configPath
);
const
configPath
=
originalFS
Path
(
workspace
.
configPath
);
try
{
// Delete Workspace
delSync
(
dirname
(
configPath
));
...
...
src/vs/workbench/api/node/extHost.api.impl.ts
浏览文件 @
98953dd9
...
...
@@ -64,6 +64,7 @@ import { ProxyIdentifier } from 'vs/workbench/services/extensions/node/proxyIden
import
{
ExtensionDescriptionRegistry
}
from
'
vs/workbench/services/extensions/node/extensionDescriptionRegistry
'
;
import
*
as
vscode
from
'
vscode
'
;
import
{
ExtensionIdentifier
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
originalFSPath
}
from
'
vs/base/common/resources
'
;
export
interface
IExtensionApiFactory
{
(
extension
:
IExtensionDescription
,
registry
:
ExtensionDescriptionRegistry
,
workspaceProvider
:
ExtHostWorkspaceProvider
,
configProvider
:
ExtHostConfigProvider
):
typeof
vscode
;
...
...
@@ -841,18 +842,6 @@ export function createApiFactory(
};
}
/**
* Returns the original fs path (using the original casing for the drive letter)
*/
export
function
originalFSPath
(
uri
:
URI
):
string
{
const
result
=
uri
.
fsPath
;
if
(
/^
[
a-zA-Z
]
:/
.
test
(
result
)
&&
uri
.
path
.
charAt
(
1
).
toLowerCase
()
===
result
.
charAt
(
0
))
{
// Restore original drive letter casing
return
uri
.
path
.
charAt
(
1
)
+
result
.
substr
(
1
);
}
return
result
;
}
class
Extension
<
T
>
implements
vscode
.
Extension
<
T
>
{
private
_extensionService
:
ExtHostExtensionService
;
...
...
src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts
浏览文件 @
98953dd9
...
...
@@ -36,7 +36,7 @@ import { Uri } from 'vscode';
import
{
createHash
}
from
'
crypto
'
;
import
{
Emitter
,
Event
}
from
'
vs/base/common/event
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
fs
Path
}
from
'
vs/base/common/resources
'
;
import
{
originalFS
Path
}
from
'
vs/base/common/resources
'
;
import
{
isLinux
}
from
'
vs/base/common/platform
'
;
import
{
IWorkspaceIdentifier
}
from
'
vs/workbench/services/configuration/node/configuration
'
;
...
...
@@ -1246,7 +1246,7 @@ suite('WorkspaceConfigurationService-Multiroot', () => {
});
function
getWorkspaceId
(
configPath
:
URI
):
string
{
let
workspaceConfigPath
=
configPath
.
scheme
===
Schemas
.
file
?
fs
Path
(
configPath
)
:
configPath
.
toString
();
let
workspaceConfigPath
=
configPath
.
scheme
===
Schemas
.
file
?
originalFS
Path
(
configPath
)
:
configPath
.
toString
();
if
(
!
isLinux
)
{
workspaceConfigPath
=
workspaceConfigPath
.
toLowerCase
();
// sanitize for platform file system
}
...
...
src/vs/workbench/services/extensions/electron-browser/cachedExtensionScanner.ts
浏览文件 @
98953dd9
...
...
@@ -11,7 +11,7 @@ import * as errors from 'vs/base/common/errors';
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
*
as
objects
from
'
vs/base/common/objects
'
;
import
*
as
platform
from
'
vs/base/common/platform
'
;
import
{
fs
Path
}
from
'
vs/base/common/resources
'
;
import
{
originalFS
Path
}
from
'
vs/base/common/resources
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
*
as
pfs
from
'
vs/base/node/pfs
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
...
...
@@ -297,7 +297,7 @@ export class CachedExtensionScanner {
let
developedExtensions
:
Promise
<
IExtensionDescription
[]
>
=
Promise
.
resolve
([]);
if
(
environmentService
.
isExtensionDevelopment
&&
environmentService
.
extensionDevelopmentLocationURI
&&
environmentService
.
extensionDevelopmentLocationURI
.
scheme
===
Schemas
.
file
)
{
developedExtensions
=
ExtensionScanner
.
scanOneOrMultipleExtensions
(
new
ExtensionScannerInput
(
version
,
commit
,
locale
,
devMode
,
fs
Path
(
environmentService
.
extensionDevelopmentLocationURI
),
false
,
true
,
translations
),
log
new
ExtensionScannerInput
(
version
,
commit
,
locale
,
devMode
,
originalFS
Path
(
environmentService
.
extensionDevelopmentLocationURI
),
false
,
true
,
translations
),
log
);
}
...
...
src/vs/workbench/test/electron-browser/api/extHost.api.impl.test.ts
浏览文件 @
98953dd9
...
...
@@ -5,14 +5,17 @@
import
*
as
assert
from
'
assert
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
originalFSPath
}
from
'
vs/workbench/api/node/extHost.api.impl
'
;
import
{
originalFSPath
}
from
'
vs/base/common/resources
'
;
import
{
isWindows
}
from
'
vs/base/common/platform
'
;
suite
(
'
ExtHost API
'
,
function
()
{
test
(
'
issue #51387: originalFSPath
'
,
function
()
{
assert
.
equal
(
originalFSPath
(
URI
.
file
(
'
C:
\\
test
'
)).
charAt
(
0
),
'
C
'
);
assert
.
equal
(
originalFSPath
(
URI
.
file
(
'
c:
\\
test
'
)).
charAt
(
0
),
'
c
'
);
if
(
isWindows
)
{
assert
.
equal
(
originalFSPath
(
URI
.
file
(
'
C:
\\
test
'
)).
charAt
(
0
),
'
C
'
);
assert
.
equal
(
originalFSPath
(
URI
.
file
(
'
c:
\\
test
'
)).
charAt
(
0
),
'
c
'
);
assert
.
equal
(
originalFSPath
(
URI
.
revive
(
JSON
.
parse
(
JSON
.
stringify
(
URI
.
file
(
'
C:
\\
test
'
))))).
charAt
(
0
),
'
C
'
);
assert
.
equal
(
originalFSPath
(
URI
.
revive
(
JSON
.
parse
(
JSON
.
stringify
(
URI
.
file
(
'
c:
\\
test
'
))))).
charAt
(
0
),
'
c
'
);
assert
.
equal
(
originalFSPath
(
URI
.
revive
(
JSON
.
parse
(
JSON
.
stringify
(
URI
.
file
(
'
C:
\\
test
'
))))).
charAt
(
0
),
'
C
'
);
assert
.
equal
(
originalFSPath
(
URI
.
revive
(
JSON
.
parse
(
JSON
.
stringify
(
URI
.
file
(
'
c:
\\
test
'
))))).
charAt
(
0
),
'
c
'
);
}
});
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录