Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
54e6e40e
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,发现更多精彩内容 >>
提交
54e6e40e
编写于
9月 12, 2016
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
More adoption of CharCode
上级
dabbf52a
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
28 addition
and
16 deletion
+28
-16
src/vs/base/common/charCode.ts
src/vs/base/common/charCode.ts
+9
-0
src/vs/editor/common/viewModel/characterHardWrappingLineMapper.ts
...ditor/common/viewModel/characterHardWrappingLineMapper.ts
+3
-3
src/vs/editor/contrib/comment/common/lineCommentCommand.ts
src/vs/editor/contrib/comment/common/lineCommentCommand.ts
+5
-6
src/vs/editor/node/model/modelBuilder.ts
src/vs/editor/node/model/modelBuilder.ts
+2
-1
src/vs/editor/test/common/model/editableTextModelAuto.test.ts
...vs/editor/test/common/model/editableTextModelAuto.test.ts
+2
-1
src/vs/editor/test/node/model/modelBuilderAuto.test.ts
src/vs/editor/test/node/model/modelBuilderAuto.test.ts
+2
-1
src/vs/languages/html/common/html.ts
src/vs/languages/html/common/html.ts
+5
-4
未找到文件。
src/vs/base/common/charCode.ts
浏览文件 @
54e6e40e
...
...
@@ -12,8 +12,17 @@
*/
export
const
enum
CharCode
{
Null
=
0
,
/**
* The `\t` character.
*/
Tab
=
9
,
/**
* The `\n` character.
*/
LineFeed
=
10
,
/**
* The `\r` character.
*/
CarriageReturn
=
13
,
Space
=
32
,
/**
...
...
src/vs/editor/common/viewModel/characterHardWrappingLineMapper.ts
浏览文件 @
54e6e40e
...
...
@@ -8,6 +8,7 @@ import * as strings from 'vs/base/common/strings';
import
{
WrappingIndent
}
from
'
vs/editor/common/editorCommon
'
;
import
{
PrefixSumComputer
}
from
'
vs/editor/common/viewModel/prefixSumComputer
'
;
import
{
ILineMapperFactory
,
ILineMapping
,
OutputPosition
}
from
'
vs/editor/common/viewModel/splitLinesCollection
'
;
import
{
CharCode
}
from
'
vs/base/common/charCode
'
;
import
{
CharacterClassifier
}
from
'
vs/editor/common/core/characterClassifier
'
;
const
enum
CharacterClass
{
...
...
@@ -85,7 +86,6 @@ export class CharacterHardWrappingLineMapperFactory implements ILineMapperFactor
let
wrappedTextIndentVisibleColumn
=
0
;
let
wrappedTextIndent
=
''
;
const
TAB_CHAR_CODE
=
'
\t
'
.
charCodeAt
(
0
);
let
firstNonWhitespaceIndex
=
-
1
;
if
(
hardWrappingIndent
!==
WrappingIndent
.
None
)
{
...
...
@@ -93,7 +93,7 @@ export class CharacterHardWrappingLineMapperFactory implements ILineMapperFactor
if
(
firstNonWhitespaceIndex
!==
-
1
)
{
wrappedTextIndent
=
lineText
.
substring
(
0
,
firstNonWhitespaceIndex
);
for
(
let
i
=
0
;
i
<
firstNonWhitespaceIndex
;
i
++
)
{
wrappedTextIndentVisibleColumn
=
CharacterHardWrappingLineMapperFactory
.
nextVisibleColumn
(
wrappedTextIndentVisibleColumn
,
tabSize
,
lineText
.
charCodeAt
(
i
)
===
TAB_CHAR_CODE
,
1
);
wrappedTextIndentVisibleColumn
=
CharacterHardWrappingLineMapperFactory
.
nextVisibleColumn
(
wrappedTextIndentVisibleColumn
,
tabSize
,
lineText
.
charCodeAt
(
i
)
===
CharCode
.
Tab
,
1
);
}
if
(
hardWrappingIndent
===
WrappingIndent
.
Indent
)
{
wrappedTextIndent
+=
'
\t
'
;
...
...
@@ -125,7 +125,7 @@ export class CharacterHardWrappingLineMapperFactory implements ILineMapperFactor
// but the character at `i` might not fit
let
charCode
=
lineText
.
charCodeAt
(
i
);
let
charCodeIsTab
=
(
charCode
===
TAB_CHAR_CODE
);
let
charCodeIsTab
=
(
charCode
===
CharCode
.
Tab
);
let
charCodeClass
=
classifier
.
get
(
charCode
);
if
(
charCodeClass
===
CharacterClass
.
BREAK_BEFORE
)
{
...
...
src/vs/editor/contrib/comment/common/lineCommentCommand.ts
浏览文件 @
54e6e40e
...
...
@@ -13,6 +13,7 @@ import * as editorCommon from 'vs/editor/common/editorCommon';
import
{
ICommentsConfiguration
}
from
'
vs/editor/common/modes
'
;
import
{
BlockCommentCommand
}
from
'
./blockCommentCommand
'
;
import
{
LanguageConfigurationRegistry
}
from
'
vs/editor/common/modes/languageConfigurationRegistry
'
;
import
{
CharCode
}
from
'
vs/base/common/charCode
'
;
export
interface
IInsertionPoint
{
ignore
:
boolean
;
...
...
@@ -114,7 +115,6 @@ export class LineCommentCommand implements editorCommon.ICommand {
lineNumber
:
number
,
shouldRemoveComments
:
boolean
,
lineContent
:
string
,
_space
=
'
'
.
charCodeAt
(
0
),
onlyWhitespaceLines
=
true
;
if
(
type
===
Type
.
Toggle
)
{
...
...
@@ -162,7 +162,7 @@ export class LineCommentCommand implements editorCommon.ICommand {
if
(
shouldRemoveComments
)
{
commentStrEndOffset
=
lineContentStartOffset
+
lineData
.
commentStrLength
;
if
(
commentStrEndOffset
<
lineContent
.
length
&&
lineContent
.
charCodeAt
(
commentStrEndOffset
)
===
_s
pace
)
{
if
(
commentStrEndOffset
<
lineContent
.
length
&&
lineContent
.
charCodeAt
(
commentStrEndOffset
)
===
CharCode
.
S
pace
)
{
lineData
.
commentStrLength
+=
1
;
}
}
...
...
@@ -414,8 +414,7 @@ export class LineCommentCommand implements editorCommon.ICommand {
lineContent
:
string
,
j
:
number
,
lenJ
:
number
,
currentVisibleColumn
:
number
,
_tab
=
'
\t
'
.
charCodeAt
(
0
);
currentVisibleColumn
:
number
;
for
(
i
=
0
,
len
=
lines
.
length
;
i
<
len
;
i
++
)
{
if
(
lines
[
i
].
ignore
)
{
...
...
@@ -426,7 +425,7 @@ export class LineCommentCommand implements editorCommon.ICommand {
currentVisibleColumn
=
0
;
for
(
j
=
0
,
lenJ
=
lines
[
i
].
commentStrOffset
;
currentVisibleColumn
<
minVisibleColumn
&&
j
<
lenJ
;
j
++
)
{
currentVisibleColumn
=
LineCommentCommand
.
nextVisibleColumn
(
currentVisibleColumn
,
tabSize
,
lineContent
.
charCodeAt
(
j
)
===
_t
ab
,
1
);
currentVisibleColumn
=
LineCommentCommand
.
nextVisibleColumn
(
currentVisibleColumn
,
tabSize
,
lineContent
.
charCodeAt
(
j
)
===
CharCode
.
T
ab
,
1
);
}
if
(
currentVisibleColumn
<
minVisibleColumn
)
{
...
...
@@ -445,7 +444,7 @@ export class LineCommentCommand implements editorCommon.ICommand {
currentVisibleColumn
=
0
;
for
(
j
=
0
,
lenJ
=
lines
[
i
].
commentStrOffset
;
currentVisibleColumn
<
minVisibleColumn
&&
j
<
lenJ
;
j
++
)
{
currentVisibleColumn
=
LineCommentCommand
.
nextVisibleColumn
(
currentVisibleColumn
,
tabSize
,
lineContent
.
charCodeAt
(
j
)
===
_t
ab
,
1
);
currentVisibleColumn
=
LineCommentCommand
.
nextVisibleColumn
(
currentVisibleColumn
,
tabSize
,
lineContent
.
charCodeAt
(
j
)
===
CharCode
.
T
ab
,
1
);
}
if
(
currentVisibleColumn
>
minVisibleColumn
)
{
...
...
src/vs/editor/node/model/modelBuilder.ts
浏览文件 @
54e6e40e
...
...
@@ -10,6 +10,7 @@ import {DefaultEndOfLine, ITextModelCreationOptions, ITextModelResolvedOptions,
import
*
as
strings
from
'
vs/base/common/strings
'
;
import
{
guessIndentation
}
from
'
vs/editor/common/model/indentationGuesser
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
CharCode
}
from
'
vs/base/common/charCode
'
;
export
class
ModelBuilderResult
{
rawText
:
IRawText
;
...
...
@@ -162,7 +163,7 @@ export class ModelBuilder {
if
(
this
.
leftoverEndsInCR
)
{
chunk
=
'
\r
'
+
chunk
;
}
if
(
chunk
.
charCodeAt
(
chunk
.
length
-
1
)
===
13
/*\r*/
)
{
if
(
chunk
.
charCodeAt
(
chunk
.
length
-
1
)
===
CharCode
.
CarriageReturn
)
{
this
.
leftoverEndsInCR
=
true
;
chunk
=
chunk
.
substr
(
0
,
chunk
.
length
-
1
);
}
else
{
...
...
src/vs/editor/test/common/model/editableTextModelAuto.test.ts
浏览文件 @
54e6e40e
...
...
@@ -8,6 +8,7 @@ import {Position} from 'vs/editor/common/core/position';
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
IIdentifiedSingleEditOperation
}
from
'
vs/editor/common/editorCommon
'
;
import
{
testApplyEditsWithSyncedModels
}
from
'
vs/editor/test/common/model/editableTextModelTestUtils
'
;
import
{
CharCode
}
from
'
vs/base/common/charCode
'
;
const
GENERATE_TESTS
=
false
;
...
...
@@ -142,7 +143,7 @@ function getRandomString(minLength: number, maxLength: number): string {
let
length
=
getRandomInt
(
minLength
,
maxLength
);
let
r
=
''
;
for
(
let
i
=
0
;
i
<
length
;
i
++
)
{
r
+=
String
.
fromCharCode
(
getRandomInt
(
'
a
'
.
charCodeAt
(
0
),
'
z
'
.
charCodeAt
(
0
)
));
r
+=
String
.
fromCharCode
(
getRandomInt
(
CharCode
.
a
,
CharCode
.
z
));
}
return
r
;
}
...
...
src/vs/editor/test/node/model/modelBuilderAuto.test.ts
浏览文件 @
54e6e40e
...
...
@@ -5,6 +5,7 @@
'
use strict
'
;
import
{
testModelBuilder
,
testDifferentHash
}
from
'
vs/editor/test/node/model/modelBuilder.test
'
;
import
{
CharCode
}
from
'
vs/base/common/charCode
'
;
const
GENERATE_TESTS
=
false
;
...
...
@@ -44,7 +45,7 @@ function getRandomString(minLength: number, maxLength: number): string {
let
length
=
getRandomInt
(
minLength
,
maxLength
);
let
r
=
''
;
for
(
let
i
=
0
;
i
<
length
;
i
++
)
{
r
+=
String
.
fromCharCode
(
getRandomInt
(
'
a
'
.
charCodeAt
(
0
),
'
z
'
.
charCodeAt
(
0
)
));
r
+=
String
.
fromCharCode
(
getRandomInt
(
CharCode
.
a
,
CharCode
.
z
));
}
return
r
;
}
...
...
src/vs/languages/html/common/html.ts
浏览文件 @
54e6e40e
...
...
@@ -22,6 +22,7 @@ import {ICompatWorkerService, CompatWorkerAttr} from 'vs/editor/common/services/
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IHTMLConfiguration
}
from
'
vs/languages/html/common/html.contribution
'
;
import
{
CharCode
}
from
'
vs/base/common/charCode
'
;
export
{
htmlTokenTypes
};
// export to be used by Razor. We are the main module, so Razor should get it from us.
export
{
EMPTY_ELEMENTS
};
// export to be used by Razor. We are the main module, so Razor should get it from us.
...
...
@@ -115,7 +116,7 @@ export class State extends AbstractState {
break
;
case
States
.
Content
:
if
(
stream
.
advanceIfCharCode2
(
'
<
'
.
charCodeAt
(
0
)
))
{
if
(
stream
.
advanceIfCharCode2
(
CharCode
.
LessThan
))
{
if
(
!
stream
.
eos
()
&&
stream
.
peek
()
===
'
!
'
)
{
if
(
stream
.
advanceIfString2
(
'
!--
'
))
{
this
.
kind
=
States
.
WithinComment
;
...
...
@@ -126,7 +127,7 @@ export class State extends AbstractState {
return
{
type
:
htmlTokenTypes
.
DELIM_DOCTYPE
,
dontMergeWithPrev
:
true
};
}
}
if
(
stream
.
advanceIfCharCode2
(
'
/
'
.
charCodeAt
(
0
)
))
{
if
(
stream
.
advanceIfCharCode2
(
CharCode
.
Slash
))
{
this
.
kind
=
States
.
OpeningEndTag
;
return
{
type
:
htmlTokenTypes
.
DELIM_END
,
dontMergeWithPrev
:
true
};
}
...
...
@@ -183,7 +184,7 @@ export class State extends AbstractState {
this
.
kind
=
States
.
Content
;
return
{
type
:
htmlTokenTypes
.
DELIM_START
,
dontMergeWithPrev
:
true
};
}
if
(
stream
.
advanceIfCharCode2
(
'
>
'
.
charCodeAt
(
0
)
))
{
if
(
stream
.
advanceIfCharCode2
(
CharCode
.
GreaterThan
))
{
if
(
tagsEmbeddingContent
.
indexOf
(
this
.
lastTagName
)
!==
-
1
)
{
this
.
kind
=
States
.
WithinEmbeddedContent
;
return
{
type
:
htmlTokenTypes
.
DELIM_START
,
dontMergeWithPrev
:
true
};
...
...
@@ -202,7 +203,7 @@ export class State extends AbstractState {
return
{
type
:
''
};
}
if
(
stream
.
advanceIfCharCode2
(
'
=
'
.
charCodeAt
(
0
)
))
{
if
(
stream
.
advanceIfCharCode2
(
CharCode
.
Equals
))
{
this
.
kind
=
States
.
AttributeValue
;
return
{
type
:
htmlTokenTypes
.
DELIM_ASSIGN
};
}
else
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录