Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
06bf8e65
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 搜索 >>
提交
06bf8e65
编写于
11月 19, 2020
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
editors - update readonly options when file providers change (fix #110854)
上级
990ca74d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
33 addition
and
1 deletion
+33
-1
src/vs/workbench/browser/parts/editor/textDiffEditor.ts
src/vs/workbench/browser/parts/editor/textDiffEditor.ts
+21
-1
src/vs/workbench/contrib/files/browser/editors/textFileEditor.ts
...workbench/contrib/files/browser/editors/textFileEditor.ts
+12
-0
未找到文件。
src/vs/workbench/browser/parts/editor/textDiffEditor.ts
浏览文件 @
06bf8e65
...
...
@@ -31,6 +31,7 @@ import { EditorActivation, IEditorOptions } from 'vs/platform/editor/common/edit
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
isEqual
}
from
'
vs/base/common/resources
'
;
import
{
multibyteAwareBtoa
}
from
'
vs/base/browser/dom
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
/**
* The text editor that leverages the diff text editor for the editing experience.
...
...
@@ -61,9 +62,28 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditorPan
@
ITextResourceConfigurationService
configurationService
:
ITextResourceConfigurationService
,
@
IEditorService
editorService
:
IEditorService
,
@
IThemeService
themeService
:
IThemeService
,
@
IEditorGroupsService
editorGroupService
:
IEditorGroupsService
@
IEditorGroupsService
editorGroupService
:
IEditorGroupsService
,
@
IFileService
private
readonly
fileService
:
IFileService
)
{
super
(
TextDiffEditor
.
ID
,
telemetryService
,
instantiationService
,
storageService
,
configurationService
,
themeService
,
editorService
,
editorGroupService
);
// Listen to file system provider changes
this
.
_register
(
this
.
fileService
.
onDidChangeFileSystemProviderCapabilities
(
e
=>
this
.
onDidFileSystemProviderChange
(
e
.
scheme
)));
this
.
_register
(
this
.
fileService
.
onDidChangeFileSystemProviderRegistrations
(
e
=>
this
.
onDidFileSystemProviderChange
(
e
.
scheme
)));
}
private
onDidFileSystemProviderChange
(
scheme
:
string
):
void
{
const
control
=
this
.
getControl
();
const
input
=
this
.
input
;
if
(
control
&&
input
instanceof
DiffEditorInput
)
{
if
(
input
.
originalInput
.
resource
?.
scheme
===
scheme
||
input
.
modifiedInput
.
resource
?.
scheme
===
scheme
)
{
control
.
updateOptions
({
readOnly
:
input
.
modifiedInput
.
isReadonly
(),
originalEditable
:
!
input
.
originalInput
.
isReadonly
()
});
}
}
}
protected
onWillCloseEditorInGroup
(
editor
:
IEditorInput
):
void
{
...
...
src/vs/workbench/contrib/files/browser/editors/textFileEditor.ts
浏览文件 @
06bf8e65
...
...
@@ -60,6 +60,10 @@ export class TextFileEditor extends BaseTextEditor {
// Move view state for moved files
this
.
_register
(
this
.
fileService
.
onDidRunOperation
(
e
=>
this
.
onDidRunOperation
(
e
)));
// Listen to file system provider changes
this
.
_register
(
this
.
fileService
.
onDidChangeFileSystemProviderCapabilities
(
e
=>
this
.
onDidFileSystemProviderChange
(
e
.
scheme
)));
this
.
_register
(
this
.
fileService
.
onDidChangeFileSystemProviderRegistrations
(
e
=>
this
.
onDidFileSystemProviderChange
(
e
.
scheme
)));
}
private
onDidFilesChange
(
e
:
FileChangesEvent
):
void
{
...
...
@@ -75,6 +79,14 @@ export class TextFileEditor extends BaseTextEditor {
}
}
private
onDidFileSystemProviderChange
(
scheme
:
string
):
void
{
const
control
=
this
.
getControl
();
const
input
=
this
.
input
;
if
(
control
&&
input
?.
resource
.
scheme
===
scheme
)
{
control
.
updateOptions
({
readOnly
:
input
.
isReadonly
()
});
}
}
protected
onWillCloseEditorInGroup
(
editor
:
IEditorInput
):
void
{
// React to editors closing to preserve or clear view state. This needs to happen
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录