Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
16bc93d1
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,发现更多精彩内容 >>
提交
16bc93d1
编写于
9月 12, 2018
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Do not leak _resolvedColor
上级
8021f0f4
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
29 addition
and
29 deletion
+29
-29
src/vs/editor/common/model/textModel.ts
src/vs/editor/common/model/textModel.ts
+25
-3
src/vs/editor/common/viewModel/splitLinesCollection.ts
src/vs/editor/common/viewModel/splitLinesCollection.ts
+3
-25
src/vs/editor/common/viewModel/viewModelImpl.ts
src/vs/editor/common/viewModel/viewModelImpl.ts
+1
-1
未找到文件。
src/vs/editor/common/model/textModel.ts
浏览文件 @
16bc93d1
...
...
@@ -16,7 +16,7 @@ import { onUnexpectedError } from 'vs/base/common/errors';
import
{
IMarkdownString
}
from
'
vs/base/common/htmlContent
'
;
import
*
as
strings
from
'
vs/base/common/strings
'
;
import
{
CharCode
}
from
'
vs/base/common/charCode
'
;
import
{
ThemeColor
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
ThemeColor
,
ITheme
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
IntervalNode
,
IntervalTree
,
recomputeMaxEnd
,
getNodeIsInOverviewRuler
}
from
'
vs/editor/common/model/intervalTree
'
;
import
{
Disposable
,
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
StopWatch
}
from
'
vs/base/common/stopwatch
'
;
...
...
@@ -2784,7 +2784,7 @@ export class ModelDecorationOverviewRulerOptions implements model.IModelDecorati
readonly
color
:
string
|
ThemeColor
;
readonly
darkColor
:
string
|
ThemeColor
;
readonly
position
:
model
.
OverviewRulerLane
;
_resolvedColor
:
string
;
private
_resolvedColor
:
string
;
constructor
(
options
:
model
.
IModelDecorationOverviewRulerOptions
)
{
this
.
color
=
strings
.
empty
;
...
...
@@ -2804,7 +2804,29 @@ export class ModelDecorationOverviewRulerOptions implements model.IModelDecorati
if
(
options
&&
typeof
options
.
position
===
'
number
'
)
{
this
.
position
=
options
.
position
;
}
// console.log(this);
}
public
getColor
(
theme
:
ITheme
):
string
{
if
(
!
this
.
_resolvedColor
)
{
const
color
=
(
theme
.
type
===
'
light
'
?
this
.
color
:
this
.
darkColor
);
this
.
_resolvedColor
=
this
.
_resolveColor
(
color
,
theme
);
}
return
this
.
_resolvedColor
;
}
public
invalidateCachedColor
():
void
{
this
.
_resolvedColor
=
null
;
}
private
_resolveColor
(
color
:
string
|
ThemeColor
,
theme
:
ITheme
):
string
{
if
(
typeof
color
===
'
string
'
)
{
return
color
;
}
let
c
=
color
?
theme
.
getColor
(
color
.
id
)
:
null
;
if
(
!
c
)
{
return
strings
.
empty
;
}
return
c
.
toString
();
}
}
...
...
src/vs/editor/common/viewModel/splitLinesCollection.ts
浏览文件 @
16bc93d1
...
...
@@ -12,8 +12,7 @@ import { ViewLineData, ICoordinatesConverter, IOverviewRulerDecorations } from '
import
*
as
viewEvents
from
'
vs/editor/common/view/viewEvents
'
;
import
{
WrappingIndent
}
from
'
vs/editor/common/config/editorOptions
'
;
import
{
ModelDecorationOptions
,
ModelDecorationOverviewRulerOptions
}
from
'
vs/editor/common/model/textModel
'
;
import
{
ThemeColor
,
ITheme
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
Color
}
from
'
vs/base/common/color
'
;
import
{
ITheme
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
IModelDecoration
,
ITextModel
,
IModelDeltaDecoration
,
EndOfLinePreference
,
IActiveIndentGuideInfo
}
from
'
vs/editor/common/model
'
;
export
class
OutputPosition
{
...
...
@@ -797,7 +796,7 @@ export class SplitLinesCollection implements IViewModelLinesCollection {
if
(
lane
===
0
)
{
continue
;
}
const
color
=
resolveColor
(
opts
,
theme
);
const
color
=
opts
.
getColor
(
theme
);
const
viewStartLineNumber
=
this
.
_getViewLineNumberForModelPosition
(
decoration
.
range
.
startLineNumber
,
decoration
.
range
.
startColumn
);
const
viewEndLineNumber
=
this
.
_getViewLineNumberForModelPosition
(
decoration
.
range
.
endLineNumber
,
decoration
.
range
.
endColumn
);
...
...
@@ -1360,7 +1359,7 @@ export class IdentityLinesCollection implements IViewModelLinesCollection {
if
(
lane
===
0
)
{
continue
;
}
const
color
=
resolveColor
(
opts
,
theme
);
const
color
=
opts
.
getColor
(
theme
);
const
viewStartLineNumber
=
decoration
.
range
.
startLineNumber
;
const
viewEndLineNumber
=
decoration
.
range
.
endLineNumber
;
...
...
@@ -1402,24 +1401,3 @@ class OverviewRulerDecorations {
}
}
}
function
resolveColor
(
opts
:
ModelDecorationOverviewRulerOptions
,
theme
:
ITheme
):
string
{
if
(
!
opts
.
_resolvedColor
)
{
const
themeType
=
theme
.
type
;
const
color
=
(
themeType
===
'
light
'
?
opts
.
color
:
opts
.
darkColor
);
opts
.
_resolvedColor
=
resolveRulerColor
(
color
,
theme
);
}
return
opts
.
_resolvedColor
;
}
function
resolveRulerColor
(
color
:
string
|
ThemeColor
,
theme
:
ITheme
):
string
{
if
(
typeof
color
===
'
string
'
)
{
return
color
;
}
let
c
=
color
?
theme
.
getColor
(
color
.
id
)
:
null
;
if
(
!
c
)
{
c
=
Color
.
transparent
;
}
return
c
.
toString
();
}
src/vs/editor/common/viewModel/viewModelImpl.ts
浏览文件 @
16bc93d1
...
...
@@ -540,7 +540,7 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel
const
decoration
=
decorations
[
i
];
const
opts
=
<
ModelDecorationOverviewRulerOptions
>
decoration
.
options
.
overviewRuler
;
if
(
opts
)
{
opts
.
_resolvedColor
=
null
;
opts
.
invalidateCachedColor
()
;
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录