Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
91762aab
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,发现更多精彩内容 >>
提交
91762aab
编写于
1月 05, 2018
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Reduce usage of `var`
上级
d7e8ced0
变更
28
隐藏空白更改
内联
并排
Showing
28 changed file
with
101 addition
and
99 deletion
+101
-99
src/vs/editor/browser/core/editorState.ts
src/vs/editor/browser/core/editorState.ts
+2
-2
src/vs/editor/browser/widget/diffNavigator.ts
src/vs/editor/browser/widget/diffNavigator.ts
+8
-8
src/vs/editor/common/config/commonEditorConfig.ts
src/vs/editor/common/config/commonEditorConfig.ts
+1
-1
src/vs/editor/common/controller/cursorMoveOperations.ts
src/vs/editor/common/controller/cursorMoveOperations.ts
+1
-1
src/vs/editor/common/core/range.ts
src/vs/editor/common/core/range.ts
+13
-9
src/vs/editor/common/core/selection.ts
src/vs/editor/common/core/selection.ts
+1
-1
src/vs/editor/common/editorCommon.ts
src/vs/editor/common/editorCommon.ts
+2
-2
src/vs/editor/common/model/editStack.ts
src/vs/editor/common/model/editStack.ts
+5
-5
src/vs/editor/common/model/textModel.ts
src/vs/editor/common/model/textModel.ts
+11
-12
src/vs/editor/common/model/wordHelper.ts
src/vs/editor/common/model/wordHelper.ts
+6
-7
src/vs/editor/common/modes/modesRegistry.ts
src/vs/editor/common/modes/modesRegistry.ts
+2
-2
src/vs/editor/common/modes/supports.ts
src/vs/editor/common/modes/supports.ts
+1
-1
src/vs/editor/common/modes/supports/electricCharacter.ts
src/vs/editor/common/modes/supports/electricCharacter.ts
+1
-1
src/vs/editor/common/modes/supports/inplaceReplaceSupport.ts
src/vs/editor/common/modes/supports/inplaceReplaceSupport.ts
+5
-5
src/vs/editor/common/modes/supports/onEnter.ts
src/vs/editor/common/modes/supports/onEnter.ts
+2
-2
src/vs/editor/common/modes/supports/richEditBrackets.ts
src/vs/editor/common/modes/supports/richEditBrackets.ts
+4
-4
src/vs/editor/common/services/editorSimpleWorker.ts
src/vs/editor/common/services/editorSimpleWorker.ts
+9
-9
src/vs/editor/common/services/editorWorkerService.ts
src/vs/editor/common/services/editorWorkerService.ts
+2
-2
src/vs/editor/common/services/languagesRegistry.ts
src/vs/editor/common/services/languagesRegistry.ts
+2
-2
src/vs/editor/common/services/modeService.ts
src/vs/editor/common/services/modeService.ts
+1
-1
src/vs/editor/common/services/modeServiceImpl.ts
src/vs/editor/common/services/modeServiceImpl.ts
+10
-10
src/vs/editor/common/services/modelService.ts
src/vs/editor/common/services/modelService.ts
+1
-1
src/vs/editor/common/view/runtimeMinimapCharRenderer.ts
src/vs/editor/common/view/runtimeMinimapCharRenderer.ts
+2
-2
src/vs/editor/common/viewLayout/lineDecorations.ts
src/vs/editor/common/viewLayout/lineDecorations.ts
+2
-2
src/vs/editor/common/viewModel/splitLinesCollection.ts
src/vs/editor/common/viewModel/splitLinesCollection.ts
+2
-2
src/vs/editor/common/viewModel/viewModelDecorations.ts
src/vs/editor/common/viewModel/viewModelDecorations.ts
+1
-1
src/vs/editor/common/viewModel/viewModelImpl.ts
src/vs/editor/common/viewModel/viewModelImpl.ts
+3
-3
src/vs/monaco.d.ts
src/vs/monaco.d.ts
+1
-1
未找到文件。
src/vs/editor/browser/core/editorState.ts
浏览文件 @
91762aab
...
...
@@ -30,7 +30,7 @@ export class EditorState {
this
.
flags
=
flags
;
if
((
this
.
flags
&
CodeEditorStateFlag
.
Value
)
!==
0
)
{
var
model
=
editor
.
getModel
();
let
model
=
editor
.
getModel
();
this
.
modelVersionId
=
model
?
strings
.
format
(
'
{0}#{1}
'
,
model
.
uri
.
toString
(),
model
.
getVersionId
())
:
null
;
}
if
((
this
.
flags
&
CodeEditorStateFlag
.
Position
)
!==
0
)
{
...
...
@@ -50,7 +50,7 @@ export class EditorState {
if
(
!
(
other
instanceof
EditorState
))
{
return
false
;
}
var
state
=
<
EditorState
>
other
;
let
state
=
<
EditorState
>
other
;
if
(
this
.
modelVersionId
!==
state
.
modelVersionId
)
{
return
false
;
...
...
src/vs/editor/browser/widget/diffNavigator.ts
浏览文件 @
91762aab
...
...
@@ -25,7 +25,7 @@ export interface Options {
alwaysRevealFirst
?:
boolean
;
}
var
defaultOptions
:
Options
=
{
const
defaultOptions
:
Options
=
{
followsCaret
:
true
,
ignoreCharChanges
:
true
,
alwaysRevealFirst
:
true
...
...
@@ -84,7 +84,7 @@ export class DiffNavigator {
}
private
_init
():
void
{
var
changes
=
this
.
_editor
.
getLineChanges
();
let
changes
=
this
.
_editor
.
getLineChanges
();
if
(
!
changes
)
{
return
;
}
...
...
@@ -149,10 +149,10 @@ export class DiffNavigator {
}
private
_initIdx
(
fwd
:
boolean
):
void
{
var
found
=
false
;
var
position
=
this
.
_editor
.
getPosition
();
for
(
var
i
=
0
,
len
=
this
.
ranges
.
length
;
i
<
len
&&
!
found
;
i
++
)
{
var
range
=
this
.
ranges
[
i
].
range
;
let
found
=
false
;
let
position
=
this
.
_editor
.
getPosition
();
for
(
let
i
=
0
,
len
=
this
.
ranges
.
length
;
i
<
len
&&
!
found
;
i
++
)
{
let
range
=
this
.
ranges
[
i
].
range
;
if
(
position
.
isBeforeOrEqual
(
range
.
getStartPosition
()))
{
this
.
nextIdx
=
i
+
(
fwd
?
0
:
-
1
);
found
=
true
;
...
...
@@ -189,10 +189,10 @@ export class DiffNavigator {
}
}
var
info
=
this
.
ranges
[
this
.
nextIdx
];
let
info
=
this
.
ranges
[
this
.
nextIdx
];
this
.
ignoreSelectionChange
=
true
;
try
{
var
pos
=
info
.
range
.
getStartPosition
();
let
pos
=
info
.
range
.
getStartPosition
();
this
.
_editor
.
setPosition
(
pos
);
this
.
_editor
.
revealPositionInCenter
(
pos
,
ScrollType
.
Smooth
);
}
finally
{
...
...
src/vs/editor/common/config/commonEditorConfig.ts
浏览文件 @
91762aab
...
...
@@ -153,7 +153,7 @@ export abstract class CommonEditorConfiguration extends Disposable implements ed
}
private
static
_digitCount
(
n
:
number
):
number
{
var
r
=
0
;
let
r
=
0
;
while
(
n
)
{
n
=
Math
.
floor
(
n
/
10
);
r
++
;
...
...
src/vs/editor/common/controller/cursorMoveOperations.ts
浏览文件 @
91762aab
...
...
@@ -96,7 +96,7 @@ export class MoveOperations {
const
currentVisibleColumn
=
CursorColumns
.
visibleColumnFromColumn
(
model
.
getLineContent
(
lineNumber
),
column
,
config
.
tabSize
)
+
leftoverVisibleColumns
;
lineNumber
=
lineNumber
+
count
;
var
lineCount
=
model
.
getLineCount
();
let
lineCount
=
model
.
getLineCount
();
if
(
lineNumber
>
lineCount
)
{
lineNumber
=
lineCount
;
if
(
allowMoveOnLastLine
)
{
...
...
src/vs/editor/common/core/range.ts
浏览文件 @
91762aab
...
...
@@ -141,7 +141,11 @@ export class Range {
* The smallest position will be used as the start point, and the largest one as the end point.
*/
public
static
plusRange
(
a
:
IRange
,
b
:
IRange
):
Range
{
var
startLineNumber
:
number
,
startColumn
:
number
,
endLineNumber
:
number
,
endColumn
:
number
;
let
startLineNumber
:
number
;
let
startColumn
:
number
;
let
endLineNumber
:
number
;
let
endColumn
:
number
;
if
(
b
.
startLineNumber
<
a
.
startLineNumber
)
{
startLineNumber
=
b
.
startLineNumber
;
startColumn
=
b
.
startColumn
;
...
...
@@ -178,14 +182,14 @@ export class Range {
* A intersection of the two ranges.
*/
public
static
intersectRanges
(
a
:
IRange
,
b
:
IRange
):
Range
{
var
resultStartLineNumber
=
a
.
startLineNumber
,
resultStartColumn
=
a
.
startColumn
,
resultEndLineNumber
=
a
.
endLineNumber
,
resultEndColumn
=
a
.
endColumn
,
otherStartLineNumber
=
b
.
startLineNumber
,
otherStartColumn
=
b
.
startColumn
,
otherEndLineNumber
=
b
.
endLineNumber
,
otherEndColumn
=
b
.
endColumn
;
let
resultStartLineNumber
=
a
.
startLineNumber
;
let
resultStartColumn
=
a
.
startColumn
;
let
resultEndLineNumber
=
a
.
endLineNumber
;
let
resultEndColumn
=
a
.
endColumn
;
let
otherStartLineNumber
=
b
.
startLineNumber
;
let
otherStartColumn
=
b
.
startColumn
;
let
otherEndLineNumber
=
b
.
endLineNumber
;
let
otherEndColumn
=
b
.
endColumn
;
if
(
resultStartLineNumber
<
otherStartLineNumber
)
{
resultStartLineNumber
=
otherStartLineNumber
;
...
...
src/vs/editor/common/core/selection.ts
浏览文件 @
91762aab
...
...
@@ -175,7 +175,7 @@ export class Selection extends Range {
if
(
a
.
length
!==
b
.
length
)
{
return
false
;
}
for
(
var
i
=
0
,
len
=
a
.
length
;
i
<
len
;
i
++
)
{
for
(
let
i
=
0
,
len
=
a
.
length
;
i
<
len
;
i
++
)
{
if
(
!
this
.
selectionsEqual
(
a
[
i
],
b
[
i
]))
{
return
false
;
}
...
...
src/vs/editor/common/editorCommon.ts
浏览文件 @
91762aab
...
...
@@ -576,7 +576,7 @@ export interface IDecorationOptions {
/**
* The type of the `IEditor`.
*/
export
var
EditorType
=
{
export
const
EditorType
=
{
ICodeEditor
:
'
vs.editor.ICodeEditor
'
,
IDiffEditor
:
'
vs.editor.IDiffEditor
'
};
...
...
@@ -585,7 +585,7 @@ export var EditorType = {
* Built-in commands.
* @internal
*/
export
var
Handler
=
{
export
const
Handler
=
{
ExecuteCommand
:
'
executeCommand
'
,
ExecuteCommands
:
'
executeCommands
'
,
...
...
src/vs/editor/common/model/editStack.ts
浏览文件 @
91762aab
...
...
@@ -69,7 +69,7 @@ export class EditStack {
};
}
var
inverseEditOperation
:
IEditOperation
=
{
const
inverseEditOperation
:
IEditOperation
=
{
operations
:
this
.
model
.
applyEdits
(
editOperations
)
};
...
...
@@ -90,11 +90,11 @@ export class EditStack {
this
.
pushStackElement
();
if
(
this
.
past
.
length
>
0
)
{
var
pastStackElement
=
this
.
past
.
pop
();
const
pastStackElement
=
this
.
past
.
pop
();
try
{
// Apply all operations in reverse order
for
(
var
i
=
pastStackElement
.
editOperations
.
length
-
1
;
i
>=
0
;
i
--
)
{
for
(
let
i
=
pastStackElement
.
editOperations
.
length
-
1
;
i
>=
0
;
i
--
)
{
pastStackElement
.
editOperations
[
i
]
=
{
operations
:
this
.
model
.
applyEdits
(
pastStackElement
.
editOperations
[
i
].
operations
)
};
...
...
@@ -122,11 +122,11 @@ export class EditStack {
throw
new
Error
(
'
How is this possible?
'
);
}
var
futureStackElement
=
this
.
future
.
pop
();
const
futureStackElement
=
this
.
future
.
pop
();
try
{
// Apply all operations
for
(
var
i
=
0
;
i
<
futureStackElement
.
editOperations
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
futureStackElement
.
editOperations
.
length
;
i
++
)
{
futureStackElement
.
editOperations
[
i
]
=
{
operations
:
this
.
model
.
applyEdits
(
futureStackElement
.
editOperations
[
i
].
operations
)
};
...
...
src/vs/editor/common/model/textModel.ts
浏览文件 @
91762aab
...
...
@@ -34,7 +34,7 @@ import { EDITOR_MODEL_DEFAULTS } from 'vs/editor/common/config/editorOptions';
import
{
TextModelSearch
,
SearchParams
}
from
'
vs/editor/common/model/textModelSearch
'
;
import
{
TextBuffer
,
ITextBuffer
}
from
'
vs/editor/common/model/textBuffer
'
;
var
MODEL_ID
=
0
;
let
MODEL_ID
=
0
;
/**
* Produces 'a'-'z', followed by 'A'-'Z'... followed by 'a'-'z', etc.
...
...
@@ -316,10 +316,10 @@ export class TextModel extends Disposable implements model.ITextModel {
// There's nothing to do
return
;
}
var
oldFullModelRange
=
this
.
getFullModelRange
();
var
oldModelValueLength
=
this
.
getValueLengthInRange
(
oldFullModelRange
);
var
endLineNumber
=
this
.
getLineCount
();
var
endColumn
=
this
.
getLineMaxColumn
(
endLineNumber
);
const
oldFullModelRange
=
this
.
getFullModelRange
();
const
oldModelValueLength
=
this
.
getValueLengthInRange
(
oldFullModelRange
);
const
endLineNumber
=
this
.
getLineCount
();
const
endColumn
=
this
.
getLineMaxColumn
(
endLineNumber
);
this
.
_resetValue
(
newValue
);
...
...
@@ -625,8 +625,8 @@ export class TextModel extends Disposable implements model.ITextModel {
public
getValue
(
eol
?:
model
.
EndOfLinePreference
,
preserveBOM
:
boolean
=
false
):
string
{
this
.
_assertNotDisposed
();
var
fullModelRange
=
this
.
getFullModelRange
();
var
fullModelValue
=
this
.
getValueInRange
(
fullModelRange
,
eol
);
const
fullModelRange
=
this
.
getFullModelRange
();
const
fullModelValue
=
this
.
getValueInRange
(
fullModelRange
,
eol
);
if
(
preserveBOM
)
{
return
this
.
_buffer
.
getBOM
()
+
fullModelValue
;
...
...
@@ -654,8 +654,7 @@ export class TextModel extends Disposable implements model.ITextModel {
public
getValueLengthInRange
(
rawRange
:
IRange
,
eol
:
model
.
EndOfLinePreference
=
model
.
EndOfLinePreference
.
TextDefined
):
number
{
this
.
_assertNotDisposed
();
var
range
=
this
.
validateRange
(
rawRange
);
return
this
.
_buffer
.
getValueLengthInRange
(
range
,
eol
);
return
this
.
_buffer
.
getValueLengthInRange
(
this
.
validateRange
(
rawRange
),
eol
);
}
public
getLineCount
():
number
{
...
...
@@ -871,7 +870,7 @@ export class TextModel extends Disposable implements model.ITextModel {
public
getFullModelRange
():
Range
{
this
.
_assertNotDisposed
();
var
lineCount
=
this
.
getLineCount
();
const
lineCount
=
this
.
getLineCount
();
return
new
Range
(
1
,
1
,
lineCount
,
this
.
getLineMaxColumn
(
lineCount
));
}
...
...
@@ -1496,7 +1495,7 @@ export class TextModel extends Disposable implements model.ITextModel {
_warmUpTokens
():
void
{
// Warm up first 100 lines (if it takes less than 50ms)
var
maxLineNumber
=
Math
.
min
(
100
,
this
.
getLineCount
());
const
maxLineNumber
=
Math
.
min
(
100
,
this
.
getLineCount
());
this
.
_revalidateTokensNow
(
maxLineNumber
);
if
(
this
.
_tokens
.
hasLinesToTokenize
(
this
.
_buffer
))
{
...
...
@@ -1570,7 +1569,7 @@ export class TextModel extends Disposable implements model.ITextModel {
}
public
getWordUntilPosition
(
position
:
IPosition
):
model
.
IWordAtPosition
{
var
wordAtPosition
=
this
.
getWordAtPosition
(
position
);
const
wordAtPosition
=
this
.
getWordAtPosition
(
position
);
if
(
!
wordAtPosition
)
{
return
{
word
:
''
,
...
...
src/vs/editor/common/model/wordHelper.ts
浏览文件 @
91762aab
...
...
@@ -16,13 +16,12 @@ export const USUAL_WORD_SEPARATORS = '`~!@#$%^&*()-=+[{]}\\|;:\'",.<>/?';
* /(-?\d*\.\d\w*)|([^\`\~\!\@\#\$\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g
*/
function
createWordRegExp
(
allowInWords
:
string
=
''
):
RegExp
{
var
usualSeparators
=
USUAL_WORD_SEPARATORS
;
var
source
=
'
(-?
\\
d*
\\
.
\\
d
\\
w*)|([^
'
;
for
(
var
i
=
0
;
i
<
usualSeparators
.
length
;
i
++
)
{
if
(
allowInWords
.
indexOf
(
usualSeparators
[
i
])
>=
0
)
{
let
source
=
'
(-?
\\
d*
\\
.
\\
d
\\
w*)|([^
'
;
for
(
let
i
=
0
;
i
<
USUAL_WORD_SEPARATORS
.
length
;
i
++
)
{
if
(
allowInWords
.
indexOf
(
USUAL_WORD_SEPARATORS
[
i
])
>=
0
)
{
continue
;
}
source
+=
'
\\
'
+
usualSeparators
[
i
];
source
+=
'
\\
'
+
USUAL_WORD_SEPARATORS
[
i
];
}
source
+=
'
\\
s]+)
'
;
return
new
RegExp
(
source
,
'
g
'
);
...
...
@@ -32,11 +31,11 @@ function createWordRegExp(allowInWords: string = ''): RegExp {
export
const
DEFAULT_WORD_REGEXP
=
createWordRegExp
();
export
function
ensureValidWordDefinition
(
wordDefinition
?:
RegExp
):
RegExp
{
var
result
:
RegExp
=
DEFAULT_WORD_REGEXP
;
let
result
:
RegExp
=
DEFAULT_WORD_REGEXP
;
if
(
wordDefinition
&&
(
wordDefinition
instanceof
RegExp
))
{
if
(
!
wordDefinition
.
global
)
{
var
flags
=
'
g
'
;
let
flags
=
'
g
'
;
if
(
wordDefinition
.
ignoreCase
)
{
flags
+=
'
i
'
;
}
...
...
src/vs/editor/common/modes/modesRegistry.ts
浏览文件 @
91762aab
...
...
@@ -12,7 +12,7 @@ import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageCo
import
{
LanguageIdentifier
,
LanguageId
}
from
'
vs/editor/common/modes
'
;
// Define extension point ids
export
var
Extensions
=
{
export
const
Extensions
=
{
ModesRegistry
:
'
editor.modesRegistry
'
};
...
...
@@ -42,7 +42,7 @@ export class EditorModesRegistry {
}
}
export
var
ModesRegistry
=
new
EditorModesRegistry
();
export
const
ModesRegistry
=
new
EditorModesRegistry
();
Registry
.
add
(
Extensions
.
ModesRegistry
,
ModesRegistry
);
export
const
PLAINTEXT_MODE_ID
=
'
plaintext
'
;
...
...
src/vs/editor/common/modes/supports.ts
浏览文件 @
91762aab
...
...
@@ -59,7 +59,7 @@ export class ScopedLineTokens {
}
public
getLineContent
():
string
{
var
actualLineContent
=
this
.
_actual
.
getLineContent
();
const
actualLineContent
=
this
.
_actual
.
getLineContent
();
return
actualLineContent
.
substring
(
this
.
firstCharOffset
,
this
.
_lastCharOffset
);
}
...
...
src/vs/editor/common/modes/supports/electricCharacter.ts
浏览文件 @
91762aab
...
...
@@ -39,7 +39,7 @@ export class BracketElectricCharacterSupport {
}
public
getElectricCharacters
():
string
[]
{
var
result
:
string
[]
=
[];
let
result
:
string
[]
=
[];
if
(
this
.
_richEditBrackets
)
{
for
(
let
i
=
0
,
len
=
this
.
_richEditBrackets
.
brackets
.
length
;
i
<
len
;
i
++
)
{
...
...
src/vs/editor/common/modes/supports/inplaceReplaceSupport.ts
浏览文件 @
91762aab
...
...
@@ -45,9 +45,9 @@ export class BasicInplaceReplace {
}
private
numberReplace
(
value
:
string
,
up
:
boolean
):
string
{
var
precision
=
Math
.
pow
(
10
,
value
.
length
-
(
value
.
lastIndexOf
(
'
.
'
)
+
1
)),
n1
=
Number
(
value
),
n2
=
parseFloat
(
value
);
let
precision
=
Math
.
pow
(
10
,
value
.
length
-
(
value
.
lastIndexOf
(
'
.
'
)
+
1
));
let
n1
=
Number
(
value
);
let
n2
=
parseFloat
(
value
);
if
(
!
isNaN
(
n1
)
&&
!
isNaN
(
n2
)
&&
n1
===
n2
)
{
...
...
@@ -77,7 +77,7 @@ export class BasicInplaceReplace {
}
private
valueSetsReplace
(
valueSets
:
string
[][],
value
:
string
,
up
:
boolean
):
string
{
var
result
:
string
=
null
;
let
result
:
string
=
null
;
for
(
let
i
=
0
,
len
=
valueSets
.
length
;
result
===
null
&&
i
<
len
;
i
++
)
{
result
=
this
.
valueSetReplace
(
valueSets
[
i
],
value
,
up
);
}
...
...
@@ -85,7 +85,7 @@ export class BasicInplaceReplace {
}
private
valueSetReplace
(
valueSet
:
string
[],
value
:
string
,
up
:
boolean
):
string
{
var
idx
=
valueSet
.
indexOf
(
value
);
let
idx
=
valueSet
.
indexOf
(
value
);
if
(
idx
>=
0
)
{
idx
+=
up
?
+
1
:
-
1
;
if
(
idx
<
0
)
{
...
...
src/vs/editor/common/modes/supports/onEnter.ts
浏览文件 @
91762aab
...
...
@@ -84,7 +84,7 @@ export class OnEnterSupport {
}
private
static
_createOpenBracketRegExp
(
bracket
:
string
):
RegExp
{
var
str
=
strings
.
escapeRegExpCharacters
(
bracket
);
let
str
=
strings
.
escapeRegExpCharacters
(
bracket
);
if
(
!
/
\B
/
.
test
(
str
.
charAt
(
0
)))
{
str
=
'
\\
b
'
+
str
;
}
...
...
@@ -93,7 +93,7 @@ export class OnEnterSupport {
}
private
static
_createCloseBracketRegExp
(
bracket
:
string
):
RegExp
{
var
str
=
strings
.
escapeRegExpCharacters
(
bracket
);
let
str
=
strings
.
escapeRegExpCharacters
(
bracket
);
if
(
!
/
\B
/
.
test
(
str
.
charAt
(
str
.
length
-
1
)))
{
str
=
str
+
'
\\
b
'
;
}
...
...
src/vs/editor/common/modes/supports/richEditBrackets.ts
浏览文件 @
91762aab
...
...
@@ -82,21 +82,21 @@ function once<T, R>(keyFn: (input: T) => string, computeFn: (input: T) => R): (i
};
}
var
getRegexForBracketPair
=
once
<
ISimpleInternalBracket
,
RegExp
>
(
const
getRegexForBracketPair
=
once
<
ISimpleInternalBracket
,
RegExp
>
(
(
input
)
=>
`
${
input
.
open
}
;
${
input
.
close
}
`
,
(
input
)
=>
{
return
createOrRegex
([
input
.
open
,
input
.
close
]);
}
);
var
getReversedRegexForBracketPair
=
once
<
ISimpleInternalBracket
,
RegExp
>
(
const
getReversedRegexForBracketPair
=
once
<
ISimpleInternalBracket
,
RegExp
>
(
(
input
)
=>
`
${
input
.
open
}
;
${
input
.
close
}
`
,
(
input
)
=>
{
return
createOrRegex
([
toReversedString
(
input
.
open
),
toReversedString
(
input
.
close
)]);
}
);
var
getRegexForBrackets
=
once
<
ISimpleInternalBracket
[],
RegExp
>
(
const
getRegexForBrackets
=
once
<
ISimpleInternalBracket
[],
RegExp
>
(
(
input
)
=>
input
.
map
(
b
=>
`
${
b
.
open
}
;
${
b
.
close
}
`
).
join
(
'
;
'
),
(
input
)
=>
{
let
pieces
:
string
[]
=
[];
...
...
@@ -108,7 +108,7 @@ var getRegexForBrackets = once<ISimpleInternalBracket[], RegExp>(
}
);
var
getReversedRegexForBrackets
=
once
<
ISimpleInternalBracket
[],
RegExp
>
(
const
getReversedRegexForBrackets
=
once
<
ISimpleInternalBracket
[],
RegExp
>
(
(
input
)
=>
input
.
map
(
b
=>
`
${
b
.
open
}
;
${
b
.
close
}
`
).
join
(
'
;
'
),
(
input
)
=>
{
let
pieces
:
string
[]
=
[];
...
...
src/vs/editor/common/services/editorSimpleWorker.ts
浏览文件 @
91762aab
...
...
@@ -130,7 +130,7 @@ class MirrorModel extends BaseMirrorModel implements ICommonModel {
}
public
getWordUntilPosition
(
position
:
IPosition
,
wordDefinition
:
RegExp
):
IWordAtPosition
{
var
wordAtPosition
=
this
.
getWordAtPosition
(
position
,
wordDefinition
);
const
wordAtPosition
=
this
.
getWordAtPosition
(
position
,
wordDefinition
);
if
(
!
wordAtPosition
)
{
return
{
word
:
''
,
...
...
@@ -146,7 +146,7 @@ class MirrorModel extends BaseMirrorModel implements ICommonModel {
}
private
_getAllWords
(
wordDefinition
:
RegExp
):
string
[]
{
var
result
:
string
[]
=
[];
let
result
:
string
[]
=
[];
this
.
_lines
.
forEach
((
line
)
=>
{
this
.
_wordenize
(
line
,
wordDefinition
).
forEach
((
info
)
=>
{
result
.
push
(
line
.
substring
(
info
.
start
,
info
.
end
));
...
...
@@ -156,8 +156,8 @@ class MirrorModel extends BaseMirrorModel implements ICommonModel {
}
public
getAllUniqueWords
(
wordDefinition
:
RegExp
,
skipWordOnce
?:
string
):
string
[]
{
var
foundSkipWord
=
false
;
var
uniqueWords
=
Object
.
create
(
null
);
let
foundSkipWord
=
false
;
let
uniqueWords
=
Object
.
create
(
null
);
return
this
.
_getAllWords
(
wordDefinition
).
filter
((
word
)
=>
{
if
(
skipWordOnce
&&
!
foundSkipWord
&&
skipWordOnce
===
word
)
{
foundSkipWord
=
true
;
...
...
@@ -194,13 +194,13 @@ class MirrorModel extends BaseMirrorModel implements ICommonModel {
return
this
.
_lines
[
range
.
startLineNumber
-
1
].
substring
(
range
.
startColumn
-
1
,
range
.
endColumn
-
1
);
}
var
lineEnding
=
this
.
_eol
,
startLineIndex
=
range
.
startLineNumber
-
1
,
endLineIndex
=
range
.
endLineNumber
-
1
,
resultLines
:
string
[]
=
[];
let
lineEnding
=
this
.
_eol
;
let
startLineIndex
=
range
.
startLineNumber
-
1
;
let
endLineIndex
=
range
.
endLineNumber
-
1
;
let
resultLines
:
string
[]
=
[];
resultLines
.
push
(
this
.
_lines
[
startLineIndex
].
substring
(
range
.
startColumn
-
1
));
for
(
var
i
=
startLineIndex
+
1
;
i
<
endLineIndex
;
i
++
)
{
for
(
let
i
=
startLineIndex
+
1
;
i
<
endLineIndex
;
i
++
)
{
resultLines
.
push
(
this
.
_lines
[
i
]);
}
resultLines
.
push
(
this
.
_lines
[
endLineIndex
].
substring
(
0
,
range
.
endColumn
-
1
));
...
...
src/vs/editor/common/services/editorWorkerService.ts
浏览文件 @
91762aab
...
...
@@ -11,8 +11,8 @@ import { IChange, ILineChange } from 'vs/editor/common/editorCommon';
import
{
IInplaceReplaceSupportResult
,
TextEdit
}
from
'
vs/editor/common/modes
'
;
import
{
IRange
}
from
'
vs/editor/common/core/range
'
;
export
var
ID_EDITOR_WORKER_SERVICE
=
'
editorWorkerService
'
;
export
var
IEditorWorkerService
=
createDecorator
<
IEditorWorkerService
>
(
ID_EDITOR_WORKER_SERVICE
);
export
const
ID_EDITOR_WORKER_SERVICE
=
'
editorWorkerService
'
;
export
const
IEditorWorkerService
=
createDecorator
<
IEditorWorkerService
>
(
ID_EDITOR_WORKER_SERVICE
);
export
interface
IEditorWorkerService
{
_serviceBrand
:
any
;
...
...
src/vs/editor/common/services/languagesRegistry.ts
浏览文件 @
91762aab
...
...
@@ -14,7 +14,7 @@ import { LanguageId, LanguageIdentifier } from 'vs/editor/common/modes';
import
{
NULL_MODE_ID
,
NULL_LANGUAGE_IDENTIFIER
}
from
'
vs/editor/common/modes/nullMode
'
;
import
{
IConfigurationRegistry
,
Extensions
}
from
'
vs/platform/configuration/common/configurationRegistry
'
;
var
hasOwnProperty
=
Object
.
prototype
.
hasOwnProperty
;
const
hasOwnProperty
=
Object
.
prototype
.
hasOwnProperty
;
export
interface
IResolvedLanguage
{
identifier
:
LanguageIdentifier
;
...
...
@@ -299,7 +299,7 @@ export class LanguagesRegistry {
if
(
!
filename
&&
!
firstLine
)
{
return
[];
}
var
mimeTypes
=
mime
.
guessMimeTypes
(
filename
,
firstLine
);
let
mimeTypes
=
mime
.
guessMimeTypes
(
filename
,
firstLine
);
return
this
.
extractModeIds
(
mimeTypes
.
join
(
'
,
'
));
}
...
...
src/vs/editor/common/services/modeService.ts
浏览文件 @
91762aab
...
...
@@ -9,7 +9,7 @@ import { TPromise } from 'vs/base/common/winjs.base';
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IMode
,
LanguageId
,
LanguageIdentifier
}
from
'
vs/editor/common/modes
'
;
export
var
IModeService
=
createDecorator
<
IModeService
>
(
'
modeService
'
);
export
const
IModeService
=
createDecorator
<
IModeService
>
(
'
modeService
'
);
export
interface
ILanguageExtensionPoint
{
id
:
string
;
...
...
src/vs/editor/common/services/modeServiceImpl.ts
浏览文件 @
91762aab
...
...
@@ -64,7 +64,7 @@ export class ModeServiceImpl implements IModeService {
}
public
getModeIdByFilenameOrFirstLine
(
filename
:
string
,
firstLine
?:
string
):
string
{
var
modeIds
=
this
.
_registry
.
getModeIdsFromFilenameOrFirstLine
(
filename
,
firstLine
);
const
modeIds
=
this
.
_registry
.
getModeIdsFromFilenameOrFirstLine
(
filename
,
firstLine
);
if
(
modeIds
.
length
>
0
)
{
return
modeIds
[
0
];
...
...
@@ -74,7 +74,7 @@ export class ModeServiceImpl implements IModeService {
}
public
getModeId
(
commaSeparatedMimetypesOrCommaSeparatedIds
:
string
):
string
{
var
modeIds
=
this
.
_registry
.
extractModeIds
(
commaSeparatedMimetypesOrCommaSeparatedIds
);
const
modeIds
=
this
.
_registry
.
extractModeIds
(
commaSeparatedMimetypesOrCommaSeparatedIds
);
if
(
modeIds
.
length
>
0
)
{
return
modeIds
[
0
];
...
...
@@ -94,10 +94,10 @@ export class ModeServiceImpl implements IModeService {
// --- instantiation
public
getMode
(
commaSeparatedMimetypesOrCommaSeparatedIds
:
string
):
IMode
{
var
modeIds
=
this
.
_registry
.
extractModeIds
(
commaSeparatedMimetypesOrCommaSeparatedIds
);
const
modeIds
=
this
.
_registry
.
extractModeIds
(
commaSeparatedMimetypesOrCommaSeparatedIds
);
var
isPlainText
=
false
;
for
(
var
i
=
0
;
i
<
modeIds
.
length
;
i
++
)
{
let
isPlainText
=
false
;
for
(
let
i
=
0
;
i
<
modeIds
.
length
;
i
++
)
{
if
(
this
.
_instantiatedModes
.
hasOwnProperty
(
modeIds
[
i
]))
{
return
this
.
_instantiatedModes
[
modeIds
[
i
]];
}
...
...
@@ -106,7 +106,7 @@ export class ModeServiceImpl implements IModeService {
if
(
isPlainText
)
{
// Try to do it synchronously
var
r
:
IMode
=
null
;
let
r
:
IMode
=
null
;
this
.
getOrCreateMode
(
commaSeparatedMimetypesOrCommaSeparatedIds
).
then
((
mode
)
=>
{
r
=
mode
;
}).
done
(
null
,
onUnexpectedError
);
...
...
@@ -117,7 +117,7 @@ export class ModeServiceImpl implements IModeService {
public
getOrCreateMode
(
commaSeparatedMimetypesOrCommaSeparatedIds
:
string
):
TPromise
<
IMode
>
{
return
this
.
_onReady
().
then
(()
=>
{
var
modeId
=
this
.
getModeId
(
commaSeparatedMimetypesOrCommaSeparatedIds
);
const
modeId
=
this
.
getModeId
(
commaSeparatedMimetypesOrCommaSeparatedIds
);
// Fall back to plain text if no mode was found
return
this
.
_getOrCreateMode
(
modeId
||
'
plaintext
'
);
});
...
...
@@ -125,14 +125,14 @@ export class ModeServiceImpl implements IModeService {
public
getOrCreateModeByLanguageName
(
languageName
:
string
):
TPromise
<
IMode
>
{
return
this
.
_onReady
().
then
(()
=>
{
var
modeId
=
this
.
_getModeIdByLanguageName
(
languageName
);
const
modeId
=
this
.
_getModeIdByLanguageName
(
languageName
);
// Fall back to plain text if no mode was found
return
this
.
_getOrCreateMode
(
modeId
||
'
plaintext
'
);
});
}
private
_getModeIdByLanguageName
(
languageName
:
string
):
string
{
var
modeIds
=
this
.
_registry
.
getModeIdsFromLanguageName
(
languageName
);
const
modeIds
=
this
.
_registry
.
getModeIdsFromLanguageName
(
languageName
);
if
(
modeIds
.
length
>
0
)
{
return
modeIds
[
0
];
...
...
@@ -143,7 +143,7 @@ export class ModeServiceImpl implements IModeService {
public
getOrCreateModeByFilenameOrFirstLine
(
filename
:
string
,
firstLine
?:
string
):
TPromise
<
IMode
>
{
return
this
.
_onReady
().
then
(()
=>
{
var
modeId
=
this
.
getModeIdByFilenameOrFirstLine
(
filename
,
firstLine
);
const
modeId
=
this
.
getModeIdByFilenameOrFirstLine
(
filename
,
firstLine
);
// Fall back to plain text if no mode was found
return
this
.
_getOrCreateMode
(
modeId
||
'
plaintext
'
);
});
...
...
src/vs/editor/common/services/modelService.ts
浏览文件 @
91762aab
...
...
@@ -12,7 +12,7 @@ import { ITextModel, ITextModelCreationOptions } from 'vs/editor/common/model';
import
{
IMode
}
from
'
vs/editor/common/modes
'
;
import
{
IRawTextSource
}
from
'
vs/editor/common/model/textSource
'
;
export
var
IModelService
=
createDecorator
<
IModelService
>
(
'
modelService
'
);
export
const
IModelService
=
createDecorator
<
IModelService
>
(
'
modelService
'
);
export
interface
IModelService
{
_serviceBrand
:
any
;
...
...
src/vs/editor/common/view/runtimeMinimapCharRenderer.ts
浏览文件 @
91762aab
...
...
@@ -27,7 +27,7 @@ export function getOrCreateMinimapCharRenderer(): MinimapCharRenderer {
return
minimapCharRenderer
;
}
var
x2Data
=
[
let
x2Data
=
[
//
0
,
0
,
...
...
@@ -601,7 +601,7 @@ var x2Data = [
];
var
x1Data
=
[
let
x1Data
=
[
//
0
,
...
...
src/vs/editor/common/viewLayout/lineDecorations.ts
浏览文件 @
91762aab
...
...
@@ -115,7 +115,7 @@ class Stack {
public
consumeLowerThan
(
maxStopOffset
:
number
,
nextStartOffset
:
number
,
result
:
DecorationSegment
[]):
number
{
while
(
this
.
count
>
0
&&
this
.
stopOffsets
[
0
]
<
maxStopOffset
)
{
var
i
=
0
;
let
i
=
0
;
// Take all equal stopping offsets
while
(
i
+
1
<
this
.
count
&&
this
.
stopOffsets
[
i
]
===
this
.
stopOffsets
[
i
+
1
])
{
...
...
@@ -147,7 +147,7 @@ class Stack {
this
.
classNames
.
push
(
className
);
}
else
{
// Find the insertion position for `stopOffset`
for
(
var
i
=
0
;
i
<
this
.
count
;
i
++
)
{
for
(
let
i
=
0
;
i
<
this
.
count
;
i
++
)
{
if
(
this
.
stopOffsets
[
i
]
>=
stopOffset
)
{
this
.
stopOffsets
.
splice
(
i
,
0
,
stopOffset
);
this
.
classNames
.
splice
(
i
,
0
,
className
);
...
...
src/vs/editor/common/viewModel/splitLinesCollection.ts
浏览文件 @
91762aab
...
...
@@ -114,8 +114,8 @@ export class CoordinatesConverter implements ICoordinatesConverter {
}
public
validateViewRange
(
viewRange
:
Range
,
expectedModelRange
:
Range
):
Range
{
var
validViewStart
=
this
.
_lines
.
validateViewPosition
(
viewRange
.
startLineNumber
,
viewRange
.
startColumn
,
expectedModelRange
.
getStartPosition
());
var
validViewEnd
=
this
.
_lines
.
validateViewPosition
(
viewRange
.
endLineNumber
,
viewRange
.
endColumn
,
expectedModelRange
.
getEndPosition
());
const
validViewStart
=
this
.
_lines
.
validateViewPosition
(
viewRange
.
startLineNumber
,
viewRange
.
startColumn
,
expectedModelRange
.
getStartPosition
());
const
validViewEnd
=
this
.
_lines
.
validateViewPosition
(
viewRange
.
endLineNumber
,
viewRange
.
endColumn
,
expectedModelRange
.
getEndPosition
());
return
new
Range
(
validViewStart
.
lineNumber
,
validViewStart
.
column
,
validViewEnd
.
lineNumber
,
validViewEnd
.
column
);
}
...
...
src/vs/editor/common/viewModel/viewModelDecorations.ts
浏览文件 @
91762aab
...
...
@@ -93,7 +93,7 @@ export class ViewModelDecorations implements IDisposable {
}
public
getDecorationsViewportData
(
viewRange
:
Range
):
IDecorationsViewportData
{
var
cacheIsValid
=
true
;
let
cacheIsValid
=
true
;
cacheIsValid
=
cacheIsValid
&&
(
this
.
_cachedModelDecorationsResolver
!==
null
);
cacheIsValid
=
cacheIsValid
&&
(
viewRange
.
equalsRange
(
this
.
_cachedModelDecorationsResolverViewRange
));
if
(
!
cacheIsValid
)
{
...
...
src/vs/editor/common/viewModel/viewModelImpl.ts
浏览文件 @
91762aab
...
...
@@ -340,7 +340,7 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel
}
public
getLineFirstNonWhitespaceColumn
(
lineNumber
:
number
):
number
{
var
result
=
strings
.
firstNonWhitespaceIndex
(
this
.
getLineContent
(
lineNumber
));
const
result
=
strings
.
firstNonWhitespaceIndex
(
this
.
getLineContent
(
lineNumber
));
if
(
result
===
-
1
)
{
return
0
;
}
...
...
@@ -348,7 +348,7 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel
}
public
getLineLastNonWhitespaceColumn
(
lineNumber
:
number
):
number
{
var
result
=
strings
.
lastNonWhitespaceIndex
(
this
.
getLineContent
(
lineNumber
));
const
result
=
strings
.
lastNonWhitespaceIndex
(
this
.
getLineContent
(
lineNumber
));
if
(
result
===
-
1
)
{
return
0
;
}
...
...
@@ -401,7 +401,7 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel
}
public
getValueInRange
(
range
:
Range
,
eol
:
EndOfLinePreference
):
string
{
var
modelRange
=
this
.
coordinatesConverter
.
convertViewRangeToModelRange
(
range
);
const
modelRange
=
this
.
coordinatesConverter
.
convertViewRangeToModelRange
(
range
);
return
this
.
model
.
getValueInRange
(
modelRange
,
eol
);
}
...
...
src/vs/monaco.d.ts
浏览文件 @
91762aab
...
...
@@ -2135,7 +2135,7 @@ declare module monaco.editor {
/**
* The type of the `IEditor`.
*/
export
var
EditorType
:
{
export
const
EditorType
:
{
ICodeEditor
:
string
;
IDiffEditor
:
string
;
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录