Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
63eb7207
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,发现更多精彩内容 >>
提交
63eb7207
编写于
8月 22, 2018
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
get rid of getWorkspaceLabel in workspaces.ts and adopt
上级
9acd3395
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
17 addition
and
59 deletion
+17
-59
src/vs/code/electron-main/menubar.ts
src/vs/code/electron-main/menubar.ts
+3
-3
src/vs/code/electron-main/menus.ts
src/vs/code/electron-main/menus.ts
+3
-3
src/vs/platform/history/electron-main/historyMainService.ts
src/vs/platform/history/electron-main/historyMainService.ts
+2
-4
src/vs/platform/workspaces/common/workspaces.ts
src/vs/platform/workspaces/common/workspaces.ts
+0
-35
src/vs/workbench/browser/parts/titlebar/menubarControl.ts
src/vs/workbench/browser/parts/titlebar/menubarControl.ts
+3
-5
src/vs/workbench/electron-browser/actions.ts
src/vs/workbench/electron-browser/actions.ts
+3
-3
src/vs/workbench/parts/welcome/page/electron-browser/welcomePage.ts
...kbench/parts/welcome/page/electron-browser/welcomePage.ts
+3
-6
未找到文件。
src/vs/code/electron-main/menubar.ts
浏览文件 @
63eb7207
...
...
@@ -19,7 +19,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import
{
mnemonicMenuLabel
as
baseMnemonicLabel
,
unmnemonicLabel
}
from
'
vs/base/common/labels
'
;
import
{
IWindowsMainService
,
IWindowsCountChangedEvent
}
from
'
vs/platform/windows/electron-main/windows
'
;
import
{
IHistoryMainService
}
from
'
vs/platform/history/common/history
'
;
import
{
IWorkspaceIdentifier
,
getWorkspaceLabel
,
ISingleFolderWorkspaceIdentifier
,
isSingleFolderWorkspaceIdentifier
,
isWorkspaceIdentifier
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
IWorkspaceIdentifier
,
ISingleFolderWorkspaceIdentifier
,
isSingleFolderWorkspaceIdentifier
,
isWorkspaceIdentifier
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
IMenubarData
,
IMenubarKeybinding
,
MenubarMenuItem
,
isMenubarMenuItemSeparator
,
isMenubarMenuItemSubmenu
,
isMenubarMenuItemAction
}
from
'
vs/platform/menubar/common/menubar
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
IUriLabelService
}
from
'
vs/platform/uriLabel/common/uriLabel
'
;
...
...
@@ -563,10 +563,10 @@ export class Menubar {
let
label
:
string
;
let
uri
:
URI
;
if
(
isSingleFolderWorkspaceIdentifier
(
workspaceOrFile
)
&&
!
isFile
)
{
label
=
unmnemonicLabel
(
getWorkspaceLabel
(
workspaceOrFile
,
this
.
environmentService
,
this
.
uriLabelServic
e
,
{
verbose
:
true
}));
label
=
unmnemonicLabel
(
this
.
uriLabelService
.
getWorkspaceLabel
(
workspaceOrFil
e
,
{
verbose
:
true
}));
uri
=
workspaceOrFile
;
}
else
if
(
isWorkspaceIdentifier
(
workspaceOrFile
))
{
label
=
getWorkspaceLabel
(
workspaceOrFile
,
this
.
environmentService
,
this
.
uriLabelServic
e
,
{
verbose
:
true
});
label
=
this
.
uriLabelService
.
getWorkspaceLabel
(
workspaceOrFil
e
,
{
verbose
:
true
});
uri
=
URI
.
file
(
workspaceOrFile
.
configPath
);
}
else
{
label
=
unmnemonicLabel
(
this
.
uriLabelService
.
getLabel
(
workspaceOrFile
));
...
...
src/vs/code/electron-main/menus.ts
浏览文件 @
63eb7207
...
...
@@ -22,7 +22,7 @@ import { mnemonicMenuLabel as baseMnemonicLabel, unmnemonicLabel } from 'vs/base
import
{
KeybindingsResolver
}
from
'
vs/code/electron-main/keyboard
'
;
import
{
IWindowsMainService
,
IWindowsCountChangedEvent
}
from
'
vs/platform/windows/electron-main/windows
'
;
import
{
IHistoryMainService
}
from
'
vs/platform/history/common/history
'
;
import
{
IWorkspaceIdentifier
,
getWorkspaceLabel
,
ISingleFolderWorkspaceIdentifier
,
isSingleFolderWorkspaceIdentifier
,
isWorkspaceIdentifier
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
IWorkspaceIdentifier
,
ISingleFolderWorkspaceIdentifier
,
isSingleFolderWorkspaceIdentifier
,
isWorkspaceIdentifier
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
IUriLabelService
}
from
'
vs/platform/uriLabel/common/uriLabel
'
;
...
...
@@ -491,10 +491,10 @@ export class CodeMenu {
let
label
:
string
;
let
uri
:
URI
;
if
(
isSingleFolderWorkspaceIdentifier
(
workspace
))
{
label
=
unmnemonicLabel
(
getWorkspaceLabel
(
workspace
,
this
.
environmentService
,
this
.
uriLabelServi
ce
,
{
verbose
:
true
}));
label
=
unmnemonicLabel
(
this
.
uriLabelService
.
getWorkspaceLabel
(
workspa
ce
,
{
verbose
:
true
}));
uri
=
workspace
;
}
else
if
(
isWorkspaceIdentifier
(
workspace
))
{
label
=
getWorkspaceLabel
(
workspace
,
this
.
environmentService
,
this
.
uriLabelServi
ce
,
{
verbose
:
true
});
label
=
this
.
uriLabelService
.
getWorkspaceLabel
(
workspa
ce
,
{
verbose
:
true
});
uri
=
URI
.
file
(
workspace
.
configPath
);
}
else
{
uri
=
URI
.
file
(
workspace
);
...
...
src/vs/platform/history/electron-main/historyMainService.ts
浏览文件 @
63eb7207
...
...
@@ -14,9 +14,8 @@ import { getBaseLabel } from 'vs/base/common/labels';
import
{
IPath
}
from
'
vs/platform/windows/common/windows
'
;
import
{
Event
as
CommonEvent
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
isWindows
,
isMacintosh
,
isLinux
}
from
'
vs/base/common/platform
'
;
import
{
IWorkspaceIdentifier
,
IWorkspacesMainService
,
getWorkspaceLabel
,
IWorkspaceSavedEvent
,
ISingleFolderWorkspaceIdentifier
,
isSingleFolderWorkspaceIdentifier
,
isWorkspaceIdentifier
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
IWorkspaceIdentifier
,
IWorkspacesMainService
,
IWorkspaceSavedEvent
,
ISingleFolderWorkspaceIdentifier
,
isSingleFolderWorkspaceIdentifier
,
isWorkspaceIdentifier
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
IHistoryMainService
,
IRecentlyOpened
}
from
'
vs/platform/history/common/history
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
isEqual
}
from
'
vs/base/common/paths
'
;
import
{
RunOnceScheduler
}
from
'
vs/base/common/async
'
;
import
{
getComparisonKey
,
isEqual
as
areResourcesEqual
,
dirname
}
from
'
vs/base/common/resources
'
;
...
...
@@ -52,7 +51,6 @@ export class HistoryMainService implements IHistoryMainService {
@
IStateService
private
stateService
:
IStateService
,
@
ILogService
private
logService
:
ILogService
,
@
IWorkspacesMainService
private
workspacesMainService
:
IWorkspacesMainService
,
@
IEnvironmentService
private
environmentService
:
IEnvironmentService
,
@
IUriLabelService
private
uriLabelService
:
IUriLabelService
)
{
this
.
macOSRecentDocumentsUpdater
=
new
RunOnceScheduler
(()
=>
this
.
updateMacOSRecentDocuments
(),
800
);
...
...
@@ -368,7 +366,7 @@ export class HistoryMainService implements IHistoryMainService {
type
:
'
custom
'
,
name
:
nls
.
localize
(
'
recentFolders
'
,
"
Recent Workspaces
"
),
items
:
this
.
getRecentlyOpened
().
workspaces
.
slice
(
0
,
7
/* limit number of entries here */
).
map
(
workspace
=>
{
const
title
=
getWorkspaceLabel
(
workspace
,
this
.
environmentService
,
this
.
uriLabelServi
ce
);
const
title
=
this
.
uriLabelService
.
getWorkspaceLabel
(
workspa
ce
);
let
description
;
let
args
;
if
(
isSingleFolderWorkspaceIdentifier
(
workspace
))
{
...
...
src/vs/platform/workspaces/common/workspaces.ts
浏览文件 @
63eb7207
...
...
@@ -7,17 +7,10 @@
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
isParent
}
from
'
vs/platform/files/common/files
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
basename
,
dirname
,
join
}
from
'
vs/base/common/paths
'
;
import
{
isLinux
}
from
'
vs/base/common/platform
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
Event
}
from
'
vs/base/common/event
'
;
import
{
getBaseLabel
}
from
'
vs/base/common/labels
'
;
import
{
IWorkspaceFolder
}
from
'
vs/platform/workspace/common/workspace
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
IUriLabelService
}
from
'
vs/platform/uriLabel/common/uriLabel
'
;
export
const
IWorkspacesMainService
=
createDecorator
<
IWorkspacesMainService
>
(
'
workspacesMainService
'
);
export
const
IWorkspacesService
=
createDecorator
<
IWorkspacesService
>
(
'
workspacesService
'
);
...
...
@@ -113,34 +106,6 @@ export interface IWorkspacesService {
createWorkspace
(
folders
?:
IWorkspaceFolderCreationData
[]):
TPromise
<
IWorkspaceIdentifier
>
;
}
export
function
getWorkspaceLabel
(
workspace
:
(
IWorkspaceIdentifier
|
ISingleFolderWorkspaceIdentifier
),
environmentService
:
IEnvironmentService
,
uriLabelService
:
IUriLabelService
,
options
?:
{
verbose
:
boolean
}):
string
{
// Workspace: Single Folder
if
(
isSingleFolderWorkspaceIdentifier
(
workspace
))
{
// Folder on disk
if
(
workspace
.
scheme
===
Schemas
.
file
)
{
return
options
&&
options
.
verbose
?
uriLabelService
.
getLabel
(
workspace
)
:
getBaseLabel
(
workspace
);
}
// Remote folder
return
options
&&
options
.
verbose
?
uriLabelService
.
getLabel
(
workspace
)
:
`
${
getBaseLabel
(
workspace
)}
(
${
workspace
.
scheme
}
)`
;
}
// Workspace: Untitled
if
(
isParent
(
workspace
.
configPath
,
environmentService
.
workspacesHome
,
!
isLinux
/* ignore case */
))
{
return
localize
(
'
untitledWorkspace
'
,
"
Untitled (Workspace)
"
);
}
// Workspace: Saved
const
filename
=
basename
(
workspace
.
configPath
);
const
workspaceName
=
filename
.
substr
(
0
,
filename
.
length
-
WORKSPACE_EXTENSION
.
length
-
1
);
if
(
options
&&
options
.
verbose
)
{
return
localize
(
'
workspaceNameVerbose
'
,
"
{0} (Workspace)
"
,
uriLabelService
.
getLabel
(
URI
.
file
(
join
(
dirname
(
workspace
.
configPath
),
workspaceName
))));
}
return
localize
(
'
workspaceName
'
,
"
{0} (Workspace)
"
,
workspaceName
);
}
export
function
isSingleFolderWorkspaceIdentifier
(
obj
:
any
):
obj
is
ISingleFolderWorkspaceIdentifier
{
return
obj
instanceof
URI
;
}
...
...
src/vs/workbench/browser/parts/titlebar/menubarControl.ts
浏览文件 @
63eb7207
...
...
@@ -25,8 +25,7 @@ import { Event, Emitter } from 'vs/base/common/event';
import
{
IDisposable
,
Disposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
domEvent
}
from
'
vs/base/browser/event
'
;
import
{
IRecentlyOpened
}
from
'
vs/platform/history/common/history
'
;
import
{
IWorkspaceIdentifier
,
getWorkspaceLabel
,
ISingleFolderWorkspaceIdentifier
,
isSingleFolderWorkspaceIdentifier
,
isWorkspaceIdentifier
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IWorkspaceIdentifier
,
ISingleFolderWorkspaceIdentifier
,
isSingleFolderWorkspaceIdentifier
,
isWorkspaceIdentifier
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
RunOnceScheduler
}
from
'
vs/base/common/async
'
;
import
{
MENUBAR_SELECTION_FOREGROUND
,
MENUBAR_SELECTION_BACKGROUND
,
MENUBAR_SELECTION_BORDER
,
TITLE_BAR_ACTIVE_FOREGROUND
,
TITLE_BAR_INACTIVE_FOREGROUND
,
MENU_BACKGROUND
,
MENU_FOREGROUND
,
MENU_SELECTION_BACKGROUND
,
MENU_SELECTION_FOREGROUND
,
MENU_SELECTION_BORDER
}
from
'
vs/workbench/common/theme
'
;
import
URI
from
'
vs/base/common/uri
'
;
...
...
@@ -122,7 +121,6 @@ export class MenubarControl extends Disposable {
@
IContextKeyService
private
contextKeyService
:
IContextKeyService
,
@
IKeybindingService
private
keybindingService
:
IKeybindingService
,
@
IConfigurationService
private
configurationService
:
IConfigurationService
,
@
IEnvironmentService
private
environmentService
:
IEnvironmentService
,
@
IUriLabelService
private
uriLabelService
:
IUriLabelService
,
@
IUpdateService
private
updateService
:
IUpdateService
)
{
...
...
@@ -533,10 +531,10 @@ export class MenubarControl extends Disposable {
let
uri
:
URI
;
if
(
isSingleFolderWorkspaceIdentifier
(
workspace
)
&&
!
isFile
)
{
label
=
getWorkspaceLabel
(
workspace
,
this
.
environmentService
,
this
.
uriLabelServi
ce
,
{
verbose
:
true
});
label
=
this
.
uriLabelService
.
getWorkspaceLabel
(
workspa
ce
,
{
verbose
:
true
});
uri
=
workspace
;
}
else
if
(
isWorkspaceIdentifier
(
workspace
))
{
label
=
getWorkspaceLabel
(
workspace
,
this
.
environmentService
,
this
.
uriLabelServi
ce
,
{
verbose
:
true
});
label
=
this
.
uriLabelService
.
getWorkspaceLabel
(
workspa
ce
,
{
verbose
:
true
});
uri
=
URI
.
file
(
workspace
.
configPath
);
}
else
{
uri
=
workspace
;
...
...
src/vs/workbench/electron-browser/actions.ts
浏览文件 @
63eb7207
...
...
@@ -29,7 +29,7 @@ import { webFrame, shell } from 'electron';
import
{
getBaseLabel
}
from
'
vs/base/common/labels
'
;
import
{
IViewlet
}
from
'
vs/workbench/common/viewlet
'
;
import
{
IPanel
}
from
'
vs/workbench/common/panel
'
;
import
{
IWorkspaceIdentifier
,
getWorkspaceLabel
,
ISingleFolderWorkspaceIdentifier
,
isSingleFolderWorkspaceIdentifier
,
isWorkspaceIdentifier
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
IWorkspaceIdentifier
,
ISingleFolderWorkspaceIdentifier
,
isSingleFolderWorkspaceIdentifier
,
isWorkspaceIdentifier
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
FileKind
}
from
'
vs/platform/files/common/files
'
;
import
{
IssueType
}
from
'
vs/platform/issue/common/issue
'
;
import
{
domEvent
}
from
'
vs/base/browser/event
'
;
...
...
@@ -441,11 +441,11 @@ export abstract class BaseOpenRecentAction extends Action {
let
description
:
string
;
if
(
isSingleFolderWorkspaceIdentifier
(
workspace
)
&&
fileKind
!==
FileKind
.
FILE
)
{
resource
=
workspace
;
label
=
getWorkspaceLabel
(
workspace
,
environmentService
,
uriLabelServi
ce
);
label
=
uriLabelService
.
getWorkspaceLabel
(
workspa
ce
);
description
=
uriLabelService
.
getLabel
(
dirname
(
resource
));
}
else
if
(
isWorkspaceIdentifier
(
workspace
))
{
resource
=
URI
.
file
(
workspace
.
configPath
);
label
=
getWorkspaceLabel
(
workspace
,
environmentService
,
uriLabelServi
ce
);
label
=
uriLabelService
.
getWorkspaceLabel
(
workspa
ce
);
description
=
uriLabelService
.
getLabel
(
dirname
(
resource
));
}
else
{
resource
=
workspace
;
...
...
src/vs/workbench/parts/welcome/page/electron-browser/welcomePage.ts
浏览文件 @
63eb7207
...
...
@@ -33,8 +33,7 @@ import { registerThemingParticipant } from 'vs/platform/theme/common/themeServic
import
{
registerColor
,
focusBorder
,
textLinkForeground
,
textLinkActiveForeground
,
foreground
,
descriptionForeground
,
contrastBorder
,
activeContrastBorder
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
getExtraColor
}
from
'
vs/workbench/parts/welcome/walkThrough/node/walkThroughUtils
'
;
import
{
IExtensionsWorkbenchService
}
from
'
vs/workbench/parts/extensions/common/extensions
'
;
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
IWorkspaceIdentifier
,
getWorkspaceLabel
,
ISingleFolderWorkspaceIdentifier
,
isSingleFolderWorkspaceIdentifier
,
isWorkspaceIdentifier
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
IWorkspaceIdentifier
,
ISingleFolderWorkspaceIdentifier
,
isSingleFolderWorkspaceIdentifier
,
isWorkspaceIdentifier
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
IEditorInputFactory
,
EditorInput
}
from
'
vs/workbench/common/editor
'
;
import
{
getIdAndVersionFromLocalExtensionId
}
from
'
vs/platform/extensionManagement/node/extensionManagementUtil
'
;
import
{
INotificationService
,
Severity
}
from
'
vs/platform/notification/common/notification
'
;
...
...
@@ -55,9 +54,7 @@ export class WelcomePageContribution implements IWorkbenchContribution {
@
IConfigurationService
configurationService
:
IConfigurationService
,
@
IEditorService
editorService
:
IEditorService
,
@
IBackupFileService
backupFileService
:
IBackupFileService
,
@
ITelemetryService
telemetryService
:
ITelemetryService
,
@
ILifecycleService
lifecycleService
:
ILifecycleService
,
@
IStorageService
storageService
:
IStorageService
)
{
const
enabled
=
isWelcomePageEnabled
(
configurationService
);
if
(
enabled
&&
lifecycleService
.
startupKind
!==
StartupKind
.
ReloadedWindow
)
{
...
...
@@ -283,9 +280,9 @@ class WelcomePage {
let
resource
:
URI
;
if
(
isSingleFolderWorkspaceIdentifier
(
workspace
))
{
resource
=
workspace
;
label
=
getWorkspaceLabel
(
workspace
,
this
.
environmentService
,
this
.
uriLabelServi
ce
);
label
=
this
.
uriLabelService
.
getWorkspaceLabel
(
workspa
ce
);
}
else
if
(
isWorkspaceIdentifier
(
workspace
))
{
label
=
getWorkspaceLabel
(
workspace
,
this
.
environmentService
,
this
.
uriLabelServi
ce
);
label
=
this
.
uriLabelService
.
getWorkspaceLabel
(
workspa
ce
);
resource
=
URI
.
file
(
workspace
.
configPath
);
}
else
{
label
=
getBaseLabel
(
workspace
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录