Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
3fe45ba4
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,发现更多精彩内容 >>
未验证
提交
3fe45ba4
编写于
10月 18, 2019
作者:
A
Alexandru Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Partial Revert "Use equals helper function instead of re-implementing it so many places"
This reverts commit
40e0f496
.
上级
61938981
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
82 addition
and
17 deletion
+82
-17
src/vs/base/common/keyCodes.ts
src/vs/base/common/keyCodes.ts
+9
-2
src/vs/editor/common/core/selection.ts
src/vs/editor/common/core/selection.ts
+9
-2
src/vs/editor/common/viewLayout/lineDecorations.ts
src/vs/editor/common/viewLayout/lineDecorations.ts
+12
-3
src/vs/editor/common/viewLayout/viewLineRenderer.ts
src/vs/editor/common/viewLayout/viewLineRenderer.ts
+11
-2
src/vs/editor/contrib/cursorUndo/cursorUndo.ts
src/vs/editor/contrib/cursorUndo/cursorUndo.ts
+11
-2
src/vs/editor/test/common/core/viewLineToken.ts
src/vs/editor/test/common/core/viewLineToken.ts
+12
-3
src/vs/platform/contextkey/common/contextkey.ts
src/vs/platform/contextkey/common/contextkey.ts
+18
-3
未找到文件。
src/vs/base/common/keyCodes.ts
浏览文件 @
3fe45ba4
...
...
@@ -5,7 +5,6 @@
import
{
OperatingSystem
}
from
'
vs/base/common/platform
'
;
import
{
illegalArgument
}
from
'
vs/base/common/errors
'
;
import
{
equals
}
from
'
vs/base/common/arrays
'
;
/**
* Virtual Key Codes, the value does not hold any inherent meaning.
...
...
@@ -526,7 +525,15 @@ export class ChordKeybinding {
if
(
other
===
null
)
{
return
false
;
}
return
equals
(
this
.
parts
,
other
.
parts
,
(
a
,
b
)
=>
a
.
equals
(
b
));
if
(
this
.
parts
.
length
!==
other
.
parts
.
length
)
{
return
false
;
}
for
(
let
i
=
0
;
i
<
this
.
parts
.
length
;
i
++
)
{
if
(
!
this
.
parts
[
i
].
equals
(
other
.
parts
[
i
]))
{
return
false
;
}
}
return
true
;
}
}
...
...
src/vs/editor/common/core/selection.ts
浏览文件 @
3fe45ba4
...
...
@@ -5,7 +5,6 @@
import
{
IPosition
,
Position
}
from
'
vs/editor/common/core/position
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
equals
}
from
'
vs/base/common/arrays
'
;
/**
* A selection in the editor.
...
...
@@ -172,7 +171,15 @@ export class Selection extends Range {
if
(
!
a
&&
!
b
)
{
return
true
;
}
return
equals
(
a
,
b
,
this
.
selectionsEqual
);
if
(
a
.
length
!==
b
.
length
)
{
return
false
;
}
for
(
let
i
=
0
,
len
=
a
.
length
;
i
<
len
;
i
++
)
{
if
(
!
this
.
selectionsEqual
(
a
[
i
],
b
[
i
]))
{
return
false
;
}
}
return
true
;
}
/**
...
...
src/vs/editor/common/viewLayout/lineDecorations.ts
浏览文件 @
3fe45ba4
...
...
@@ -6,7 +6,6 @@
import
*
as
strings
from
'
vs/base/common/strings
'
;
import
{
Constants
}
from
'
vs/base/common/uint
'
;
import
{
InlineDecoration
,
InlineDecorationType
}
from
'
vs/editor/common/viewModel/viewModel
'
;
import
{
equals
}
from
'
vs/base/common/arrays
'
;
export
class
LineDecoration
{
_lineDecorationBrand
:
void
;
...
...
@@ -28,8 +27,18 @@ export class LineDecoration {
);
}
public
static
equalsArr
(
a
:
readonly
LineDecoration
[],
b
:
readonly
LineDecoration
[]):
boolean
{
return
equals
(
a
,
b
,
LineDecoration
.
_equals
);
public
static
equalsArr
(
a
:
LineDecoration
[],
b
:
LineDecoration
[]):
boolean
{
let
aLen
=
a
.
length
;
let
bLen
=
b
.
length
;
if
(
aLen
!==
bLen
)
{
return
false
;
}
for
(
let
i
=
0
;
i
<
aLen
;
i
++
)
{
if
(
!
LineDecoration
.
_equals
(
a
[
i
],
b
[
i
]))
{
return
false
;
}
}
return
true
;
}
public
static
filter
(
lineDecorations
:
InlineDecoration
[],
lineNumber
:
number
,
minLineColumn
:
number
,
maxLineColumn
:
number
):
LineDecoration
[]
{
...
...
src/vs/editor/common/viewLayout/viewLineRenderer.ts
浏览文件 @
3fe45ba4
...
...
@@ -9,7 +9,6 @@ import { IViewLineTokens } from 'vs/editor/common/core/lineTokens';
import
{
IStringBuilder
,
createStringBuilder
}
from
'
vs/editor/common/core/stringBuilder
'
;
import
{
LineDecoration
,
LineDecorationsNormalizer
}
from
'
vs/editor/common/viewLayout/lineDecorations
'
;
import
{
InlineDecorationType
}
from
'
vs/editor/common/viewModel/viewModel
'
;
import
{
equals
}
from
'
vs/base/common/arrays
'
;
export
const
enum
RenderWhitespace
{
None
=
0
,
...
...
@@ -132,7 +131,17 @@ export class RenderLineInput {
return
false
;
}
return
equals
(
this
.
selectionsOnLine
,
otherSelections
,
(
a
,
b
)
=>
a
.
equals
(
b
));
if
(
otherSelections
.
length
!==
this
.
selectionsOnLine
.
length
)
{
return
false
;
}
for
(
let
i
=
0
;
i
<
this
.
selectionsOnLine
.
length
;
i
++
)
{
if
(
!
this
.
selectionsOnLine
[
i
].
equals
(
otherSelections
[
i
]))
{
return
false
;
}
}
return
true
;
}
public
equals
(
other
:
RenderLineInput
):
boolean
{
...
...
src/vs/editor/contrib/cursorUndo/cursorUndo.ts
浏览文件 @
3fe45ba4
...
...
@@ -12,7 +12,6 @@ import { Selection } from 'vs/editor/common/core/selection';
import
{
IEditorContribution
,
ScrollType
}
from
'
vs/editor/common/editorCommon
'
;
import
{
EditorContextKeys
}
from
'
vs/editor/common/editorContextKeys
'
;
import
{
KeybindingWeight
}
from
'
vs/platform/keybinding/common/keybindingsRegistry
'
;
import
{
equals
}
from
'
vs/base/common/arrays
'
;
class
CursorState
{
readonly
selections
:
readonly
Selection
[];
...
...
@@ -22,7 +21,17 @@ class CursorState {
}
public
equals
(
other
:
CursorState
):
boolean
{
return
equals
(
this
.
selections
,
other
.
selections
,
(
a
,
b
)
=>
a
.
equalsSelection
(
b
));
const
thisLen
=
this
.
selections
.
length
;
const
otherLen
=
other
.
selections
.
length
;
if
(
thisLen
!==
otherLen
)
{
return
false
;
}
for
(
let
i
=
0
;
i
<
thisLen
;
i
++
)
{
if
(
!
this
.
selections
[
i
].
equalsSelection
(
other
.
selections
[
i
]))
{
return
false
;
}
}
return
true
;
}
}
...
...
src/vs/editor/test/common/core/viewLineToken.ts
浏览文件 @
3fe45ba4
...
...
@@ -5,7 +5,6 @@
import
{
IViewLineTokens
}
from
'
vs/editor/common/core/lineTokens
'
;
import
{
ColorId
,
TokenMetadata
}
from
'
vs/editor/common/modes
'
;
import
{
equals
}
from
'
vs/base/common/arrays
'
;
/**
* A token on a line.
...
...
@@ -43,8 +42,18 @@ export class ViewLineToken {
);
}
public
static
equalsArr
(
a
:
readonly
ViewLineToken
[],
b
:
readonly
ViewLineToken
[]):
boolean
{
return
equals
(
a
,
b
,
this
.
_equals
);
public
static
equalsArr
(
a
:
ViewLineToken
[],
b
:
ViewLineToken
[]):
boolean
{
const
aLen
=
a
.
length
;
const
bLen
=
b
.
length
;
if
(
aLen
!==
bLen
)
{
return
false
;
}
for
(
let
i
=
0
;
i
<
aLen
;
i
++
)
{
if
(
!
this
.
_equals
(
a
[
i
],
b
[
i
]))
{
return
false
;
}
}
return
true
;
}
}
...
...
src/vs/platform/contextkey/common/contextkey.ts
浏览文件 @
3fe45ba4
...
...
@@ -6,7 +6,6 @@
import
{
Event
}
from
'
vs/base/common/event
'
;
import
{
isFalsyOrWhitespace
}
from
'
vs/base/common/strings
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
equals
}
from
'
vs/base/common/arrays
'
;
export
const
enum
ContextKeyExprType
{
Defined
=
1
,
...
...
@@ -575,7 +574,15 @@ export class ContextKeyAndExpr implements ContextKeyExpr {
public
equals
(
other
:
ContextKeyExpr
):
boolean
{
if
(
other
instanceof
ContextKeyAndExpr
)
{
return
equals
(
this
.
expr
,
other
.
expr
,
(
a
,
b
)
=>
a
.
equals
(
b
));
if
(
this
.
expr
.
length
!==
other
.
expr
.
length
)
{
return
false
;
}
for
(
let
i
=
0
,
len
=
this
.
expr
.
length
;
i
<
len
;
i
++
)
{
if
(
!
this
.
expr
[
i
].
equals
(
other
.
expr
[
i
]))
{
return
false
;
}
}
return
true
;
}
return
false
;
}
...
...
@@ -667,7 +674,15 @@ export class ContextKeyOrExpr implements ContextKeyExpr {
public
equals
(
other
:
ContextKeyExpr
):
boolean
{
if
(
other
instanceof
ContextKeyOrExpr
)
{
return
equals
(
this
.
expr
,
other
.
expr
,
(
a
,
b
)
=>
a
.
equals
(
b
));
if
(
this
.
expr
.
length
!==
other
.
expr
.
length
)
{
return
false
;
}
for
(
let
i
=
0
,
len
=
this
.
expr
.
length
;
i
<
len
;
i
++
)
{
if
(
!
this
.
expr
[
i
].
equals
(
other
.
expr
[
i
]))
{
return
false
;
}
}
return
true
;
}
return
false
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录