Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
8ce2d77b
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,发现更多精彩内容 >>
未验证
提交
8ce2d77b
编写于
6月 04, 2020
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixes #99027: Add support for storing properties that survive text buffer diposing
上级
c2be1bb8
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
30 addition
and
2 deletion
+30
-2
src/vs/editor/browser/services/abstractCodeEditorService.ts
src/vs/editor/browser/services/abstractCodeEditorService.ts
+24
-0
src/vs/editor/browser/services/codeEditorService.ts
src/vs/editor/browser/services/codeEditorService.ts
+4
-0
src/vs/editor/contrib/unusualLineTerminators/unusualLineTerminators.ts
.../contrib/unusualLineTerminators/unusualLineTerminators.ts
+2
-2
未找到文件。
src/vs/editor/browser/services/abstractCodeEditorService.ts
浏览文件 @
8ce2d77b
...
...
@@ -10,6 +10,7 @@ import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService
import
{
IDecorationRenderOptions
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IModelDecorationOptions
,
ITextModel
}
from
'
vs/editor/common/model
'
;
import
{
IResourceEditorInput
}
from
'
vs/platform/editor/common/editor
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
export
abstract
class
AbstractCodeEditorService
extends
Disposable
implements
ICodeEditorService
{
...
...
@@ -94,6 +95,29 @@ export abstract class AbstractCodeEditorService extends Disposable implements IC
abstract
resolveDecorationOptions
(
decorationTypeKey
:
string
|
undefined
,
writable
:
boolean
):
IModelDecorationOptions
;
private
readonly
_transientWatchers
:
{
[
uri
:
string
]:
ModelTransientSettingWatcher
;
}
=
{};
private
readonly
_modelProperties
=
new
Map
<
string
,
Map
<
string
,
any
>>
();
public
setModelProperty
(
resource
:
URI
,
key
:
string
,
value
:
any
):
void
{
const
key1
=
resource
.
toString
();
let
dest
:
Map
<
string
,
any
>
;
if
(
this
.
_modelProperties
.
has
(
key1
))
{
dest
=
this
.
_modelProperties
.
get
(
key1
)
!
;
}
else
{
dest
=
new
Map
<
string
,
any
>
();
this
.
_modelProperties
.
set
(
key1
,
dest
);
}
dest
.
set
(
key
,
value
);
}
public
getModelProperty
(
resource
:
URI
,
key
:
string
):
any
{
const
key1
=
resource
.
toString
();
if
(
this
.
_modelProperties
.
has
(
key1
))
{
const
innerMap
=
this
.
_modelProperties
.
get
(
key1
)
!
;
return
innerMap
.
get
(
key
);
}
return
undefined
;
}
public
setTransientModelProperty
(
model
:
ITextModel
,
key
:
string
,
value
:
any
):
void
{
const
uri
=
model
.
uri
.
toString
();
...
...
src/vs/editor/browser/services/codeEditorService.ts
浏览文件 @
8ce2d77b
...
...
@@ -9,6 +9,7 @@ import { IDecorationRenderOptions } from 'vs/editor/common/editorCommon';
import
{
IModelDecorationOptions
,
ITextModel
}
from
'
vs/editor/common/model
'
;
import
{
IResourceEditorInput
}
from
'
vs/platform/editor/common/editor
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
export
const
ICodeEditorService
=
createDecorator
<
ICodeEditorService
>
(
'
codeEditorService
'
);
...
...
@@ -41,6 +42,9 @@ export interface ICodeEditorService {
removeDecorationType
(
key
:
string
):
void
;
resolveDecorationOptions
(
typeKey
:
string
,
writable
:
boolean
):
IModelDecorationOptions
;
setModelProperty
(
resource
:
URI
,
key
:
string
,
value
:
any
):
void
;
getModelProperty
(
resource
:
URI
,
key
:
string
):
any
;
setTransientModelProperty
(
model
:
ITextModel
,
key
:
string
,
value
:
any
):
void
;
getTransientModelProperty
(
model
:
ITextModel
,
key
:
string
):
any
;
getTransientModelProperties
(
model
:
ITextModel
):
[
string
,
any
][]
|
undefined
;
...
...
src/vs/editor/contrib/unusualLineTerminators/unusualLineTerminators.ts
浏览文件 @
8ce2d77b
...
...
@@ -16,11 +16,11 @@ import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
const
ignoreUnusualLineTerminators
=
'
ignoreUnusualLineTerminators
'
;
function
writeIgnoreState
(
codeEditorService
:
ICodeEditorService
,
model
:
ITextModel
,
state
:
boolean
):
void
{
codeEditorService
.
set
TransientModelProperty
(
model
,
ignoreUnusualLineTerminators
,
state
);
codeEditorService
.
set
ModelProperty
(
model
.
uri
,
ignoreUnusualLineTerminators
,
state
);
}
function
readIgnoreState
(
codeEditorService
:
ICodeEditorService
,
model
:
ITextModel
):
boolean
|
undefined
{
return
codeEditorService
.
get
TransientModelProperty
(
model
,
ignoreUnusualLineTerminators
);
return
codeEditorService
.
get
ModelProperty
(
model
.
uri
,
ignoreUnusualLineTerminators
);
}
class
UnusualLineTerminatorsDetector
extends
Disposable
implements
IEditorContribution
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录