Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
5b34b4c6
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,发现更多精彩内容 >>
提交
5b34b4c6
编写于
2月 07, 2019
作者:
M
Martin Aeschlimann
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add hasWorkspaceFileExtension
上级
f078b096
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
24 addition
and
16 deletion
+24
-16
src/vs/code/electron-main/windows.ts
src/vs/code/electron-main/windows.ts
+7
-4
src/vs/platform/workspaces/common/workspaces.ts
src/vs/platform/workspaces/common/workspaces.ts
+7
-0
src/vs/platform/workspaces/electron-main/workspacesMainService.ts
...latform/workspaces/electron-main/workspacesMainService.ts
+3
-3
src/vs/workbench/browser/dnd.ts
src/vs/workbench/browser/dnd.ts
+3
-3
src/vs/workbench/browser/parts/editor/editorWidgets.ts
src/vs/workbench/browser/parts/editor/editorWidgets.ts
+2
-3
src/vs/workbench/contrib/stats/node/workspaceStats.ts
src/vs/workbench/contrib/stats/node/workspaceStats.ts
+2
-3
未找到文件。
src/vs/code/electron-main/windows.ts
浏览文件 @
5b34b4c6
...
...
@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
basename
,
normalize
,
join
,
dirname
,
extname
}
from
'
path
'
;
import
{
basename
,
normalize
,
join
,
dirname
}
from
'
path
'
;
import
*
as
fs
from
'
fs
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
*
as
arrays
from
'
vs/base/common/arrays
'
;
...
...
@@ -26,7 +26,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import
{
IWindowsMainService
,
IOpenConfiguration
,
IWindowsCountChangedEvent
,
ICodeWindow
,
IWindowState
as
ISingleWindowState
,
WindowMode
}
from
'
vs/platform/windows/electron-main/windows
'
;
import
{
IHistoryMainService
}
from
'
vs/platform/history/common/history
'
;
import
{
IProcessEnvironment
,
isLinux
,
isMacintosh
,
isWindows
}
from
'
vs/base/common/platform
'
;
import
{
IWorkspacesMainService
,
IWorkspaceIdentifier
,
WORKSPACE_FILTER
,
ISingleFolderWorkspaceIdentifier
,
isSingleFolderWorkspaceIdentifier
,
WORKSPACE_EXTENSION
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
IWorkspacesMainService
,
IWorkspaceIdentifier
,
WORKSPACE_FILTER
,
ISingleFolderWorkspaceIdentifier
,
isSingleFolderWorkspaceIdentifier
,
hasWorkspaceFileExtension
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
mnemonicButtonLabel
}
from
'
vs/base/common/labels
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
...
...
@@ -762,6 +762,8 @@ export class WindowsManager implements IWindowsMainService {
}
private
getPathsToOpen
(
openConfig
:
IOpenConfiguration
):
IPathToOpen
[]
{
debugger
;
let
windowsToOpen
:
IPathToOpen
[];
let
isCommandLineOrAPICall
=
false
;
...
...
@@ -980,6 +982,7 @@ export class WindowsManager implements IWindowsMainService {
// remove trailing slash
const
uriPath
=
uri
.
path
;
if
(
endsWith
(
uriPath
,
'
/
'
))
{
if
(
uriPath
.
length
>
2
)
{
// only remove if the path has some content
...
...
@@ -991,7 +994,7 @@ export class WindowsManager implements IWindowsMainService {
}
// if there's no type hint
if
(
!
typeHint
&&
(
extname
(
uri
.
path
)
===
WORKSPACE_EXTENSION
||
options
.
gotoLineMode
))
{
if
(
!
typeHint
&&
(
hasWorkspaceFileExtension
(
uri
.
path
)
||
options
.
gotoLineMode
))
{
typeHint
=
'
file
'
;
}
...
...
@@ -1005,7 +1008,7 @@ export class WindowsManager implements IWindowsMainService {
remoteAuthority
};
}
if
(
extname
(
uri
.
path
)
===
WORKSPACE_EXTENSION
&&
!
options
.
forceOpenWorkspaceAsFile
)
{
if
(
hasWorkspaceFileExtension
(
uri
.
path
)
&&
!
options
.
forceOpenWorkspaceAsFile
)
{
return
{
workspace
:
this
.
workspacesMainService
.
getWorkspaceIdentifier
(
uri
),
remoteAuthority
...
...
src/vs/platform/workspaces/common/workspaces.ts
浏览文件 @
5b34b4c6
...
...
@@ -8,6 +8,7 @@ import { localize } from 'vs/nls';
import
{
Event
}
from
'
vs/base/common/event
'
;
import
{
IWorkspaceFolder
,
IWorkspace
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
URI
,
UriComponents
}
from
'
vs/base/common/uri
'
;
import
{
extname
}
from
'
vs/base/common/paths
'
;
export
const
IWorkspacesMainService
=
createDecorator
<
IWorkspacesMainService
>
(
'
workspacesMainService
'
);
export
const
IWorkspacesService
=
createDecorator
<
IWorkspacesService
>
(
'
workspacesService
'
);
...
...
@@ -138,3 +139,9 @@ export type IWorkspaceInitializationPayload = IMultiFolderWorkspaceInitializatio
export
function
isSingleFolderWorkspaceInitializationPayload
(
obj
:
any
):
obj
is
ISingleFolderWorkspaceInitializationPayload
{
return
isSingleFolderWorkspaceIdentifier
((
obj
.
folder
as
ISingleFolderWorkspaceIdentifier
));
}
const
WORKSPACE_SUFFIX
=
'
.
'
+
WORKSPACE_EXTENSION
;
export
function
hasWorkspaceFileExtension
(
path
:
string
)
{
return
extname
(
path
)
===
WORKSPACE_SUFFIX
;
}
src/vs/platform/workspaces/electron-main/workspacesMainService.ts
浏览文件 @
5b34b4c6
...
...
@@ -3,10 +3,10 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
IWorkspacesMainService
,
IWorkspaceIdentifier
,
WORKSPACE_EXTENSION
,
UNTITLED_WORKSPACE_NAME
,
IResolvedWorkspace
,
IStoredWorkspaceFolder
,
isStoredWorkspaceFolder
,
IWorkspaceFolderCreationData
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
IWorkspacesMainService
,
IWorkspaceIdentifier
,
hasWorkspaceFileExtension
,
UNTITLED_WORKSPACE_NAME
,
IResolvedWorkspace
,
IStoredWorkspaceFolder
,
isStoredWorkspaceFolder
,
IWorkspaceFolderCreationData
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
isParent
}
from
'
vs/platform/files/common/files
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
join
,
dirname
,
extname
}
from
'
path
'
;
import
{
join
,
dirname
}
from
'
path
'
;
import
{
mkdirp
,
writeFile
,
readFile
}
from
'
vs/base/node/pfs
'
;
import
{
readFileSync
,
existsSync
,
mkdirSync
,
writeFileSync
}
from
'
fs
'
;
import
{
isLinux
}
from
'
vs/base/common/platform
'
;
...
...
@@ -61,7 +61,7 @@ export class WorkspacesMainService extends Disposable implements IWorkspacesMain
}
private
isWorkspacePath
(
path
:
string
):
boolean
{
return
this
.
isInsideWorkspacesHome
(
path
)
||
extname
(
path
)
===
`.
${
WORKSPACE_EXTENSION
}
`
;
return
this
.
isInsideWorkspacesHome
(
path
)
||
hasWorkspaceFileExtension
(
path
)
;
}
private
doResolveWorkspace
(
path
:
URI
,
contents
:
string
):
IResolvedWorkspace
|
null
{
...
...
src/vs/workbench/browser/dnd.ts
浏览文件 @
5b34b4c6
...
...
@@ -3,8 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
WORKSPACE_EXTENSION
,
IWorkspacesService
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
extname
,
basename
,
normalize
}
from
'
vs/base/common/paths
'
;
import
{
hasWorkspaceFileExtension
,
IWorkspacesService
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
basename
,
normalize
}
from
'
vs/base/common/paths
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
IWindowsService
,
IWindowService
,
IURIToOpen
}
from
'
vs/platform/windows/common/windows
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
...
...
@@ -263,7 +263,7 @@ export class ResourcesDropHandler {
return
Promise
.
all
(
fileOnDiskResources
.
map
(
fileOnDiskResource
=>
{
// Check for Workspace
if
(
extname
(
fileOnDiskResource
.
fsPath
)
===
`.
${
WORKSPACE_EXTENSION
}
`
)
{
if
(
hasWorkspaceFileExtension
(
fileOnDiskResource
.
fsPath
)
)
{
workspaceResources
.
workspaces
.
push
({
uri
:
fileOnDiskResource
,
typeHint
:
'
file
'
});
return
undefined
;
...
...
src/vs/workbench/browser/parts/editor/editorWidgets.ts
浏览文件 @
5b34b4c6
...
...
@@ -15,8 +15,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import
{
IWindowService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IWorkspaceContextService
,
WorkbenchState
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
WORKSPACE_EXTENSION
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
extname
}
from
'
vs/base/common/paths
'
;
import
{
hasWorkspaceFileExtension
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
Disposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
IEditorContribution
}
from
'
vs/editor/common/editorCommon
'
;
...
...
@@ -139,7 +138,7 @@ export class OpenWorkspaceButtonContribution extends Disposable implements IEdit
return
false
;
// we need a model
}
if
(
model
.
uri
.
scheme
!==
Schemas
.
file
||
extname
(
model
.
uri
.
fsPath
)
!==
`.
${
WORKSPACE_EXTENSION
}
`
)
{
if
(
model
.
uri
.
scheme
!==
Schemas
.
file
||
hasWorkspaceFileExtension
(
model
.
uri
.
fsPath
)
)
{
return
false
;
// we need a local workspace file
}
...
...
src/vs/workbench/contrib/stats/node/workspaceStats.ts
浏览文件 @
5b34b4c6
...
...
@@ -16,11 +16,10 @@ import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
import
{
endsWith
}
from
'
vs/base/common/strings
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
INotificationService
,
Severity
,
IPromptChoice
}
from
'
vs/platform/notification/common/notification
'
;
import
{
WORKSPACE_EXTENSION
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
hasWorkspaceFileExtension
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
IQuickInputService
,
IQuickPickItem
}
from
'
vs/platform/quickinput/common/quickInput
'
;
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
import
{
joinPath
}
from
'
vs/base/common/resources
'
;
import
{
extname
}
from
'
vs/base/common/paths
'
;
import
{
collectWorkspaceStats
,
WorkspaceStats
as
WorkspaceStatsType
}
from
'
vs/base/node/stats
'
;
const
SshProtocolMatcher
=
/^
([^
@:
]
+@
)?([^
:
]
+
)
:/
;
...
...
@@ -534,7 +533,7 @@ export class WorkspaceStats implements IWorkbenchContribution {
// Handle top-level workspace files for local single folder workspace
if
(
state
===
WorkbenchState
.
FOLDER
&&
workspace
.
folders
[
0
].
uri
.
scheme
===
Schemas
.
file
)
{
const
workspaceFiles
=
rootFiles
.
filter
(
name
=>
extname
(
name
)
===
`.
${
WORKSPACE_EXTENSION
}
`
);
const
workspaceFiles
=
rootFiles
.
filter
(
hasWorkspaceFileExtension
);
if
(
workspaceFiles
.
length
>
0
)
{
this
.
doHandleWorkspaceFiles
(
workspace
.
folders
[
0
].
uri
,
workspaceFiles
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录