Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
5f0b0b9c
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,发现更多精彩内容 >>
提交
5f0b0b9c
编写于
6月 08, 2020
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
uris - do not rely on isLinux check for comparing mementos
上级
5ae8f932
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
21 addition
and
15 deletion
+21
-15
src/vs/base/common/extpath.ts
src/vs/base/common/extpath.ts
+1
-1
src/vs/workbench/browser/parts/editor/baseEditor.ts
src/vs/workbench/browser/parts/editor/baseEditor.ts
+4
-5
src/vs/workbench/browser/parts/editor/textEditor.ts
src/vs/workbench/browser/parts/editor/textEditor.ts
+3
-2
src/vs/workbench/common/editor.ts
src/vs/workbench/common/editor.ts
+2
-1
src/vs/workbench/contrib/files/browser/editors/textFileEditor.ts
...workbench/contrib/files/browser/editors/textFileEditor.ts
+4
-2
src/vs/workbench/contrib/files/electron-sandbox/textFileEditor.ts
...orkbench/contrib/files/electron-sandbox/textFileEditor.ts
+4
-2
src/vs/workbench/test/browser/parts/editor/baseEditor.test.ts
...vs/workbench/test/browser/parts/editor/baseEditor.test.ts
+3
-2
未找到文件。
src/vs/base/common/extpath.ts
浏览文件 @
5f0b0b9c
...
...
@@ -285,7 +285,7 @@ export function isRootOrDriveLetter(path: string): boolean {
return
pathNormalized
===
posix
.
sep
;
}
export
function
indexOfPath
(
path
:
string
,
candidate
:
string
,
ignoreCase
:
boolean
):
number
{
export
function
indexOfPath
(
path
:
string
,
candidate
:
string
,
ignoreCase
?
:
boolean
):
number
{
if
(
candidate
.
length
>
path
.
length
)
{
return
-
1
;
}
...
...
src/vs/workbench/browser/parts/editor/baseEditor.ts
浏览文件 @
5f0b0b9c
...
...
@@ -16,8 +16,7 @@ import { Event } from 'vs/base/common/event';
import
{
isEmptyObject
}
from
'
vs/base/common/types
'
;
import
{
DEFAULT_EDITOR_MIN_DIMENSIONS
,
DEFAULT_EDITOR_MAX_DIMENSIONS
}
from
'
vs/workbench/browser/parts/editor/editor
'
;
import
{
MementoObject
}
from
'
vs/workbench/common/memento
'
;
import
{
isEqualOrParent
,
joinPath
}
from
'
vs/base/common/resources
'
;
import
{
isLinux
}
from
'
vs/base/common/platform
'
;
import
{
joinPath
,
IExtUri
}
from
'
vs/base/common/resources
'
;
import
{
indexOfPath
}
from
'
vs/base/common/extpath
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
...
...
@@ -259,7 +258,7 @@ export class EditorMemento<T> implements IEditorMemento<T> {
}
}
moveEditorState
(
source
:
URI
,
target
:
URI
):
void
{
moveEditorState
(
source
:
URI
,
target
:
URI
,
comparer
:
IExtUri
):
void
{
const
cache
=
this
.
doLoad
();
// We need a copy of the keys to not iterate over
...
...
@@ -268,7 +267,7 @@ export class EditorMemento<T> implements IEditorMemento<T> {
for
(
const
cacheKey
of
cacheKeys
)
{
const
resource
=
URI
.
parse
(
cacheKey
);
if
(
!
isEqualOrParent
(
resource
,
source
))
{
if
(
!
comparer
.
isEqualOrParent
(
resource
,
source
))
{
continue
;
// not matching our resource
}
...
...
@@ -277,7 +276,7 @@ export class EditorMemento<T> implements IEditorMemento<T> {
if
(
source
.
toString
()
===
resource
.
toString
())
{
targetResource
=
target
;
// file got moved
}
else
{
const
index
=
indexOfPath
(
resource
.
path
,
source
.
path
,
!
isLinux
);
const
index
=
indexOfPath
(
resource
.
path
,
source
.
path
);
targetResource
=
joinPath
(
target
,
resource
.
path
.
substr
(
index
+
source
.
path
.
length
+
1
));
// parent folder got moved
}
...
...
src/vs/workbench/browser/parts/editor/textEditor.ts
浏览文件 @
5f0b0b9c
...
...
@@ -24,6 +24,7 @@ import { IEditorGroupsService, IEditorGroup } from 'vs/workbench/services/editor
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
computeEditorAriaLabel
}
from
'
vs/workbench/browser/parts/editor/editor
'
;
import
{
IExtUri
}
from
'
vs/base/common/resources
'
;
export
interface
IEditorConfiguration
{
editor
:
object
;
...
...
@@ -250,8 +251,8 @@ export abstract class BaseTextEditor extends BaseEditor implements ITextEditorPa
return
this
.
group
?
this
.
editorMemento
.
loadEditorState
(
this
.
group
,
resource
)
:
undefined
;
}
protected
moveTextEditorViewState
(
source
:
URI
,
target
:
URI
):
void
{
return
this
.
editorMemento
.
moveEditorState
(
source
,
target
);
protected
moveTextEditorViewState
(
source
:
URI
,
target
:
URI
,
comparer
:
IExtUri
):
void
{
return
this
.
editorMemento
.
moveEditorState
(
source
,
target
,
comparer
);
}
protected
clearTextEditorViewState
(
resources
:
URI
[],
group
?:
IEditorGroup
):
void
{
...
...
src/vs/workbench/common/editor.ts
浏览文件 @
5f0b0b9c
...
...
@@ -22,6 +22,7 @@ import { IPathData } from 'vs/platform/windows/common/windows';
import
{
coalesce
,
firstOrDefault
}
from
'
vs/base/common/arrays
'
;
import
{
IResourceEditorInputType
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IRange
}
from
'
vs/editor/common/core/range
'
;
import
{
IExtUri
}
from
'
vs/base/common/resources
'
;
export
const
DirtyWorkingCopiesContext
=
new
RawContextKey
<
boolean
>
(
'
dirtyWorkingCopies
'
,
false
);
export
const
ActiveEditorContext
=
new
RawContextKey
<
string
|
null
>
(
'
activeEditor
'
,
null
);
...
...
@@ -1269,7 +1270,7 @@ export interface IEditorMemento<T> {
clearEditorState
(
resource
:
URI
,
group
?:
IEditorGroup
):
void
;
clearEditorState
(
editor
:
EditorInput
,
group
?:
IEditorGroup
):
void
;
moveEditorState
(
source
:
URI
,
target
:
URI
):
void
;
moveEditorState
(
source
:
URI
,
target
:
URI
,
comparer
:
IExtUri
):
void
;
}
class
EditorInputFactoryRegistry
implements
IEditorInputFactoryRegistry
{
...
...
src/vs/workbench/contrib/files/browser/editors/textFileEditor.ts
浏览文件 @
5f0b0b9c
...
...
@@ -32,6 +32,7 @@ import { createErrorWithActions } from 'vs/base/common/errorsWithActions';
import
{
MutableDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
EditorActivation
,
IEditorOptions
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IUriIdentityService
}
from
'
vs/workbench/services/uriIdentity/common/uriIdentity
'
;
/**
* An implementation of editor for file system resources.
...
...
@@ -56,7 +57,8 @@ export class TextFileEditor extends BaseTextEditor {
@
IEditorGroupsService
editorGroupService
:
IEditorGroupsService
,
@
ITextFileService
private
readonly
textFileService
:
ITextFileService
,
@
IExplorerService
private
readonly
explorerService
:
IExplorerService
,
@
IConfigurationService
private
readonly
configurationService
:
IConfigurationService
@
IConfigurationService
private
readonly
configurationService
:
IConfigurationService
,
@
IUriIdentityService
private
readonly
uriIdentityService
:
IUriIdentityService
)
{
super
(
TextFileEditor
.
ID
,
telemetryService
,
instantiationService
,
storageService
,
textResourceConfigurationService
,
themeService
,
editorService
,
editorGroupService
);
...
...
@@ -78,7 +80,7 @@ export class TextFileEditor extends BaseTextEditor {
private
onDidRunOperation
(
e
:
FileOperationEvent
):
void
{
if
(
e
.
operation
===
FileOperation
.
MOVE
&&
e
.
target
)
{
this
.
moveTextEditorViewState
(
e
.
resource
,
e
.
target
.
resource
);
this
.
moveTextEditorViewState
(
e
.
resource
,
e
.
target
.
resource
,
this
.
uriIdentityService
.
extUri
);
}
}
...
...
src/vs/workbench/contrib/files/electron-sandbox/textFileEditor.ts
浏览文件 @
5f0b0b9c
...
...
@@ -24,6 +24,7 @@ import { IPreferencesService } from 'vs/workbench/services/preferences/common/pr
import
{
IExplorerService
}
from
'
vs/workbench/contrib/files/common/files
'
;
import
{
IElectronService
}
from
'
vs/platform/electron/electron-sandbox/electron
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IUriIdentityService
}
from
'
vs/workbench/services/uriIdentity/common/uriIdentity
'
;
/**
* An implementation of editor for file system resources.
...
...
@@ -45,9 +46,10 @@ export class NativeTextFileEditor extends TextFileEditor {
@
IElectronService
private
readonly
electronService
:
IElectronService
,
@
IPreferencesService
private
readonly
preferencesService
:
IPreferencesService
,
@
IExplorerService
explorerService
:
IExplorerService
,
@
IConfigurationService
configurationService
:
IConfigurationService
@
IConfigurationService
configurationService
:
IConfigurationService
,
@
IUriIdentityService
uriIdentityService
:
IUriIdentityService
)
{
super
(
telemetryService
,
fileService
,
viewletService
,
instantiationService
,
contextService
,
storageService
,
textResourceConfigurationService
,
editorService
,
themeService
,
editorGroupService
,
textFileService
,
explorerService
,
configurationService
);
super
(
telemetryService
,
fileService
,
viewletService
,
instantiationService
,
contextService
,
storageService
,
textResourceConfigurationService
,
editorService
,
themeService
,
editorGroupService
,
textFileService
,
explorerService
,
configurationService
,
uriIdentityService
);
}
protected
handleSetInputError
(
error
:
Error
,
input
:
FileEditorInput
,
options
:
EditorOptions
|
undefined
):
void
{
...
...
src/vs/workbench/test/browser/parts/editor/baseEditor.test.ts
浏览文件 @
5f0b0b9c
...
...
@@ -20,6 +20,7 @@ import { CancellationToken } from 'vs/base/common/cancellation';
import
{
IEditorModel
}
from
'
vs/platform/editor/common/editor
'
;
import
{
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
TestStorageService
}
from
'
vs/workbench/test/common/workbenchTestServices
'
;
import
{
extUri
}
from
'
vs/base/common/resources
'
;
const
NullThemeService
=
new
TestThemeService
();
...
...
@@ -266,7 +267,7 @@ suite('Workbench base editor', () => {
memento
.
saveEditorState
(
testGroup0
,
URI
.
file
(
'
/some/folder/file-2.txt
'
),
{
line
:
2
});
memento
.
saveEditorState
(
testGroup0
,
URI
.
file
(
'
/some/other/file.txt
'
),
{
line
:
3
});
memento
.
moveEditorState
(
URI
.
file
(
'
/some/folder/file-1.txt
'
),
URI
.
file
(
'
/some/folder/file-moved.txt
'
));
memento
.
moveEditorState
(
URI
.
file
(
'
/some/folder/file-1.txt
'
),
URI
.
file
(
'
/some/folder/file-moved.txt
'
)
,
extUri
);
let
res
=
memento
.
loadEditorState
(
testGroup0
,
URI
.
file
(
'
/some/folder/file-1.txt
'
));
assert
.
ok
(
!
res
);
...
...
@@ -274,7 +275,7 @@ suite('Workbench base editor', () => {
res
=
memento
.
loadEditorState
(
testGroup0
,
URI
.
file
(
'
/some/folder/file-moved.txt
'
));
assert
.
equal
(
res
?.
line
,
1
);
memento
.
moveEditorState
(
URI
.
file
(
'
/some/folder
'
),
URI
.
file
(
'
/some/folder-moved
'
));
memento
.
moveEditorState
(
URI
.
file
(
'
/some/folder
'
),
URI
.
file
(
'
/some/folder-moved
'
)
,
extUri
);
res
=
memento
.
loadEditorState
(
testGroup0
,
URI
.
file
(
'
/some/folder-moved/file-moved.txt
'
));
assert
.
equal
(
res
?.
line
,
1
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录