Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
24c4f221
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,发现更多精彩内容 >>
提交
24c4f221
编写于
2月 09, 2018
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remote - fix more places where we assume file schema or add todos
上级
8af49e11
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
35 addition
and
42 deletion
+35
-42
src/vs/code/electron-main/launch.ts
src/vs/code/electron-main/launch.ts
+1
-1
src/vs/workbench/browser/dnd.ts
src/vs/workbench/browser/dnd.ts
+3
-3
src/vs/workbench/browser/labels.ts
src/vs/workbench/browser/labels.ts
+1
-1
src/vs/workbench/browser/parts/editor/editor.contribution.ts
src/vs/workbench/browser/parts/editor/editor.contribution.ts
+2
-1
src/vs/workbench/browser/parts/editor/resourceViewer.ts
src/vs/workbench/browser/parts/editor/resourceViewer.ts
+1
-1
src/vs/workbench/parts/backup/common/backupRestorer.ts
src/vs/workbench/parts/backup/common/backupRestorer.ts
+4
-2
src/vs/workbench/parts/debug/common/debugSource.ts
src/vs/workbench/parts/debug/common/debugSource.ts
+2
-1
src/vs/workbench/parts/execution/electron-browser/execution.contribution.ts
...arts/execution/electron-browser/execution.contribution.ts
+4
-3
src/vs/workbench/parts/files/electron-browser/fileActions.ts
src/vs/workbench/parts/files/electron-browser/fileActions.ts
+6
-5
src/vs/workbench/parts/files/electron-browser/fileCommands.ts
...vs/workbench/parts/files/electron-browser/fileCommands.ts
+2
-2
src/vs/workbench/parts/search/electron-browser/search.contribution.ts
...ench/parts/search/electron-browser/search.contribution.ts
+2
-1
src/vs/workbench/services/editor/common/editorService.ts
src/vs/workbench/services/editor/common/editorService.ts
+4
-18
src/vs/workbench/services/textfile/common/textFileService.ts
src/vs/workbench/services/textfile/common/textFileService.ts
+3
-3
未找到文件。
src/vs/code/electron-main/launch.ts
浏览文件 @
24c4f221
...
...
@@ -204,7 +204,7 @@ export class LaunchService implements ILaunchService {
}
else
if
(
window
.
openedWorkspace
)
{
const
rootFolders
=
this
.
workspacesMainService
.
resolveWorkspaceSync
(
window
.
openedWorkspace
.
configPath
).
folders
;
rootFolders
.
forEach
(
root
=>
{
if
(
root
.
uri
.
scheme
===
Schemas
.
file
)
{
if
(
root
.
uri
.
scheme
===
Schemas
.
file
)
{
// todo@remote signal remote folders?
folders
.
push
(
root
.
uri
.
fsPath
);
}
});
...
...
src/vs/workbench/browser/dnd.ts
浏览文件 @
24c4f221
...
...
@@ -178,9 +178,9 @@ export class ResourcesDropHandler {
}
// Add external ones to recently open list unless dropped resource is a workspace
const
resourc
esToAddToHistory
=
untitledOrFileResources
.
filter
(
d
=>
d
.
isExternal
&&
d
.
resource
.
scheme
===
Schemas
.
file
).
map
(
d
=>
d
.
resource
);
if
(
resourc
esToAddToHistory
.
length
)
{
this
.
windowsService
.
addRecentlyOpened
(
resourc
esToAddToHistory
.
map
(
resource
=>
resource
.
fsPath
));
const
fil
esToAddToHistory
=
untitledOrFileResources
.
filter
(
d
=>
d
.
isExternal
&&
d
.
resource
.
scheme
===
Schemas
.
file
).
map
(
d
=>
d
.
resource
);
if
(
fil
esToAddToHistory
.
length
)
{
this
.
windowsService
.
addRecentlyOpened
(
fil
esToAddToHistory
.
map
(
resource
=>
resource
.
fsPath
));
}
// Open in Editor
...
...
src/vs/workbench/browser/labels.ts
浏览文件 @
24c4f221
...
...
@@ -94,7 +94,7 @@ export class ResourceLabel extends IconLabel {
return
;
// we need the resource to compare
}
if
(
e
.
model
.
uri
.
scheme
===
Schemas
.
file
&&
e
.
oldModeId
===
PLAINTEXT_MODE_ID
)
{
if
(
e
.
model
.
uri
.
scheme
===
Schemas
.
file
&&
e
.
oldModeId
===
PLAINTEXT_MODE_ID
)
{
// todo@remote does this apply?
return
;
// ignore transitions in files from no mode to specific mode because this happens each time a model is created
}
...
...
src/vs/workbench/browser/parts/editor/editor.contribution.ts
浏览文件 @
24c4f221
...
...
@@ -41,6 +41,7 @@ import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRe
import
{
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
isMacintosh
}
from
'
vs/base/common/platform
'
;
import
{
GroupOnePicker
,
GroupTwoPicker
,
GroupThreePicker
,
AllEditorsPicker
}
from
'
vs/workbench/browser/parts/editor/editorPicker
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
// Register String Editor
Registry
.
as
<
IEditorRegistry
>
(
EditorExtensions
.
Editors
).
registerEditor
(
...
...
@@ -131,7 +132,7 @@ class UntitledEditorInputFactory implements IEditorInputFactory {
return
instantiationService
.
invokeFunction
<
UntitledEditorInput
>
(
accessor
=>
{
const
deserialized
:
ISerializedUntitledEditorInput
=
JSON
.
parse
(
serializedEditorInput
);
const
resource
=
!!
deserialized
.
resourceJSON
?
URI
.
revive
(
deserialized
.
resourceJSON
)
:
URI
.
parse
(
deserialized
.
resource
);
const
filePath
=
resource
.
scheme
===
'
file
'
?
resource
.
fsPath
:
void
0
;
const
filePath
=
resource
.
scheme
===
Schemas
.
file
?
resource
.
fsPath
:
void
0
;
const
language
=
deserialized
.
modeId
;
const
encoding
=
deserialized
.
encoding
;
...
...
src/vs/workbench/browser/parts/editor/resourceViewer.ts
浏览文件 @
24c4f221
...
...
@@ -156,7 +156,7 @@ export class ResourceViewer {
private
static
getMime
(
descriptor
:
IResourceDescriptor
):
string
{
let
mime
=
descriptor
.
mime
;
if
(
!
mime
&&
descriptor
.
resource
.
scheme
===
Schemas
.
file
)
{
if
(
!
mime
&&
descriptor
.
resource
.
scheme
!==
Schemas
.
data
)
{
const
ext
=
paths
.
extname
(
descriptor
.
resource
.
toString
());
if
(
ext
)
{
mime
=
mapExtToMediaMimes
[
ext
.
toLowerCase
()];
...
...
src/vs/workbench/parts/backup/common/backupRestorer.ts
浏览文件 @
24c4f221
...
...
@@ -17,6 +17,7 @@ import { Position, IResourceInput, IUntitledResourceInput } from 'vs/platform/ed
import
{
ITextFileService
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
ILifecycleService
,
LifecyclePhase
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
export
class
BackupRestorer
implements
IWorkbenchContribution
{
...
...
@@ -28,7 +29,8 @@ export class BackupRestorer implements IWorkbenchContribution {
@
IBackupFileService
private
backupFileService
:
IBackupFileService
,
@
ITextFileService
private
textFileService
:
ITextFileService
,
@
IEditorGroupService
private
groupService
:
IEditorGroupService
,
@
ILifecycleService
private
lifecycleService
:
ILifecycleService
@
ILifecycleService
private
lifecycleService
:
ILifecycleService
,
@
IFileService
private
fileService
:
IFileService
)
{
this
.
restoreBackups
();
}
...
...
@@ -67,7 +69,7 @@ export class BackupRestorer implements IWorkbenchContribution {
backups
.
forEach
(
backup
=>
{
if
(
stacks
.
isOpen
(
backup
))
{
if
(
backup
.
scheme
===
Schemas
.
file
)
{
if
(
this
.
fileService
.
canHandleResource
(
backup
)
)
{
restorePromises
.
push
(
this
.
textFileService
.
models
.
loadOrCreate
(
backup
).
then
(
null
,
()
=>
unresolved
.
push
(
backup
)));
}
else
if
(
backup
.
scheme
===
Schemas
.
untitled
)
{
restorePromises
.
push
(
this
.
untitledEditorService
.
loadOrCreate
({
resource
:
backup
}).
then
(
null
,
()
=>
unresolved
.
push
(
backup
)));
...
...
src/vs/workbench/parts/debug/common/debugSource.ts
浏览文件 @
24c4f221
...
...
@@ -11,6 +11,7 @@ import * as resources from 'vs/base/common/resources';
import
{
DEBUG_SCHEME
}
from
'
vs/workbench/parts/debug/common/debug
'
;
import
{
IRange
}
from
'
vs/editor/common/core/range
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
const
UNKNOWN_SOURCE_LABEL
=
nls
.
localize
(
'
unknownSource
'
,
"
Unknown Source
"
);
...
...
@@ -76,7 +77,7 @@ export class Source {
let
processId
:
string
;
switch
(
modelUri
.
scheme
)
{
case
'
file
'
:
case
Schemas
.
file
:
path
=
paths
.
normalize
(
modelUri
.
fsPath
,
true
);
break
;
case
DEBUG_SCHEME
:
...
...
src/vs/workbench/parts/execution/electron-browser/execution.contribution.ts
浏览文件 @
24c4f221
...
...
@@ -26,6 +26,7 @@ import { IFileService } from 'vs/platform/files/common/files';
import
{
IListService
}
from
'
vs/platform/list/browser/listService
'
;
import
{
getResourceForCommand
}
from
'
vs/workbench/parts/files/browser/files
'
;
import
{
CommandsRegistry
}
from
'
vs/platform/commands/common/commands
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
if
(
env
.
isWindows
)
{
registerSingleton
(
ITerminalService
,
WinTerminalService
);
...
...
@@ -111,7 +112,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
handler
:
(
accessor
)
=>
{
const
historyService
=
accessor
.
get
(
IHistoryService
);
const
terminalService
=
accessor
.
get
(
ITerminalService
);
const
root
=
historyService
.
getLastActiveWorkspaceRoot
(
'
file
'
);
const
root
=
historyService
.
getLastActiveWorkspaceRoot
(
Schemas
.
file
);
if
(
root
)
{
terminalService
.
openTerminal
(
root
.
fsPath
);
}
...
...
@@ -135,12 +136,12 @@ MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, {
group
:
'
navigation
'
,
order
:
30
,
command
:
openConsoleCommand
,
when
:
ResourceContextKey
.
Scheme
.
isEqualTo
(
'
file
'
)
when
:
ResourceContextKey
.
Scheme
.
isEqualTo
(
Schemas
.
file
)
});
MenuRegistry
.
appendMenuItem
(
MenuId
.
ExplorerContext
,
{
group
:
'
navigation
'
,
order
:
30
,
command
:
openConsoleCommand
,
when
:
ResourceContextKey
.
Scheme
.
isEqualTo
(
'
file
'
)
when
:
ResourceContextKey
.
Scheme
.
isEqualTo
(
Schemas
.
file
)
});
src/vs/workbench/parts/files/electron-browser/fileActions.ts
浏览文件 @
24c4f221
...
...
@@ -52,6 +52,7 @@ import { ICommandService, CommandsRegistry } from 'vs/platform/commands/common/c
import
{
IListService
,
ListWidget
}
from
'
vs/platform/list/browser/listService
'
;
import
{
RawContextKey
,
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
distinctParents
,
basenameOrAuthority
}
from
'
vs/base/common/resources
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
export
interface
IEditableData
{
action
:
IAction
;
...
...
@@ -1344,7 +1345,7 @@ export class ShowOpenedFileInNewWindow extends Action {
}
public
run
():
TPromise
<
any
>
{
const
fileResource
=
toResource
(
this
.
editorService
.
getActiveEditorInput
(),
{
supportSideBySide
:
true
,
filter
:
'
file
'
});
const
fileResource
=
toResource
(
this
.
editorService
.
getActiveEditorInput
(),
{
supportSideBySide
:
true
,
filter
:
Schemas
.
file
/* todo@remote */
});
if
(
fileResource
)
{
this
.
windowsService
.
openWindow
([
fileResource
.
fsPath
],
{
forceNewWindow
:
true
,
forceOpenWorkspaceAsFile
:
true
});
}
else
{
...
...
@@ -1449,6 +1450,7 @@ export class CompareWithClipboardAction extends Action {
@
IWorkbenchEditorService
private
editorService
:
IWorkbenchEditorService
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
,
@
ITextModelService
private
textModelService
:
ITextModelService
,
@
IFileService
private
fileService
:
IFileService
)
{
super
(
id
,
label
);
...
...
@@ -1456,11 +1458,10 @@ export class CompareWithClipboardAction extends Action {
}
public
run
():
TPromise
<
any
>
{
const
resource
:
URI
=
toResource
(
this
.
editorService
.
getActiveEditorInput
(),
{
supportSideBySide
:
true
,
filter
:
'
file
'
});
const
provider
=
this
.
instantiationService
.
createInstance
(
ClipboardContentProvider
);
if
(
resource
)
{
const
resource
:
URI
=
toResource
(
this
.
editorService
.
getActiveEditorInput
(),
{
supportSideBySide
:
true
});
if
(
resource
&&
(
this
.
fileService
.
canHandleResource
(
resource
)
||
resource
.
scheme
===
Schemas
.
untitled
))
{
if
(
!
this
.
registrationDisposal
)
{
const
provider
=
this
.
instantiationService
.
createInstance
(
ClipboardContentProvider
);
this
.
registrationDisposal
=
this
.
textModelService
.
registerTextModelContentProvider
(
CompareWithClipboardAction
.
SCHEME
,
provider
);
}
...
...
src/vs/workbench/parts/files/electron-browser/fileCommands.ts
浏览文件 @
24c4f221
...
...
@@ -92,7 +92,7 @@ function save(resource: URI, isSaveAs: boolean, editorService: IWorkbenchEditorS
let
encodingOfSource
:
string
;
if
(
resource
.
scheme
===
Schemas
.
untitled
)
{
encodingOfSource
=
untitledEditorService
.
getEncoding
(
resource
);
}
else
if
(
resource
.
scheme
===
'
file
'
)
{
}
else
if
(
fileService
.
canHandleResource
(
resource
)
)
{
const
textModel
=
textFileService
.
models
.
get
(
resource
);
encodingOfSource
=
textModel
&&
textModel
.
getEncoding
();
// text model can be null e.g. if this is a binary file!
}
...
...
@@ -319,7 +319,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
const
editorService
=
accessor
.
get
(
IWorkbenchEditorService
);
resource
=
getResourceForCommand
(
resource
,
accessor
.
get
(
IListService
),
editorService
);
if
(
resource
&&
resource
.
scheme
===
'
file
'
)
{
if
(
resource
&&
resource
.
scheme
===
Schemas
.
file
/* only files on disk supported for now */
)
{
const
name
=
paths
.
basename
(
resource
.
fsPath
);
const
editorLabel
=
nls
.
localize
(
'
modifiedLabel
'
,
"
{0} (on disk) ↔ {1}
"
,
name
,
name
);
...
...
src/vs/workbench/parts/search/electron-browser/search.contribution.ts
浏览文件 @
24c4f221
...
...
@@ -51,6 +51,7 @@ import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/edi
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
distinct
}
from
'
vs/base/common/arrays
'
;
import
{
getMultiSelectedResources
}
from
'
vs/workbench/parts/files/browser/files
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
registerSingleton
(
ISearchWorkbenchService
,
SearchWorkbenchService
);
replaceContributions
();
...
...
@@ -233,7 +234,7 @@ MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
id
:
FIND_IN_FOLDER_ID
,
title
:
nls
.
localize
(
'
findInFolder
'
,
"
Find in Folder...
"
)
},
when
:
ContextKeyExpr
.
and
(
ExplorerFolderContext
,
ResourceContextKey
.
Scheme
.
isEqualTo
(
'
file
'
))
// todo@remote
when
:
ContextKeyExpr
.
and
(
ExplorerFolderContext
,
ResourceContextKey
.
Scheme
.
isEqualTo
(
Schemas
.
file
))
// todo@remote
});
MenuRegistry
.
appendMenuItem
(
MenuId
.
ExplorerContext
,
{
...
...
src/vs/workbench/services/editor/common/editorService.ts
浏览文件 @
24c4f221
...
...
@@ -10,7 +10,7 @@ import { createDecorator, ServiceIdentifier, IInstantiationService } from 'vs/pl
import
{
IEditorService
,
IEditor
,
IEditorInput
,
IEditorOptions
,
ITextEditorOptions
,
Position
,
Direction
,
IResourceInput
,
IResourceDiffInput
,
IResourceSideBySideInput
,
IUntitledResourceInput
}
from
'
vs/platform/editor/common/editor
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
basename
,
dirname
}
from
'
vs/base/common/paths
'
;
import
{
basename
}
from
'
vs/base/common/paths
'
;
import
{
EditorInput
,
EditorOptions
,
TextEditorOptions
,
Extensions
as
EditorExtensions
,
SideBySideEditorInput
,
IFileEditorInput
,
IFileInputFactory
,
IEditorInputFactoryRegistry
}
from
'
vs/workbench/common/editor
'
;
import
{
ResourceEditorInput
}
from
'
vs/workbench/common/editor/resourceEditorInput
'
;
import
{
IUntitledEditorService
}
from
'
vs/workbench/services/untitled/common/untitledEditorService
'
;
...
...
@@ -318,24 +318,10 @@ export class WorkbenchEditorService implements IWorkbenchEditorService {
return
this
.
untitledEditorService
.
createOrGet
(
untitledInput
.
filePath
?
URI
.
file
(
untitledInput
.
filePath
)
:
untitledInput
.
resource
,
untitledInput
.
language
,
untitledInput
.
contents
,
untitledInput
.
encoding
);
}
// Resource Editor Support
const
resourceInput
=
<
IResourceInput
>
input
;
// Files / Data URI support
if
(
resourceInput
.
resource
instanceof
URI
&&
(
resourceInput
.
resource
.
scheme
===
Schemas
.
file
||
resourceInput
.
resource
.
scheme
===
Schemas
.
data
))
{
return
this
.
createOrGet
(
resourceInput
.
resource
,
this
.
instantiationService
,
resourceInput
.
label
,
resourceInput
.
description
,
resourceInput
.
encoding
);
}
// Any other resource
else
if
(
resourceInput
.
resource
instanceof
URI
)
{
const
label
=
resourceInput
.
label
||
basename
(
resourceInput
.
resource
.
fsPath
);
let
description
:
string
;
if
(
typeof
resourceInput
.
description
===
'
string
'
)
{
description
=
resourceInput
.
description
;
}
else
if
(
resourceInput
.
resource
.
scheme
===
Schemas
.
file
)
{
description
=
dirname
(
resourceInput
.
resource
.
fsPath
);
}
return
this
.
createOrGet
(
resourceInput
.
resource
,
this
.
instantiationService
,
label
,
description
);
if
(
resourceInput
.
resource
instanceof
URI
)
{
return
this
.
createOrGet
(
resourceInput
.
resource
,
this
.
instantiationService
,
resourceInput
.
label
||
basename
(
resourceInput
.
resource
.
fsPath
),
resourceInput
.
description
,
resourceInput
.
encoding
);
}
return
null
;
...
...
src/vs/workbench/services/textfile/common/textFileService.ts
浏览文件 @
24c4f221
...
...
@@ -231,7 +231,7 @@ export abstract class TextFileService implements ITextFileService {
const
filesToBackup
:
ITextFileEditorModel
[]
=
[];
const
untitledToBackup
:
URI
[]
=
[];
dirtyToBackup
.
forEach
(
s
=>
{
if
(
s
.
scheme
===
Schemas
.
file
)
{
if
(
this
.
fileService
.
canHandleResource
(
s
)
)
{
filesToBackup
.
push
(
textFileEditorModelManager
.
get
(
s
));
}
else
if
(
s
.
scheme
===
Schemas
.
untitled
)
{
untitledToBackup
.
push
(
s
);
...
...
@@ -390,7 +390,7 @@ export abstract class TextFileService implements ITextFileService {
public
save
(
resource
:
URI
,
options
?:
ISaveOptions
):
TPromise
<
boolean
>
{
// Run a forced save if we detect the file is not dirty so that save participants can still run
if
(
options
&&
options
.
force
&&
resource
.
scheme
===
Schemas
.
file
&&
!
this
.
isDirty
(
resource
))
{
if
(
options
&&
options
.
force
&&
this
.
fileService
.
canHandleResource
(
resource
)
&&
!
this
.
isDirty
(
resource
))
{
const
model
=
this
.
_models
.
get
(
resource
);
if
(
model
)
{
model
.
save
({
force
:
true
,
reason
:
SaveReason
.
EXPLICIT
}).
then
(()
=>
!
model
.
isDirty
());
...
...
@@ -572,7 +572,7 @@ export abstract class TextFileService implements ITextFileService {
// Retrieve text model from provided resource if any
let
modelPromise
:
TPromise
<
ITextFileEditorModel
|
UntitledEditorModel
>
=
TPromise
.
as
(
null
);
if
(
resource
.
scheme
===
Schemas
.
file
)
{
if
(
this
.
fileService
.
canHandleResource
(
resource
)
)
{
modelPromise
=
TPromise
.
as
(
this
.
_models
.
get
(
resource
));
}
else
if
(
resource
.
scheme
===
Schemas
.
untitled
&&
this
.
untitledEditorService
.
exists
(
resource
))
{
modelPromise
=
this
.
untitledEditorService
.
loadOrCreate
({
resource
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录