Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
7b0a1cd3
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7b0a1cd3
编写于
1月 04, 2018
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Eliminate extraneuous model interfaces
上级
059ead3c
变更
43
隐藏空白更改
内联
并排
Showing
43 changed file
with
274 addition
and
318 deletion
+274
-318
build/monaco/monaco.d.ts.recipe
build/monaco/monaco.d.ts.recipe
+4
-1
src/vs/editor/common/commands/replaceCommand.ts
src/vs/editor/common/commands/replaceCommand.ts
+8
-8
src/vs/editor/common/commands/shiftCommand.ts
src/vs/editor/common/commands/shiftCommand.ts
+3
-3
src/vs/editor/common/commands/surroundSelectionCommand.ts
src/vs/editor/common/commands/surroundSelectionCommand.ts
+3
-3
src/vs/editor/common/commands/trimTrailingWhitespaceCommand.ts
...s/editor/common/commands/trimTrailingWhitespaceCommand.ts
+3
-3
src/vs/editor/common/controller/cursorTypeOperations.ts
src/vs/editor/common/controller/cursorTypeOperations.ts
+20
-20
src/vs/editor/common/editorCommon.ts
src/vs/editor/common/editorCommon.ts
+40
-64
src/vs/editor/common/model/editStack.ts
src/vs/editor/common/model/editStack.ts
+4
-3
src/vs/editor/common/model/textModel.ts
src/vs/editor/common/model/textModel.ts
+1
-1
src/vs/editor/common/modes.ts
src/vs/editor/common/modes.ts
+18
-18
src/vs/editor/common/modes/languageConfigurationRegistry.ts
src/vs/editor/common/modes/languageConfigurationRegistry.ts
+8
-8
src/vs/editor/common/modes/languageFeatureRegistry.ts
src/vs/editor/common/modes/languageFeatureRegistry.ts
+7
-7
src/vs/editor/contrib/caretOperations/moveCaretCommand.ts
src/vs/editor/contrib/caretOperations/moveCaretCommand.ts
+3
-3
src/vs/editor/contrib/colorPicker/color.ts
src/vs/editor/contrib/colorPicker/color.ts
+3
-3
src/vs/editor/contrib/comment/blockCommentCommand.ts
src/vs/editor/contrib/comment/blockCommentCommand.ts
+3
-3
src/vs/editor/contrib/comment/lineCommentCommand.ts
src/vs/editor/contrib/comment/lineCommentCommand.ts
+6
-6
src/vs/editor/contrib/dnd/dragAndDropCommand.ts
src/vs/editor/contrib/dnd/dragAndDropCommand.ts
+3
-3
src/vs/editor/contrib/find/replaceAllCommand.ts
src/vs/editor/contrib/find/replaceAllCommand.ts
+2
-2
src/vs/editor/contrib/folding/indentRangeProvider.ts
src/vs/editor/contrib/folding/indentRangeProvider.ts
+3
-3
src/vs/editor/contrib/format/format.ts
src/vs/editor/contrib/format/format.ts
+4
-4
src/vs/editor/contrib/format/formatCommand.ts
src/vs/editor/contrib/format/formatCommand.ts
+5
-5
src/vs/editor/contrib/goToDeclaration/goToDeclaration.ts
src/vs/editor/contrib/goToDeclaration/goToDeclaration.ts
+6
-6
src/vs/editor/contrib/hover/getHover.ts
src/vs/editor/contrib/hover/getHover.ts
+2
-2
src/vs/editor/contrib/inPlaceReplace/inPlaceReplaceCommand.ts
...vs/editor/contrib/inPlaceReplace/inPlaceReplaceCommand.ts
+2
-2
src/vs/editor/contrib/indentation/indentation.ts
src/vs/editor/contrib/indentation/indentation.ts
+10
-10
src/vs/editor/contrib/linesOperations/copyLinesCommand.ts
src/vs/editor/contrib/linesOperations/copyLinesCommand.ts
+2
-2
src/vs/editor/contrib/linesOperations/deleteLinesCommand.ts
src/vs/editor/contrib/linesOperations/deleteLinesCommand.ts
+3
-3
src/vs/editor/contrib/linesOperations/moveLinesCommand.ts
src/vs/editor/contrib/linesOperations/moveLinesCommand.ts
+6
-6
src/vs/editor/contrib/linesOperations/sortLinesCommand.ts
src/vs/editor/contrib/linesOperations/sortLinesCommand.ts
+5
-5
src/vs/editor/contrib/links/getLinks.ts
src/vs/editor/contrib/links/getLinks.ts
+2
-2
src/vs/editor/contrib/parameterHints/provideSignatureHelp.ts
src/vs/editor/contrib/parameterHints/provideSignatureHelp.ts
+2
-2
src/vs/editor/contrib/quickFix/quickFix.ts
src/vs/editor/contrib/quickFix/quickFix.ts
+2
-2
src/vs/editor/contrib/referenceSearch/referenceSearch.ts
src/vs/editor/contrib/referenceSearch/referenceSearch.ts
+1
-1
src/vs/editor/contrib/rename/rename.ts
src/vs/editor/contrib/rename/rename.ts
+2
-2
src/vs/editor/contrib/wordHighlighter/wordHighlighter.ts
src/vs/editor/contrib/wordHighlighter/wordHighlighter.ts
+1
-1
src/vs/editor/standalone/browser/standaloneLanguages.ts
src/vs/editor/standalone/browser/standaloneLanguages.ts
+8
-8
src/vs/editor/test/browser/controller/cursor.test.ts
src/vs/editor/test/browser/controller/cursor.test.ts
+3
-3
src/vs/monaco.d.ts
src/vs/monaco.d.ts
+43
-67
src/vs/workbench/api/electron-browser/mainThreadLanguageFeatures.ts
...kbench/api/electron-browser/mainThreadLanguageFeatures.ts
+14
-14
src/vs/workbench/parts/debug/electron-browser/repl.ts
src/vs/workbench/parts/debug/electron-browser/repl.ts
+2
-2
src/vs/workbench/parts/preferences/common/smartSnippetInserter.ts
...orkbench/parts/preferences/common/smartSnippetInserter.ts
+2
-2
src/vs/workbench/parts/quickopen/browser/gotoLineHandler.ts
src/vs/workbench/parts/quickopen/browser/gotoLineHandler.ts
+2
-2
src/vs/workbench/parts/quickopen/browser/gotoSymbolHandler.ts
...vs/workbench/parts/quickopen/browser/gotoSymbolHandler.ts
+3
-3
未找到文件。
build/monaco/monaco.d.ts.recipe
浏览文件 @
7b0a1cd3
...
...
@@ -62,12 +62,15 @@ export interface ICommandHandler {
#include(vs/editor/standalone/browser/colorizer): IColorizerOptions, IColorizerElementOptions
#include(vs/base/common/scrollable): ScrollbarVisibility
#include(vs/platform/theme/common/themeService): ThemeColor
#includeAll(vs/editor/common/editorCommon;IMode=>languages.IMode;LanguageIdentifier=>languages.LanguageIdentifier;editorOptions.=>): IS
election, IS
crollEvent
#includeAll(vs/editor/common/editorCommon;IMode=>languages.IMode;LanguageIdentifier=>languages.LanguageIdentifier;editorOptions.=>): IScrollEvent
#includeAll(vs/editor/common/model/textModelEvents):
#includeAll(vs/editor/common/controller/cursorEvents):
#includeAll(vs/editor/common/config/editorOptions):
#includeAll(vs/editor/browser/editorBrowser;editorCommon.=>;editorOptions.=>):
#include(vs/editor/common/config/fontInfo): FontInfo, BareFontInfo
//compatibility:
export type IReadOnlyModel = IModel;
}
declare module monaco.languages {
...
...
src/vs/editor/common/commands/replaceCommand.ts
浏览文件 @
7b0a1cd3
...
...
@@ -20,11 +20,11 @@ export class ReplaceCommand implements editorCommon.ICommand {
this
.
insertsAutoWhitespace
=
insertsAutoWhitespace
;
}
public
getEditOperations
(
model
:
editorCommon
.
I
Tokenized
Model
,
builder
:
editorCommon
.
IEditOperationBuilder
):
void
{
public
getEditOperations
(
model
:
editorCommon
.
IModel
,
builder
:
editorCommon
.
IEditOperationBuilder
):
void
{
builder
.
addTrackedEditOperation
(
this
.
_range
,
this
.
_text
);
}
public
computeCursorState
(
model
:
editorCommon
.
I
Tokenized
Model
,
helper
:
editorCommon
.
ICursorStateComputerData
):
Selection
{
public
computeCursorState
(
model
:
editorCommon
.
IModel
,
helper
:
editorCommon
.
ICursorStateComputerData
):
Selection
{
let
inverseEditOperations
=
helper
.
getInverseEditOperations
();
let
srcRange
=
inverseEditOperations
[
0
].
range
;
return
new
Selection
(
...
...
@@ -48,11 +48,11 @@ export class ReplaceCommandWithoutChangingPosition implements editorCommon.IComm
this
.
insertsAutoWhitespace
=
insertsAutoWhitespace
;
}
public
getEditOperations
(
model
:
editorCommon
.
I
Tokenized
Model
,
builder
:
editorCommon
.
IEditOperationBuilder
):
void
{
public
getEditOperations
(
model
:
editorCommon
.
IModel
,
builder
:
editorCommon
.
IEditOperationBuilder
):
void
{
builder
.
addTrackedEditOperation
(
this
.
_range
,
this
.
_text
);
}
public
computeCursorState
(
model
:
editorCommon
.
I
Tokenized
Model
,
helper
:
editorCommon
.
ICursorStateComputerData
):
Selection
{
public
computeCursorState
(
model
:
editorCommon
.
IModel
,
helper
:
editorCommon
.
ICursorStateComputerData
):
Selection
{
let
inverseEditOperations
=
helper
.
getInverseEditOperations
();
let
srcRange
=
inverseEditOperations
[
0
].
range
;
return
new
Selection
(
...
...
@@ -80,11 +80,11 @@ export class ReplaceCommandWithOffsetCursorState implements editorCommon.IComman
this
.
insertsAutoWhitespace
=
insertsAutoWhitespace
;
}
public
getEditOperations
(
model
:
editorCommon
.
I
Tokenized
Model
,
builder
:
editorCommon
.
IEditOperationBuilder
):
void
{
public
getEditOperations
(
model
:
editorCommon
.
IModel
,
builder
:
editorCommon
.
IEditOperationBuilder
):
void
{
builder
.
addTrackedEditOperation
(
this
.
_range
,
this
.
_text
);
}
public
computeCursorState
(
model
:
editorCommon
.
I
Tokenized
Model
,
helper
:
editorCommon
.
ICursorStateComputerData
):
Selection
{
public
computeCursorState
(
model
:
editorCommon
.
IModel
,
helper
:
editorCommon
.
ICursorStateComputerData
):
Selection
{
let
inverseEditOperations
=
helper
.
getInverseEditOperations
();
let
srcRange
=
inverseEditOperations
[
0
].
range
;
return
new
Selection
(
...
...
@@ -109,12 +109,12 @@ export class ReplaceCommandThatPreservesSelection implements editorCommon.IComma
this
.
_initialSelection
=
initialSelection
;
}
public
getEditOperations
(
model
:
editorCommon
.
I
Tokenized
Model
,
builder
:
editorCommon
.
IEditOperationBuilder
):
void
{
public
getEditOperations
(
model
:
editorCommon
.
IModel
,
builder
:
editorCommon
.
IEditOperationBuilder
):
void
{
builder
.
addEditOperation
(
this
.
_range
,
this
.
_text
);
this
.
_selectionId
=
builder
.
trackSelection
(
this
.
_initialSelection
);
}
public
computeCursorState
(
model
:
editorCommon
.
I
Tokenized
Model
,
helper
:
editorCommon
.
ICursorStateComputerData
):
Selection
{
public
computeCursorState
(
model
:
editorCommon
.
IModel
,
helper
:
editorCommon
.
ICursorStateComputerData
):
Selection
{
return
helper
.
getTrackedSelection
(
this
.
_selectionId
);
}
}
src/vs/editor/common/commands/shiftCommand.ts
浏览文件 @
7b0a1cd3
...
...
@@ -8,7 +8,7 @@ import * as strings from 'vs/base/common/strings';
import
{
CursorColumns
}
from
'
vs/editor/common/controller/cursorCommon
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
Selection
,
SelectionDirection
}
from
'
vs/editor/common/core/selection
'
;
import
{
ICommand
,
ICursorStateComputerData
,
IEditOperationBuilder
,
I
Tokenized
Model
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ICommand
,
ICursorStateComputerData
,
IEditOperationBuilder
,
IModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
LanguageConfigurationRegistry
}
from
'
vs/editor/common/modes/languageConfigurationRegistry
'
;
import
{
CharCode
}
from
'
vs/base/common/charCode
'
;
...
...
@@ -62,7 +62,7 @@ export class ShiftCommand implements ICommand {
}
}
public
getEditOperations
(
model
:
I
Tokenized
Model
,
builder
:
IEditOperationBuilder
):
void
{
public
getEditOperations
(
model
:
IModel
,
builder
:
IEditOperationBuilder
):
void
{
const
startLine
=
this
.
_selection
.
startLineNumber
;
let
endLine
=
this
.
_selection
.
endLineNumber
;
...
...
@@ -216,7 +216,7 @@ export class ShiftCommand implements ICommand {
this
.
_selectionId
=
builder
.
trackSelection
(
this
.
_selection
);
}
public
computeCursorState
(
model
:
I
Tokenized
Model
,
helper
:
ICursorStateComputerData
):
Selection
{
public
computeCursorState
(
model
:
IModel
,
helper
:
ICursorStateComputerData
):
Selection
{
if
(
this
.
_useLastEditRangeForCursorEndPosition
)
{
let
lastOp
=
helper
.
getInverseEditOperations
()[
0
];
return
new
Selection
(
lastOp
.
range
.
endLineNumber
,
lastOp
.
range
.
endColumn
,
lastOp
.
range
.
endLineNumber
,
lastOp
.
range
.
endColumn
);
...
...
src/vs/editor/common/commands/surroundSelectionCommand.ts
浏览文件 @
7b0a1cd3
...
...
@@ -6,7 +6,7 @@
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
Selection
}
from
'
vs/editor/common/core/selection
'
;
import
{
ICommand
,
ICursorStateComputerData
,
IEditOperationBuilder
,
I
Tokenized
Model
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ICommand
,
ICursorStateComputerData
,
IEditOperationBuilder
,
IModel
}
from
'
vs/editor/common/editorCommon
'
;
export
class
SurroundSelectionCommand
implements
ICommand
{
private
_range
:
Selection
;
...
...
@@ -19,7 +19,7 @@ export class SurroundSelectionCommand implements ICommand {
this
.
_charAfterSelection
=
charAfterSelection
;
}
public
getEditOperations
(
model
:
I
Tokenized
Model
,
builder
:
IEditOperationBuilder
):
void
{
public
getEditOperations
(
model
:
IModel
,
builder
:
IEditOperationBuilder
):
void
{
builder
.
addTrackedEditOperation
(
new
Range
(
this
.
_range
.
startLineNumber
,
this
.
_range
.
startColumn
,
...
...
@@ -35,7 +35,7 @@ export class SurroundSelectionCommand implements ICommand {
),
this
.
_charAfterSelection
);
}
public
computeCursorState
(
model
:
I
Tokenized
Model
,
helper
:
ICursorStateComputerData
):
Selection
{
public
computeCursorState
(
model
:
IModel
,
helper
:
ICursorStateComputerData
):
Selection
{
let
inverseEditOperations
=
helper
.
getInverseEditOperations
();
let
firstOperationRange
=
inverseEditOperations
[
0
].
range
;
let
secondOperationRange
=
inverseEditOperations
[
1
].
range
;
...
...
src/vs/editor/common/commands/trimTrailingWhitespaceCommand.ts
浏览文件 @
7b0a1cd3
...
...
@@ -22,7 +22,7 @@ export class TrimTrailingWhitespaceCommand implements editorCommon.ICommand {
this
.
cursors
=
cursors
;
}
public
getEditOperations
(
model
:
editorCommon
.
I
Tokenized
Model
,
builder
:
editorCommon
.
IEditOperationBuilder
):
void
{
public
getEditOperations
(
model
:
editorCommon
.
IModel
,
builder
:
editorCommon
.
IEditOperationBuilder
):
void
{
let
ops
=
trimTrailingWhitespace
(
model
,
this
.
cursors
);
for
(
let
i
=
0
,
len
=
ops
.
length
;
i
<
len
;
i
++
)
{
let
op
=
ops
[
i
];
...
...
@@ -33,7 +33,7 @@ export class TrimTrailingWhitespaceCommand implements editorCommon.ICommand {
this
.
selectionId
=
builder
.
trackSelection
(
this
.
selection
);
}
public
computeCursorState
(
model
:
editorCommon
.
I
Tokenized
Model
,
helper
:
editorCommon
.
ICursorStateComputerData
):
Selection
{
public
computeCursorState
(
model
:
editorCommon
.
IModel
,
helper
:
editorCommon
.
ICursorStateComputerData
):
Selection
{
return
helper
.
getTrackedSelection
(
this
.
selectionId
);
}
}
...
...
@@ -41,7 +41,7 @@ export class TrimTrailingWhitespaceCommand implements editorCommon.ICommand {
/**
* Generate commands for trimming trailing whitespace on a model and ignore lines on which cursors are sitting.
*/
export
function
trimTrailingWhitespace
(
model
:
editorCommon
.
I
Text
Model
,
cursors
:
Position
[]):
editorCommon
.
IIdentifiedSingleEditOperation
[]
{
export
function
trimTrailingWhitespace
(
model
:
editorCommon
.
IModel
,
cursors
:
Position
[]):
editorCommon
.
IIdentifiedSingleEditOperation
[]
{
// Sort cursors ascending
cursors
.
sort
((
a
,
b
)
=>
{
if
(
a
.
lineNumber
===
b
.
lineNumber
)
{
...
...
src/vs/editor/common/controller/cursorTypeOperations.ts
浏览文件 @
7b0a1cd3
...
...
@@ -8,7 +8,7 @@ import { onUnexpectedError } from 'vs/base/common/errors';
import
{
ReplaceCommand
,
ReplaceCommandWithoutChangingPosition
,
ReplaceCommandWithOffsetCursorState
}
from
'
vs/editor/common/commands/replaceCommand
'
;
import
{
CursorColumns
,
CursorConfiguration
,
ICursorSimpleModel
,
EditOperationResult
,
EditOperationType
}
from
'
vs/editor/common/controller/cursorCommon
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
ICommand
,
I
Tokenized
Model
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ICommand
,
IModel
}
from
'
vs/editor/common/editorCommon
'
;
import
*
as
strings
from
'
vs/base/common/strings
'
;
import
{
ShiftCommand
}
from
'
vs/editor/common/commands/shiftCommand
'
;
import
{
Selection
}
from
'
vs/editor/common/core/selection
'
;
...
...
@@ -136,7 +136,7 @@ export class TypeOperations {
}
}
private
static
_goodIndentForLine
(
config
:
CursorConfiguration
,
model
:
I
Tokenized
Model
,
lineNumber
:
number
):
string
{
private
static
_goodIndentForLine
(
config
:
CursorConfiguration
,
model
:
IModel
,
lineNumber
:
number
):
string
{
let
action
:
IndentAction
|
EnterAction
;
let
indentation
:
string
;
...
...
@@ -207,7 +207,7 @@ export class TypeOperations {
return
new
ReplaceCommand
(
selection
,
typeText
,
insertsAutoWhitespace
);
}
public
static
tab
(
config
:
CursorConfiguration
,
model
:
I
Tokenized
Model
,
selections
:
Selection
[]):
ICommand
[]
{
public
static
tab
(
config
:
CursorConfiguration
,
model
:
IModel
,
selections
:
Selection
[]):
ICommand
[]
{
let
commands
:
ICommand
[]
=
[];
for
(
let
i
=
0
,
len
=
selections
.
length
;
i
<
len
;
i
++
)
{
const
selection
=
selections
[
i
];
...
...
@@ -248,7 +248,7 @@ export class TypeOperations {
return
commands
;
}
public
static
replacePreviousChar
(
prevEditOperationType
:
EditOperationType
,
config
:
CursorConfiguration
,
model
:
I
Tokenized
Model
,
selections
:
Selection
[],
txt
:
string
,
replaceCharCnt
:
number
):
EditOperationResult
{
public
static
replacePreviousChar
(
prevEditOperationType
:
EditOperationType
,
config
:
CursorConfiguration
,
model
:
IModel
,
selections
:
Selection
[],
txt
:
string
,
replaceCharCnt
:
number
):
EditOperationResult
{
let
commands
:
ICommand
[]
=
[];
for
(
let
i
=
0
,
len
=
selections
.
length
;
i
<
len
;
i
++
)
{
const
selection
=
selections
[
i
];
...
...
@@ -278,7 +278,7 @@ export class TypeOperations {
}
}
private
static
_enter
(
config
:
CursorConfiguration
,
model
:
I
Tokenized
Model
,
keepPosition
:
boolean
,
range
:
Range
):
ICommand
{
private
static
_enter
(
config
:
CursorConfiguration
,
model
:
IModel
,
keepPosition
:
boolean
,
range
:
Range
):
ICommand
{
if
(
!
model
.
isCheapToTokenize
(
range
.
getStartPosition
().
lineNumber
))
{
let
lineText
=
model
.
getLineContent
(
range
.
startLineNumber
);
let
indentation
=
strings
.
getLeadingWhitespace
(
lineText
).
substring
(
0
,
range
.
startColumn
-
1
);
...
...
@@ -375,7 +375,7 @@ export class TypeOperations {
}
}
private
static
_isAutoIndentType
(
config
:
CursorConfiguration
,
model
:
I
Tokenized
Model
,
selections
:
Selection
[]):
boolean
{
private
static
_isAutoIndentType
(
config
:
CursorConfiguration
,
model
:
IModel
,
selections
:
Selection
[]):
boolean
{
if
(
!
config
.
autoIndent
)
{
return
false
;
}
...
...
@@ -389,7 +389,7 @@ export class TypeOperations {
return
true
;
}
private
static
_runAutoIndentType
(
config
:
CursorConfiguration
,
model
:
I
Tokenized
Model
,
range
:
Range
,
ch
:
string
):
ICommand
{
private
static
_runAutoIndentType
(
config
:
CursorConfiguration
,
model
:
IModel
,
range
:
Range
,
ch
:
string
):
ICommand
{
let
currentIndentation
=
LanguageConfigurationRegistry
.
getIndentationAtPosition
(
model
,
range
.
startLineNumber
,
range
.
startColumn
);
let
actualIndentation
=
LanguageConfigurationRegistry
.
getIndentActionForType
(
model
,
range
,
ch
,
{
shiftIndent
:
(
indentation
)
=>
{
...
...
@@ -425,7 +425,7 @@ export class TypeOperations {
return
null
;
}
private
static
_isAutoClosingCloseCharType
(
config
:
CursorConfiguration
,
model
:
I
Tokenized
Model
,
selections
:
Selection
[],
ch
:
string
):
boolean
{
private
static
_isAutoClosingCloseCharType
(
config
:
CursorConfiguration
,
model
:
IModel
,
selections
:
Selection
[],
ch
:
string
):
boolean
{
if
(
!
config
.
autoClosingBrackets
||
!
config
.
autoClosingPairsClose
.
hasOwnProperty
(
ch
))
{
return
false
;
}
...
...
@@ -468,7 +468,7 @@ export class TypeOperations {
return
cnt
;
}
private
static
_runAutoClosingCloseCharType
(
prevEditOperationType
:
EditOperationType
,
config
:
CursorConfiguration
,
model
:
I
Tokenized
Model
,
selections
:
Selection
[],
ch
:
string
):
EditOperationResult
{
private
static
_runAutoClosingCloseCharType
(
prevEditOperationType
:
EditOperationType
,
config
:
CursorConfiguration
,
model
:
IModel
,
selections
:
Selection
[],
ch
:
string
):
EditOperationResult
{
let
commands
:
ICommand
[]
=
[];
for
(
let
i
=
0
,
len
=
selections
.
length
;
i
<
len
;
i
++
)
{
const
selection
=
selections
[
i
];
...
...
@@ -482,7 +482,7 @@ export class TypeOperations {
});
}
private
static
_isAutoClosingOpenCharType
(
config
:
CursorConfiguration
,
model
:
I
Tokenized
Model
,
selections
:
Selection
[],
ch
:
string
):
boolean
{
private
static
_isAutoClosingOpenCharType
(
config
:
CursorConfiguration
,
model
:
IModel
,
selections
:
Selection
[],
ch
:
string
):
boolean
{
if
(
!
config
.
autoClosingBrackets
||
!
config
.
autoClosingPairsOpen
.
hasOwnProperty
(
ch
))
{
return
false
;
}
...
...
@@ -550,7 +550,7 @@ export class TypeOperations {
return
true
;
}
private
static
_runAutoClosingOpenCharType
(
prevEditOperationType
:
EditOperationType
,
config
:
CursorConfiguration
,
model
:
I
Tokenized
Model
,
selections
:
Selection
[],
ch
:
string
):
EditOperationResult
{
private
static
_runAutoClosingOpenCharType
(
prevEditOperationType
:
EditOperationType
,
config
:
CursorConfiguration
,
model
:
IModel
,
selections
:
Selection
[],
ch
:
string
):
EditOperationResult
{
let
commands
:
ICommand
[]
=
[];
for
(
let
i
=
0
,
len
=
selections
.
length
;
i
<
len
;
i
++
)
{
const
selection
=
selections
[
i
];
...
...
@@ -563,7 +563,7 @@ export class TypeOperations {
});
}
private
static
_isSurroundSelectionType
(
config
:
CursorConfiguration
,
model
:
I
Tokenized
Model
,
selections
:
Selection
[],
ch
:
string
):
boolean
{
private
static
_isSurroundSelectionType
(
config
:
CursorConfiguration
,
model
:
IModel
,
selections
:
Selection
[],
ch
:
string
):
boolean
{
if
(
!
config
.
autoClosingBrackets
||
!
config
.
surroundingPairs
.
hasOwnProperty
(
ch
))
{
return
false
;
}
...
...
@@ -597,7 +597,7 @@ export class TypeOperations {
return
true
;
}
private
static
_runSurroundSelectionType
(
prevEditOperationType
:
EditOperationType
,
config
:
CursorConfiguration
,
model
:
I
Tokenized
Model
,
selections
:
Selection
[],
ch
:
string
):
EditOperationResult
{
private
static
_runSurroundSelectionType
(
prevEditOperationType
:
EditOperationType
,
config
:
CursorConfiguration
,
model
:
IModel
,
selections
:
Selection
[],
ch
:
string
):
EditOperationResult
{
let
commands
:
ICommand
[]
=
[];
for
(
let
i
=
0
,
len
=
selections
.
length
;
i
<
len
;
i
++
)
{
const
selection
=
selections
[
i
];
...
...
@@ -610,14 +610,14 @@ export class TypeOperations {
});
}
private
static
_isTypeInterceptorElectricChar
(
config
:
CursorConfiguration
,
model
:
I
Tokenized
Model
,
selections
:
Selection
[])
{
private
static
_isTypeInterceptorElectricChar
(
config
:
CursorConfiguration
,
model
:
IModel
,
selections
:
Selection
[])
{
if
(
selections
.
length
===
1
&&
model
.
isCheapToTokenize
(
selections
[
0
].
getEndPosition
().
lineNumber
))
{
return
true
;
}
return
false
;
}
private
static
_typeInterceptorElectricChar
(
prevEditOperationType
:
EditOperationType
,
config
:
CursorConfiguration
,
model
:
I
Tokenized
Model
,
selection
:
Selection
,
ch
:
string
):
EditOperationResult
{
private
static
_typeInterceptorElectricChar
(
prevEditOperationType
:
EditOperationType
,
config
:
CursorConfiguration
,
model
:
IModel
,
selection
:
Selection
,
ch
:
string
):
EditOperationResult
{
if
(
!
config
.
electricChars
.
hasOwnProperty
(
ch
)
||
!
selection
.
isEmpty
())
{
return
null
;
}
...
...
@@ -680,7 +680,7 @@ export class TypeOperations {
return
null
;
}
public
static
typeWithInterceptors
(
prevEditOperationType
:
EditOperationType
,
config
:
CursorConfiguration
,
model
:
I
Tokenized
Model
,
selections
:
Selection
[],
ch
:
string
):
EditOperationResult
{
public
static
typeWithInterceptors
(
prevEditOperationType
:
EditOperationType
,
config
:
CursorConfiguration
,
model
:
IModel
,
selections
:
Selection
[],
ch
:
string
):
EditOperationResult
{
if
(
ch
===
'
\n
'
)
{
let
commands
:
ICommand
[]
=
[];
...
...
@@ -747,7 +747,7 @@ export class TypeOperations {
});
}
public
static
typeWithoutInterceptors
(
prevEditOperationType
:
EditOperationType
,
config
:
CursorConfiguration
,
model
:
I
Tokenized
Model
,
selections
:
Selection
[],
str
:
string
):
EditOperationResult
{
public
static
typeWithoutInterceptors
(
prevEditOperationType
:
EditOperationType
,
config
:
CursorConfiguration
,
model
:
IModel
,
selections
:
Selection
[],
str
:
string
):
EditOperationResult
{
let
commands
:
ICommand
[]
=
[];
for
(
let
i
=
0
,
len
=
selections
.
length
;
i
<
len
;
i
++
)
{
commands
[
i
]
=
new
ReplaceCommand
(
selections
[
i
],
str
);
...
...
@@ -758,7 +758,7 @@ export class TypeOperations {
});
}
public
static
lineInsertBefore
(
config
:
CursorConfiguration
,
model
:
I
Tokenized
Model
,
selections
:
Selection
[]):
ICommand
[]
{
public
static
lineInsertBefore
(
config
:
CursorConfiguration
,
model
:
IModel
,
selections
:
Selection
[]):
ICommand
[]
{
let
commands
:
ICommand
[]
=
[];
for
(
let
i
=
0
,
len
=
selections
.
length
;
i
<
len
;
i
++
)
{
let
lineNumber
=
selections
[
i
].
positionLineNumber
;
...
...
@@ -775,7 +775,7 @@ export class TypeOperations {
return
commands
;
}
public
static
lineInsertAfter
(
config
:
CursorConfiguration
,
model
:
I
Tokenized
Model
,
selections
:
Selection
[]):
ICommand
[]
{
public
static
lineInsertAfter
(
config
:
CursorConfiguration
,
model
:
IModel
,
selections
:
Selection
[]):
ICommand
[]
{
let
commands
:
ICommand
[]
=
[];
for
(
let
i
=
0
,
len
=
selections
.
length
;
i
<
len
;
i
++
)
{
const
lineNumber
=
selections
[
i
].
positionLineNumber
;
...
...
@@ -785,7 +785,7 @@ export class TypeOperations {
return
commands
;
}
public
static
lineBreakInsert
(
config
:
CursorConfiguration
,
model
:
I
Tokenized
Model
,
selections
:
Selection
[]):
ICommand
[]
{
public
static
lineBreakInsert
(
config
:
CursorConfiguration
,
model
:
IModel
,
selections
:
Selection
[]):
ICommand
[]
{
let
commands
:
ICommand
[]
=
[];
for
(
let
i
=
0
,
len
=
selections
.
length
;
i
<
len
;
i
++
)
{
commands
[
i
]
=
this
.
_enter
(
config
,
model
,
true
,
selections
[
i
]);
...
...
src/vs/editor/common/editorCommon.ts
浏览文件 @
7b0a1cd3
...
...
@@ -336,7 +336,7 @@ export interface ICommand {
* @param model The model the command will execute on.
* @param builder A helper to collect the needed edit operations and to track selections.
*/
getEditOperations
(
model
:
I
Tokenized
Model
,
builder
:
IEditOperationBuilder
):
void
;
getEditOperations
(
model
:
IModel
,
builder
:
IEditOperationBuilder
):
void
;
/**
* Compute the cursor state after the edit operations were applied.
...
...
@@ -344,7 +344,7 @@ export interface ICommand {
* @param helper A helper to get inverse edit operations and to get previously tracked selections.
* @return The cursor state after the command executed.
*/
computeCursorState
(
model
:
I
Tokenized
Model
,
helper
:
ICursorStateComputerData
):
Selection
;
computeCursorState
(
model
:
IModel
,
helper
:
ICursorStateComputerData
):
Selection
;
}
/**
...
...
@@ -474,10 +474,46 @@ export interface ITextModelUpdateOptions {
trimAutoWhitespace
?:
boolean
;
}
export
class
FindMatch
{
_findMatchBrand
:
void
;
public
readonly
range
:
Range
;
public
readonly
matches
:
string
[];
/**
* @internal
*/
constructor
(
range
:
Range
,
matches
:
string
[])
{
this
.
range
=
range
;
this
.
matches
=
matches
;
}
}
/**
*
A textual read-only model.
*
@internal
*/
export
interface
ITextModel
{
export
interface
IFoundBracket
{
range
:
Range
;
open
:
string
;
close
:
string
;
isOpen
:
boolean
;
}
/**
* Describes the behavior of decorations when typing/editing near their edges.
* Note: Please do not edit the values, as they very carefully match `DecorationRangeBehavior`
*/
export
enum
TrackedRangeStickiness
{
AlwaysGrowsWhenTypingAtEdges
=
0
,
NeverGrowsWhenTypingAtEdges
=
1
,
GrowsOnlyWhenTypingBefore
=
2
,
GrowsOnlyWhenTypingAfter
=
3
,
}
/**
* A model.
*/
export
interface
IModel
{
/**
* If true, the text model might contain RTL.
...
...
@@ -724,24 +760,7 @@ export interface ITextModel {
* @return The range where the previous match is. It is null if no previous match has been found.
*/
findPreviousMatch
(
searchString
:
string
,
searchStart
:
IPosition
,
isRegex
:
boolean
,
matchCase
:
boolean
,
wordSeparators
:
string
,
captureMatches
:
boolean
):
FindMatch
;
}
export
class
FindMatch
{
_findMatchBrand
:
void
;
public
readonly
range
:
Range
;
public
readonly
matches
:
string
[];
/**
* @internal
*/
constructor
(
range
:
Range
,
matches
:
string
[])
{
this
.
range
=
range
;
this
.
matches
=
matches
;
}
}
export
interface
IReadOnlyModel
extends
ITextModel
{
/**
* Gets the resource associated with this editor model.
*/
...
...
@@ -773,22 +792,6 @@ export interface IReadOnlyModel extends ITextModel {
* @return The word under or besides `position`. Will never be null.
*/
getWordUntilPosition
(
position
:
IPosition
):
IWordAtPosition
;
}
/**
* @internal
*/
export
interface
IFoundBracket
{
range
:
Range
;
open
:
string
;
close
:
string
;
isOpen
:
boolean
;
}
/**
* A model that is tokenized.
*/
export
interface
ITokenizedModel
extends
ITextModel
{
/**
* Force tokenization information for `lineNumber` to be accurate.
...
...
@@ -894,23 +897,7 @@ export interface ITokenizedModel extends ITextModel {
* @internal
*/
getLinesIndentGuides
(
startLineNumber
:
number
,
endLineNumber
:
number
):
number
[];
}
/**
* Describes the behavior of decorations when typing/editing near their edges.
* Note: Please do not edit the values, as they very carefully match `DecorationRangeBehavior`
*/
export
enum
TrackedRangeStickiness
{
AlwaysGrowsWhenTypingAtEdges
=
0
,
NeverGrowsWhenTypingAtEdges
=
1
,
GrowsOnlyWhenTypingBefore
=
2
,
GrowsOnlyWhenTypingAfter
=
3
,
}
/**
* A model that can have decorations.
*/
export
interface
ITextModelWithDecorations
{
/**
* Change the decorations. The callback will be called with a change accessor
* that becomes invalid as soon as the callback finishes executing.
...
...
@@ -1006,12 +993,6 @@ export interface ITextModelWithDecorations {
* @internal
*/
_setTrackedRange
(
id
:
string
,
newRange
:
Range
,
newStickiness
:
TrackedRangeStickiness
):
string
;
}
/**
* An editable text model.
*/
export
interface
IEditableTextModel
extends
ITextModel
{
/**
* Normalize a string containing whitespace according to indentation rules (converts to spaces or to tabs).
...
...
@@ -1071,12 +1052,7 @@ export interface IEditableTextModel extends ITextModel {
* @internal
*/
redo
():
Selection
[];
}
/**
* A model.
*/
export
interface
IModel
extends
IReadOnlyModel
,
IEditableTextModel
,
ITokenizedModel
,
ITextModelWithDecorations
{
/**
* @deprecated Please use `onDidChangeContent` instead.
* An event emitted when the contents of the model have changed.
...
...
src/vs/editor/common/model/editStack.ts
浏览文件 @
7b0a1cd3
...
...
@@ -5,8 +5,9 @@
'
use strict
'
;
import
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
import
{
ICursorStateComputer
,
I
EditableTextModel
,
I
IdentifiedSingleEditOperation
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ICursorStateComputer
,
IIdentifiedSingleEditOperation
}
from
'
vs/editor/common/editorCommon
'
;
import
{
Selection
}
from
'
vs/editor/common/core/selection
'
;
import
{
TextModel
}
from
'
vs/editor/common/model/textModel
'
;
interface
IEditOperation
{
operations
:
IIdentifiedSingleEditOperation
[];
...
...
@@ -29,12 +30,12 @@ export interface IUndoRedoResult {
export
class
EditStack
{
private
model
:
IEditable
TextModel
;
private
model
:
TextModel
;
private
currentOpenStackElement
:
IStackElement
;
private
past
:
IStackElement
[];
private
future
:
IStackElement
[];
constructor
(
model
:
IEditable
TextModel
)
{
constructor
(
model
:
TextModel
)
{
this
.
model
=
model
;
this
.
currentOpenStackElement
=
null
;
this
.
past
=
[];
...
...
src/vs/editor/common/model/textModel.ts
浏览文件 @
7b0a1cd3
...
...
@@ -59,7 +59,7 @@ export interface ITextModelCreationData {
readonly
options
:
editorCommon
.
TextModelResolvedOptions
;
}
export
class
TextModel
extends
Disposable
implements
editorCommon
.
IModel
,
editorCommon
.
IEditableTextModel
,
editorCommon
.
ITextModelWithDecorations
,
editorCommon
.
ITokenizedModel
,
editorCommon
.
ITextModel
{
export
class
TextModel
extends
Disposable
implements
editorCommon
.
IModel
{
private
static
readonly
MODEL_SYNC_LIMIT
=
50
*
1024
*
1024
;
// 50 MB
private
static
readonly
MODEL_TOKENIZATION_LIMIT
=
20
*
1024
*
1024
;
// 20 MB
...
...
src/vs/editor/common/modes.ts
浏览文件 @
7b0a1cd3
...
...
@@ -181,7 +181,7 @@ export interface HoverProvider {
* position will be merged by the editor. A hover can have a range which defaults
* to the word range at the position when omitted.
*/
provideHover
(
model
:
editorCommon
.
I
ReadOnly
Model
,
position
:
Position
,
token
:
CancellationToken
):
Hover
|
Thenable
<
Hover
>
;
provideHover
(
model
:
editorCommon
.
IModel
,
position
:
Position
,
token
:
CancellationToken
):
Hover
|
Thenable
<
Hover
>
;
}
/**
...
...
@@ -292,7 +292,7 @@ export interface CodeActionProvider {
/**
* Provide commands for the given document and range.
*/
provideCodeActions
(
model
:
editorCommon
.
I
ReadOnly
Model
,
range
:
Range
,
token
:
CancellationToken
):
CodeAction
[]
|
Thenable
<
CodeAction
[]
>
;
provideCodeActions
(
model
:
editorCommon
.
IModel
,
range
:
Range
,
token
:
CancellationToken
):
CodeAction
[]
|
Thenable
<
CodeAction
[]
>
;
}
/**
...
...
@@ -362,7 +362,7 @@ export interface SignatureHelpProvider {
/**
* Provide help for the signature at the given position and document.
*/
provideSignatureHelp
(
model
:
editorCommon
.
I
ReadOnly
Model
,
position
:
Position
,
token
:
CancellationToken
):
SignatureHelp
|
Thenable
<
SignatureHelp
>
;
provideSignatureHelp
(
model
:
editorCommon
.
IModel
,
position
:
Position
,
token
:
CancellationToken
):
SignatureHelp
|
Thenable
<
SignatureHelp
>
;
}
/**
...
...
@@ -406,7 +406,7 @@ export interface DocumentHighlightProvider {
* Provide a set of document highlights, like all occurrences of a variable or
* all exit-points of a function.
*/
provideDocumentHighlights
(
model
:
editorCommon
.
I
ReadOnly
Model
,
position
:
Position
,
token
:
CancellationToken
):
DocumentHighlight
[]
|
Thenable
<
DocumentHighlight
[]
>
;
provideDocumentHighlights
(
model
:
editorCommon
.
IModel
,
position
:
Position
,
token
:
CancellationToken
):
DocumentHighlight
[]
|
Thenable
<
DocumentHighlight
[]
>
;
}
/**
...
...
@@ -427,7 +427,7 @@ export interface ReferenceProvider {
/**
* Provide a set of project-wide references for the given position and document.
*/
provideReferences
(
model
:
editorCommon
.
I
ReadOnly
Model
,
position
:
Position
,
context
:
ReferenceContext
,
token
:
CancellationToken
):
Location
[]
|
Thenable
<
Location
[]
>
;
provideReferences
(
model
:
editorCommon
.
IModel
,
position
:
Position
,
context
:
ReferenceContext
,
token
:
CancellationToken
):
Location
[]
|
Thenable
<
Location
[]
>
;
}
/**
...
...
@@ -460,7 +460,7 @@ export interface DefinitionProvider {
/**
* Provide the definition of the symbol at the given position and document.
*/
provideDefinition
(
model
:
editorCommon
.
I
ReadOnly
Model
,
position
:
Position
,
token
:
CancellationToken
):
Definition
|
Thenable
<
Definition
>
;
provideDefinition
(
model
:
editorCommon
.
IModel
,
position
:
Position
,
token
:
CancellationToken
):
Definition
|
Thenable
<
Definition
>
;
}
/**
...
...
@@ -471,7 +471,7 @@ export interface ImplementationProvider {
/**
* Provide the implementation of the symbol at the given position and document.
*/
provideImplementation
(
model
:
editorCommon
.
I
ReadOnly
Model
,
position
:
Position
,
token
:
CancellationToken
):
Definition
|
Thenable
<
Definition
>
;
provideImplementation
(
model
:
editorCommon
.
IModel
,
position
:
Position
,
token
:
CancellationToken
):
Definition
|
Thenable
<
Definition
>
;
}
/**
...
...
@@ -482,7 +482,7 @@ export interface TypeDefinitionProvider {
/**
* Provide the type definition of the symbol at the given position and document.
*/
provideTypeDefinition
(
model
:
editorCommon
.
I
ReadOnly
Model
,
position
:
Position
,
token
:
CancellationToken
):
Definition
|
Thenable
<
Definition
>
;
provideTypeDefinition
(
model
:
editorCommon
.
IModel
,
position
:
Position
,
token
:
CancellationToken
):
Definition
|
Thenable
<
Definition
>
;
}
/**
...
...
@@ -592,7 +592,7 @@ export interface DocumentSymbolProvider {
/**
* Provide symbol information for the given document.
*/
provideDocumentSymbols
(
model
:
editorCommon
.
I
ReadOnly
Model
,
token
:
CancellationToken
):
SymbolInformation
[]
|
Thenable
<
SymbolInformation
[]
>
;
provideDocumentSymbols
(
model
:
editorCommon
.
IModel
,
token
:
CancellationToken
):
SymbolInformation
[]
|
Thenable
<
SymbolInformation
[]
>
;
}
export
interface
TextEdit
{
...
...
@@ -622,7 +622,7 @@ export interface DocumentFormattingEditProvider {
/**
* Provide formatting edits for a whole document.
*/
provideDocumentFormattingEdits
(
model
:
editorCommon
.
I
ReadOnly
Model
,
options
:
FormattingOptions
,
token
:
CancellationToken
):
TextEdit
[]
|
Thenable
<
TextEdit
[]
>
;
provideDocumentFormattingEdits
(
model
:
editorCommon
.
IModel
,
options
:
FormattingOptions
,
token
:
CancellationToken
):
TextEdit
[]
|
Thenable
<
TextEdit
[]
>
;
}
/**
* The document formatting provider interface defines the contract between extensions and
...
...
@@ -636,7 +636,7 @@ export interface DocumentRangeFormattingEditProvider {
* or larger range. Often this is done by adjusting the start and end
* of the range to full syntax nodes.
*/
provideDocumentRangeFormattingEdits
(
model
:
editorCommon
.
I
ReadOnly
Model
,
range
:
Range
,
options
:
FormattingOptions
,
token
:
CancellationToken
):
TextEdit
[]
|
Thenable
<
TextEdit
[]
>
;
provideDocumentRangeFormattingEdits
(
model
:
editorCommon
.
IModel
,
range
:
Range
,
options
:
FormattingOptions
,
token
:
CancellationToken
):
TextEdit
[]
|
Thenable
<
TextEdit
[]
>
;
}
/**
* The document formatting provider interface defines the contract between extensions and
...
...
@@ -651,7 +651,7 @@ export interface OnTypeFormattingEditProvider {
* what range the position to expand to, like find the matching `{`
* when `}` has been entered.
*/
provideOnTypeFormattingEdits
(
model
:
editorCommon
.
I
ReadOnly
Model
,
position
:
Position
,
ch
:
string
,
options
:
FormattingOptions
,
token
:
CancellationToken
):
TextEdit
[]
|
Thenable
<
TextEdit
[]
>
;
provideOnTypeFormattingEdits
(
model
:
editorCommon
.
IModel
,
position
:
Position
,
ch
:
string
,
options
:
FormattingOptions
,
token
:
CancellationToken
):
TextEdit
[]
|
Thenable
<
TextEdit
[]
>
;
}
/**
...
...
@@ -673,7 +673,7 @@ export interface ILink {
* A provider of links.
*/
export
interface
LinkProvider
{
provideLinks
(
model
:
editorCommon
.
I
ReadOnly
Model
,
token
:
CancellationToken
):
ILink
[]
|
Thenable
<
ILink
[]
>
;
provideLinks
(
model
:
editorCommon
.
IModel
,
token
:
CancellationToken
):
ILink
[]
|
Thenable
<
ILink
[]
>
;
resolveLink
?:
(
link
:
ILink
,
token
:
CancellationToken
)
=>
ILink
|
Thenable
<
ILink
>
;
}
...
...
@@ -748,11 +748,11 @@ export interface DocumentColorProvider {
/**
* Provides the color ranges for a specific model.
*/
provideDocumentColors
(
model
:
editorCommon
.
I
ReadOnly
Model
,
token
:
CancellationToken
):
IColorInformation
[]
|
Thenable
<
IColorInformation
[]
>
;
provideDocumentColors
(
model
:
editorCommon
.
IModel
,
token
:
CancellationToken
):
IColorInformation
[]
|
Thenable
<
IColorInformation
[]
>
;
/**
* Provide the string representations for a color.
*/
provideColorPresentations
(
model
:
editorCommon
.
I
ReadOnly
Model
,
colorInfo
:
IColorInformation
,
token
:
CancellationToken
):
IColorPresentation
[]
|
Thenable
<
IColorPresentation
[]
>
;
provideColorPresentations
(
model
:
editorCommon
.
IModel
,
colorInfo
:
IColorInformation
,
token
:
CancellationToken
):
IColorPresentation
[]
|
Thenable
<
IColorPresentation
[]
>
;
}
export
interface
IResourceEdit
{
...
...
@@ -765,7 +765,7 @@ export interface WorkspaceEdit {
rejectReason
?:
string
;
}
export
interface
RenameProvider
{
provideRenameEdits
(
model
:
editorCommon
.
I
ReadOnly
Model
,
position
:
Position
,
newName
:
string
,
token
:
CancellationToken
):
WorkspaceEdit
|
Thenable
<
WorkspaceEdit
>
;
provideRenameEdits
(
model
:
editorCommon
.
IModel
,
position
:
Position
,
newName
:
string
,
token
:
CancellationToken
):
WorkspaceEdit
|
Thenable
<
WorkspaceEdit
>
;
}
...
...
@@ -782,8 +782,8 @@ export interface ICodeLensSymbol {
}
export
interface
CodeLensProvider
{
onDidChange
?:
Event
<
this
>
;
provideCodeLenses
(
model
:
editorCommon
.
I
ReadOnly
Model
,
token
:
CancellationToken
):
ICodeLensSymbol
[]
|
Thenable
<
ICodeLensSymbol
[]
>
;
resolveCodeLens
?(
model
:
editorCommon
.
I
ReadOnly
Model
,
codeLens
:
ICodeLensSymbol
,
token
:
CancellationToken
):
ICodeLensSymbol
|
Thenable
<
ICodeLensSymbol
>
;
provideCodeLenses
(
model
:
editorCommon
.
IModel
,
token
:
CancellationToken
):
ICodeLensSymbol
[]
|
Thenable
<
ICodeLensSymbol
[]
>
;
resolveCodeLens
?(
model
:
editorCommon
.
IModel
,
codeLens
:
ICodeLensSymbol
,
token
:
CancellationToken
):
ICodeLensSymbol
|
Thenable
<
ICodeLensSymbol
>
;
}
// --- feature registries ------
...
...
src/vs/editor/common/modes/languageConfigurationRegistry.ts
浏览文件 @
7b0a1cd3
...
...
@@ -10,7 +10,7 @@ import { IOnEnterSupportOptions, OnEnterSupport } from 'vs/editor/common/modes/s
import
{
IndentRulesSupport
,
IndentConsts
}
from
'
vs/editor/common/modes/supports/indentRules
'
;
import
{
RichEditBrackets
}
from
'
vs/editor/common/modes/supports/richEditBrackets
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
I
Tokenized
Model
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
import
*
as
strings
from
'
vs/base/common/strings
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
...
...
@@ -544,7 +544,7 @@ export class LanguageConfigurationRegistryImpl {
return
null
;
}
public
getIndentForEnter
(
model
:
I
Tokenized
Model
,
range
:
Range
,
indentConverter
:
IIndentConverter
,
autoIndent
:
boolean
):
{
beforeEnter
:
string
,
afterEnter
:
string
}
{
public
getIndentForEnter
(
model
:
IModel
,
range
:
Range
,
indentConverter
:
IIndentConverter
,
autoIndent
:
boolean
):
{
beforeEnter
:
string
,
afterEnter
:
string
}
{
model
.
forceTokenization
(
range
.
startLineNumber
);
let
lineTokens
=
model
.
getLineTokens
(
range
.
startLineNumber
);
...
...
@@ -642,7 +642,7 @@ export class LanguageConfigurationRegistryImpl {
* We should always allow intentional indentation. It means, if users change the indentation of `lineNumber` and the content of
* this line doesn't match decreaseIndentPattern, we should not adjust the indentation.
*/
public
getIndentActionForType
(
model
:
I
Tokenized
Model
,
range
:
Range
,
ch
:
string
,
indentConverter
:
IIndentConverter
):
string
{
public
getIndentActionForType
(
model
:
IModel
,
range
:
Range
,
ch
:
string
,
indentConverter
:
IIndentConverter
):
string
{
let
scopedLineTokens
=
this
.
getScopedLineTokens
(
model
,
range
.
startLineNumber
,
range
.
startColumn
);
let
indentRulesSupport
=
this
.
getIndentRulesSupport
(
scopedLineTokens
.
languageId
);
if
(
!
indentRulesSupport
)
{
...
...
@@ -683,7 +683,7 @@ export class LanguageConfigurationRegistryImpl {
return
null
;
}
public
getIndentMetadata
(
model
:
I
Tokenized
Model
,
lineNumber
:
number
):
number
{
public
getIndentMetadata
(
model
:
IModel
,
lineNumber
:
number
):
number
{
let
indentRulesSupport
=
this
.
getIndentRulesSupport
(
model
.
getLanguageIdentifier
().
id
);
if
(
!
indentRulesSupport
)
{
return
null
;
...
...
@@ -708,13 +708,13 @@ export class LanguageConfigurationRegistryImpl {
return
value
.
onEnter
||
null
;
}
public
getRawEnterActionAtPosition
(
model
:
I
Tokenized
Model
,
lineNumber
:
number
,
column
:
number
):
EnterAction
{
public
getRawEnterActionAtPosition
(
model
:
IModel
,
lineNumber
:
number
,
column
:
number
):
EnterAction
{
let
r
=
this
.
getEnterAction
(
model
,
new
Range
(
lineNumber
,
column
,
lineNumber
,
column
));
return
r
?
r
.
enterAction
:
null
;
}
public
getEnterAction
(
model
:
I
Tokenized
Model
,
range
:
Range
):
{
enterAction
:
EnterAction
;
indentation
:
string
;
}
{
public
getEnterAction
(
model
:
IModel
,
range
:
Range
):
{
enterAction
:
EnterAction
;
indentation
:
string
;
}
{
let
indentation
=
this
.
getIndentationAtPosition
(
model
,
range
.
startLineNumber
,
range
.
startColumn
);
let
scopedLineTokens
=
this
.
getScopedLineTokens
(
model
,
range
.
startLineNumber
,
range
.
startColumn
);
...
...
@@ -780,7 +780,7 @@ export class LanguageConfigurationRegistryImpl {
};
}
public
getIndentationAtPosition
(
model
:
I
Tokenized
Model
,
lineNumber
:
number
,
column
:
number
):
string
{
public
getIndentationAtPosition
(
model
:
IModel
,
lineNumber
:
number
,
column
:
number
):
string
{
let
lineText
=
model
.
getLineContent
(
lineNumber
);
let
indentation
=
strings
.
getLeadingWhitespace
(
lineText
);
if
(
indentation
.
length
>
column
-
1
)
{
...
...
@@ -790,7 +790,7 @@ export class LanguageConfigurationRegistryImpl {
return
indentation
;
}
private
getScopedLineTokens
(
model
:
I
Tokenized
Model
,
lineNumber
:
number
,
columnNumber
?:
number
)
{
private
getScopedLineTokens
(
model
:
IModel
,
lineNumber
:
number
,
columnNumber
?:
number
)
{
model
.
forceTokenization
(
lineNumber
);
let
lineTokens
=
model
.
getLineTokens
(
lineNumber
);
let
column
=
isNaN
(
columnNumber
)
?
model
.
getLineMaxColumn
(
lineNumber
)
-
1
:
columnNumber
-
1
;
...
...
src/vs/editor/common/modes/languageFeatureRegistry.ts
浏览文件 @
7b0a1cd3
...
...
@@ -7,7 +7,7 @@
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
I
ReadOnly
Model
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
LanguageSelector
,
score
}
from
'
vs/editor/common/modes/languageSelector
'
;
interface
Entry
<
T
>
{
...
...
@@ -58,11 +58,11 @@ export default class LanguageFeatureRegistry<T> {
};
}
has
(
model
:
I
ReadOnly
Model
):
boolean
{
has
(
model
:
IModel
):
boolean
{
return
this
.
all
(
model
).
length
>
0
;
}
all
(
model
:
I
ReadOnly
Model
):
T
[]
{
all
(
model
:
IModel
):
T
[]
{
if
(
!
model
||
model
.
isTooLargeForHavingARichMode
())
{
return
[];
}
...
...
@@ -80,13 +80,13 @@ export default class LanguageFeatureRegistry<T> {
return
result
;
}
ordered
(
model
:
I
ReadOnly
Model
):
T
[]
{
ordered
(
model
:
IModel
):
T
[]
{
const
result
:
T
[]
=
[];
this
.
_orderedForEach
(
model
,
entry
=>
result
.
push
(
entry
.
provider
));
return
result
;
}
orderedGroups
(
model
:
I
ReadOnly
Model
):
T
[][]
{
orderedGroups
(
model
:
IModel
):
T
[][]
{
const
result
:
T
[][]
=
[];
let
lastBucket
:
T
[];
let
lastBucketScore
:
number
;
...
...
@@ -104,7 +104,7 @@ export default class LanguageFeatureRegistry<T> {
return
result
;
}
private
_orderedForEach
(
model
:
I
ReadOnly
Model
,
callback
:
(
provider
:
Entry
<
T
>
)
=>
any
):
void
{
private
_orderedForEach
(
model
:
IModel
,
callback
:
(
provider
:
Entry
<
T
>
)
=>
any
):
void
{
if
(
!
model
||
model
.
isTooLargeForHavingARichMode
())
{
return
;
...
...
@@ -122,7 +122,7 @@ export default class LanguageFeatureRegistry<T> {
private
_lastCandidate
:
{
uri
:
string
;
language
:
string
;
};
private
_updateScores
(
model
:
I
ReadOnly
Model
):
void
{
private
_updateScores
(
model
:
IModel
):
void
{
let
candidate
=
{
uri
:
model
.
uri
.
toString
(),
...
...
src/vs/editor/contrib/caretOperations/moveCaretCommand.ts
浏览文件 @
7b0a1cd3
...
...
@@ -6,7 +6,7 @@
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
Selection
}
from
'
vs/editor/common/core/selection
'
;
import
{
ICommand
,
ICursorStateComputerData
,
IEditOperationBuilder
,
I
Tokenized
Model
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ICommand
,
ICursorStateComputerData
,
IEditOperationBuilder
,
IModel
}
from
'
vs/editor/common/editorCommon
'
;
export
class
MoveCaretCommand
implements
ICommand
{
...
...
@@ -24,7 +24,7 @@ export class MoveCaretCommand implements ICommand {
this
.
_isMovingLeft
=
isMovingLeft
;
}
public
getEditOperations
(
model
:
I
Tokenized
Model
,
builder
:
IEditOperationBuilder
):
void
{
public
getEditOperations
(
model
:
IModel
,
builder
:
IEditOperationBuilder
):
void
{
var
s
=
this
.
_selection
;
this
.
_selectionId
=
builder
.
trackSelection
(
s
);
if
(
s
.
startLineNumber
!==
s
.
endLineNumber
)
{
...
...
@@ -63,7 +63,7 @@ export class MoveCaretCommand implements ICommand {
this
.
_moved
=
true
;
}
public
computeCursorState
(
model
:
I
Tokenized
Model
,
helper
:
ICursorStateComputerData
):
Selection
{
public
computeCursorState
(
model
:
IModel
,
helper
:
ICursorStateComputerData
):
Selection
{
var
result
=
helper
.
getTrackedSelection
(
this
.
_selectionId
);
if
(
this
.
_moved
)
{
result
=
result
.
setStartPosition
(
result
.
startLineNumber
,
this
.
_cutStartIndex
);
...
...
src/vs/editor/contrib/colorPicker/color.ts
浏览文件 @
7b0a1cd3
...
...
@@ -6,14 +6,14 @@
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
ColorProviderRegistry
,
DocumentColorProvider
,
IColorInformation
,
IColorPresentation
}
from
'
vs/editor/common/modes
'
;
import
{
asWinJsPromise
}
from
'
vs/base/common/async
'
;
import
{
I
ReadOnly
Model
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IModel
}
from
'
vs/editor/common/editorCommon
'
;
export
interface
IColorData
{
colorInfo
:
IColorInformation
;
provider
:
DocumentColorProvider
;
}
export
function
getColors
(
model
:
I
ReadOnly
Model
):
TPromise
<
IColorData
[]
>
{
export
function
getColors
(
model
:
IModel
):
TPromise
<
IColorData
[]
>
{
const
colors
:
IColorData
[]
=
[];
const
providers
=
ColorProviderRegistry
.
ordered
(
model
).
reverse
();
const
promises
=
providers
.
map
(
provider
=>
asWinJsPromise
(
token
=>
provider
.
provideDocumentColors
(
model
,
token
)).
then
(
result
=>
{
...
...
@@ -27,6 +27,6 @@ export function getColors(model: IReadOnlyModel): TPromise<IColorData[]> {
return
TPromise
.
join
(
promises
).
then
(()
=>
colors
);
}
export
function
getColorPresentations
(
model
:
I
ReadOnly
Model
,
colorInfo
:
IColorInformation
,
provider
:
DocumentColorProvider
):
TPromise
<
IColorPresentation
[]
>
{
export
function
getColorPresentations
(
model
:
IModel
,
colorInfo
:
IColorInformation
,
provider
:
DocumentColorProvider
):
TPromise
<
IColorPresentation
[]
>
{
return
asWinJsPromise
(
token
=>
provider
.
provideColorPresentations
(
model
,
colorInfo
,
token
));
}
src/vs/editor/contrib/comment/blockCommentCommand.ts
浏览文件 @
7b0a1cd3
...
...
@@ -39,7 +39,7 @@ export class BlockCommentCommand implements editorCommon.ICommand {
return
true
;
}
private
_createOperationsForBlockComment
(
selection
:
Range
,
config
:
ICommentsConfiguration
,
model
:
editorCommon
.
I
Tokenized
Model
,
builder
:
editorCommon
.
IEditOperationBuilder
):
void
{
private
_createOperationsForBlockComment
(
selection
:
Range
,
config
:
ICommentsConfiguration
,
model
:
editorCommon
.
IModel
,
builder
:
editorCommon
.
IEditOperationBuilder
):
void
{
const
startLineNumber
=
selection
.
startLineNumber
;
const
startColumn
=
selection
.
startColumn
;
const
endLineNumber
=
selection
.
endLineNumber
;
...
...
@@ -153,7 +153,7 @@ export class BlockCommentCommand implements editorCommon.ICommand {
return
res
;
}
public
getEditOperations
(
model
:
editorCommon
.
I
Tokenized
Model
,
builder
:
editorCommon
.
IEditOperationBuilder
):
void
{
public
getEditOperations
(
model
:
editorCommon
.
IModel
,
builder
:
editorCommon
.
IEditOperationBuilder
):
void
{
const
startLineNumber
=
this
.
_selection
.
startLineNumber
;
const
startColumn
=
this
.
_selection
.
startColumn
;
...
...
@@ -170,7 +170,7 @@ export class BlockCommentCommand implements editorCommon.ICommand {
);
}
public
computeCursorState
(
model
:
editorCommon
.
I
Tokenized
Model
,
helper
:
editorCommon
.
ICursorStateComputerData
):
Selection
{
public
computeCursorState
(
model
:
editorCommon
.
IModel
,
helper
:
editorCommon
.
ICursorStateComputerData
):
Selection
{
const
inverseEditOperations
=
helper
.
getInverseEditOperations
();
if
(
inverseEditOperations
.
length
===
2
)
{
const
startTokenEditOperation
=
inverseEditOperations
[
0
];
...
...
src/vs/editor/contrib/comment/lineCommentCommand.ts
浏览文件 @
7b0a1cd3
...
...
@@ -62,7 +62,7 @@ export class LineCommentCommand implements editorCommon.ICommand {
* Do an initial pass over the lines and gather info about the line comment string.
* Returns null if any of the lines doesn't support a line comment string.
*/
public
static
_gatherPreflightCommentStrings
(
model
:
editorCommon
.
I
Tokenized
Model
,
startLineNumber
:
number
,
endLineNumber
:
number
):
ILinePreflightData
[]
{
public
static
_gatherPreflightCommentStrings
(
model
:
editorCommon
.
IModel
,
startLineNumber
:
number
,
endLineNumber
:
number
):
ILinePreflightData
[]
{
model
.
tokenizeIfCheap
(
startLineNumber
);
const
languageId
=
model
.
getLanguageIdAtPosition
(
startLineNumber
,
1
);
...
...
@@ -173,7 +173,7 @@ export class LineCommentCommand implements editorCommon.ICommand {
/**
* Analyze all lines and decide exactly what to do => not supported | insert line comments | remove line comments
*/
public
static
_gatherPreflightData
(
type
:
Type
,
model
:
editorCommon
.
I
Tokenized
Model
,
startLineNumber
:
number
,
endLineNumber
:
number
):
IPreflightData
{
public
static
_gatherPreflightData
(
type
:
Type
,
model
:
editorCommon
.
IModel
,
startLineNumber
:
number
,
endLineNumber
:
number
):
IPreflightData
{
var
lines
=
LineCommentCommand
.
_gatherPreflightCommentStrings
(
model
,
startLineNumber
,
endLineNumber
);
if
(
lines
===
null
)
{
return
{
...
...
@@ -215,7 +215,7 @@ export class LineCommentCommand implements editorCommon.ICommand {
this
.
_selectionId
=
builder
.
trackSelection
(
s
);
}
private
_attemptRemoveBlockComment
(
model
:
editorCommon
.
I
Tokenized
Model
,
s
:
Selection
,
startToken
:
string
,
endToken
:
string
):
editorCommon
.
IIdentifiedSingleEditOperation
[]
{
private
_attemptRemoveBlockComment
(
model
:
editorCommon
.
IModel
,
s
:
Selection
,
startToken
:
string
,
endToken
:
string
):
editorCommon
.
IIdentifiedSingleEditOperation
[]
{
let
startLineNumber
=
s
.
startLineNumber
;
let
endLineNumber
=
s
.
endLineNumber
;
...
...
@@ -268,7 +268,7 @@ export class LineCommentCommand implements editorCommon.ICommand {
/**
* Given an unsuccessful analysis, delegate to the block comment command
*/
private
_executeBlockComment
(
model
:
editorCommon
.
I
Tokenized
Model
,
builder
:
editorCommon
.
IEditOperationBuilder
,
s
:
Selection
):
void
{
private
_executeBlockComment
(
model
:
editorCommon
.
IModel
,
builder
:
editorCommon
.
IEditOperationBuilder
,
s
:
Selection
):
void
{
model
.
tokenizeIfCheap
(
s
.
startLineNumber
);
let
languageId
=
model
.
getLanguageIdAtPosition
(
s
.
startLineNumber
,
1
);
let
config
=
LanguageConfigurationRegistry
.
getComments
(
languageId
);
...
...
@@ -309,7 +309,7 @@ export class LineCommentCommand implements editorCommon.ICommand {
}
}
public
getEditOperations
(
model
:
editorCommon
.
I
Tokenized
Model
,
builder
:
editorCommon
.
IEditOperationBuilder
):
void
{
public
getEditOperations
(
model
:
editorCommon
.
IModel
,
builder
:
editorCommon
.
IEditOperationBuilder
):
void
{
var
s
=
this
.
_selection
;
this
.
_moveEndPositionDown
=
false
;
...
...
@@ -327,7 +327,7 @@ export class LineCommentCommand implements editorCommon.ICommand {
return
this
.
_executeBlockComment
(
model
,
builder
,
s
);
}
public
computeCursorState
(
model
:
editorCommon
.
I
Tokenized
Model
,
helper
:
editorCommon
.
ICursorStateComputerData
):
Selection
{
public
computeCursorState
(
model
:
editorCommon
.
IModel
,
helper
:
editorCommon
.
ICursorStateComputerData
):
Selection
{
var
result
=
helper
.
getTrackedSelection
(
this
.
_selectionId
);
if
(
this
.
_moveEndPositionDown
)
{
...
...
src/vs/editor/contrib/dnd/dragAndDropCommand.ts
浏览文件 @
7b0a1cd3
...
...
@@ -23,7 +23,7 @@ export class DragAndDropCommand implements editorCommon.ICommand {
this
.
copy
=
copy
;
}
public
getEditOperations
(
model
:
editorCommon
.
I
Tokenized
Model
,
builder
:
editorCommon
.
IEditOperationBuilder
):
void
{
public
getEditOperations
(
model
:
editorCommon
.
IModel
,
builder
:
editorCommon
.
IEditOperationBuilder
):
void
{
let
text
=
model
.
getValueInRange
(
this
.
selection
);
if
(
!
this
.
copy
)
{
builder
.
addEditOperation
(
this
.
selection
,
null
);
...
...
@@ -101,7 +101,7 @@ export class DragAndDropCommand implements editorCommon.ICommand {
}
}
public
computeCursorState
(
model
:
editorCommon
.
I
Tokenized
Model
,
helper
:
editorCommon
.
ICursorStateComputerData
):
Selection
{
public
computeCursorState
(
model
:
editorCommon
.
IModel
,
helper
:
editorCommon
.
ICursorStateComputerData
):
Selection
{
return
this
.
targetSelection
;
}
}
\ No newline at end of file
}
src/vs/editor/contrib/find/replaceAllCommand.ts
浏览文件 @
7b0a1cd3
...
...
@@ -26,7 +26,7 @@ export class ReplaceAllCommand implements editorCommon.ICommand {
this
.
_replaceStrings
=
replaceStrings
;
}
public
getEditOperations
(
model
:
editorCommon
.
I
Tokenized
Model
,
builder
:
editorCommon
.
IEditOperationBuilder
):
void
{
public
getEditOperations
(
model
:
editorCommon
.
IModel
,
builder
:
editorCommon
.
IEditOperationBuilder
):
void
{
if
(
this
.
_ranges
.
length
>
0
)
{
// Collect all edit operations
var
ops
:
IEditOperation
[]
=
[];
...
...
@@ -65,7 +65,7 @@ export class ReplaceAllCommand implements editorCommon.ICommand {
this
.
_trackedEditorSelectionId
=
builder
.
trackSelection
(
this
.
_editorSelection
);
}
public
computeCursorState
(
model
:
editorCommon
.
I
Tokenized
Model
,
helper
:
editorCommon
.
ICursorStateComputerData
):
Selection
{
public
computeCursorState
(
model
:
editorCommon
.
IModel
,
helper
:
editorCommon
.
ICursorStateComputerData
):
Selection
{
return
helper
.
getTrackedSelection
(
this
.
_trackedEditorSelectionId
);
}
}
src/vs/editor/contrib/folding/indentRangeProvider.ts
浏览文件 @
7b0a1cd3
...
...
@@ -5,7 +5,7 @@
'
use strict
'
;
import
{
I
Text
Model
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
FoldingMarkers
}
from
'
vs/editor/common/modes/languageConfiguration
'
;
import
{
computeIndentLevel
}
from
'
vs/editor/common/model/modelLine
'
;
import
{
FoldingRanges
,
MAX_LINE_NUMBER
}
from
'
vs/editor/contrib/folding/foldingRanges
'
;
...
...
@@ -41,7 +41,7 @@ export class RangesCollector {
}
}
public
toIndentRanges
(
model
:
I
Text
Model
)
{
public
toIndentRanges
(
model
:
IModel
)
{
if
(
this
.
_length
<=
this
.
_FoldingRangesLimit
)
{
// reverse and create arrays of the exact length
let
startIndexes
=
new
Uint32Array
(
this
.
_length
);
...
...
@@ -87,7 +87,7 @@ export class RangesCollector {
interface
PreviousRegion
{
indent
:
number
;
line
:
number
;
marker
:
boolean
;
}
export
function
computeRanges
(
model
:
I
Text
Model
,
offSide
:
boolean
,
markers
?:
FoldingMarkers
,
FoldingRangesLimit
=
MAX_FOLDING_REGIONS_FOR_INDENT_LIMIT
):
FoldingRanges
{
export
function
computeRanges
(
model
:
IModel
,
offSide
:
boolean
,
markers
?:
FoldingMarkers
,
FoldingRangesLimit
=
MAX_FOLDING_REGIONS_FOR_INDENT_LIMIT
):
FoldingRanges
{
const
tabSize
=
model
.
getOptions
().
tabSize
;
let
result
=
new
RangesCollector
(
FoldingRangesLimit
);
...
...
src/vs/editor/contrib/format/format.ts
浏览文件 @
7b0a1cd3
...
...
@@ -10,7 +10,7 @@ import URI from 'vs/base/common/uri';
import
{
isFalsyOrEmpty
}
from
'
vs/base/common/arrays
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
I
ReadOnly
Model
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
registerDefaultLanguageCommand
,
registerLanguageCommand
}
from
'
vs/editor/browser/editorExtensions
'
;
import
{
DocumentFormattingEditProviderRegistry
,
DocumentRangeFormattingEditProviderRegistry
,
OnTypeFormattingEditProviderRegistry
,
FormattingOptions
,
TextEdit
}
from
'
vs/editor/common/modes
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
...
...
@@ -28,7 +28,7 @@ export class NoProviderError extends Error {
}
}
export
function
getDocumentRangeFormattingEdits
(
model
:
I
ReadOnly
Model
,
range
:
Range
,
options
:
FormattingOptions
):
TPromise
<
TextEdit
[],
NoProviderError
>
{
export
function
getDocumentRangeFormattingEdits
(
model
:
IModel
,
range
:
Range
,
options
:
FormattingOptions
):
TPromise
<
TextEdit
[],
NoProviderError
>
{
const
providers
=
DocumentRangeFormattingEditProviderRegistry
.
ordered
(
model
);
...
...
@@ -49,7 +49,7 @@ export function getDocumentRangeFormattingEdits(model: IReadOnlyModel, range: Ra
})).
then
(()
=>
result
);
}
export
function
getDocumentFormattingEdits
(
model
:
I
ReadOnly
Model
,
options
:
FormattingOptions
):
TPromise
<
TextEdit
[]
>
{
export
function
getDocumentFormattingEdits
(
model
:
IModel
,
options
:
FormattingOptions
):
TPromise
<
TextEdit
[]
>
{
const
providers
=
DocumentFormattingEditProviderRegistry
.
ordered
(
model
);
// try range formatters when no document formatter is registered
...
...
@@ -70,7 +70,7 @@ export function getDocumentFormattingEdits(model: IReadOnlyModel, options: Forma
})).
then
(()
=>
result
);
}
export
function
getOnTypeFormattingEdits
(
model
:
I
ReadOnly
Model
,
position
:
Position
,
ch
:
string
,
options
:
FormattingOptions
):
TPromise
<
TextEdit
[]
>
{
export
function
getOnTypeFormattingEdits
(
model
:
IModel
,
position
:
Position
,
ch
:
string
,
options
:
FormattingOptions
):
TPromise
<
TextEdit
[]
>
{
const
[
support
]
=
OnTypeFormattingEditProviderRegistry
.
ordered
(
model
);
if
(
!
support
)
{
return
TPromise
.
as
(
undefined
);
...
...
src/vs/editor/contrib/format/formatCommand.ts
浏览文件 @
7b0a1cd3
...
...
@@ -44,7 +44,7 @@ export class EditOperationsCommand implements editorCommon.ICommand {
}
}
public
getEditOperations
(
model
:
editorCommon
.
I
Tokenized
Model
,
builder
:
editorCommon
.
IEditOperationBuilder
):
void
{
public
getEditOperations
(
model
:
editorCommon
.
IModel
,
builder
:
editorCommon
.
IEditOperationBuilder
):
void
{
for
(
let
edit
of
this
.
_edits
)
{
// We know that this edit.range comes from the mirror model, so it should only contain \n and no \r's
...
...
@@ -72,11 +72,11 @@ export class EditOperationsCommand implements editorCommon.ICommand {
}
}
public
computeCursorState
(
model
:
editorCommon
.
I
Tokenized
Model
,
helper
:
editorCommon
.
ICursorStateComputerData
):
Selection
{
public
computeCursorState
(
model
:
editorCommon
.
IModel
,
helper
:
editorCommon
.
ICursorStateComputerData
):
Selection
{
return
helper
.
getTrackedSelection
(
this
.
_selectionId
);
}
static
fixLineTerminators
(
edit
:
editorCommon
.
ISingleEditOperation
,
model
:
editorCommon
.
I
Tokenized
Model
):
void
{
static
fixLineTerminators
(
edit
:
editorCommon
.
ISingleEditOperation
,
model
:
editorCommon
.
IModel
):
void
{
edit
.
text
=
edit
.
text
.
replace
(
/
\r\n
|
\r
|
\n
/g
,
model
.
getEOL
());
}
...
...
@@ -88,14 +88,14 @@ export class EditOperationsCommand implements editorCommon.ICommand {
* bug #15108. There the cursor was jumping since the tracked selection was in the middle of the range edit
* and was lost.
*/
static
trimEdit
(
edit
:
editorCommon
.
ISingleEditOperation
,
model
:
editorCommon
.
I
Tokenized
Model
):
editorCommon
.
ISingleEditOperation
{
static
trimEdit
(
edit
:
editorCommon
.
ISingleEditOperation
,
model
:
editorCommon
.
IModel
):
editorCommon
.
ISingleEditOperation
{
this
.
fixLineTerminators
(
edit
,
model
);
return
this
.
_trimEdit
(
model
.
validateRange
(
edit
.
range
),
edit
.
text
,
edit
.
forceMoveMarkers
,
model
);
}
static
_trimEdit
(
editRange
:
Range
,
editText
:
string
,
editForceMoveMarkers
:
boolean
,
model
:
editorCommon
.
I
Tokenized
Model
):
editorCommon
.
ISingleEditOperation
{
static
_trimEdit
(
editRange
:
Range
,
editText
:
string
,
editForceMoveMarkers
:
boolean
,
model
:
editorCommon
.
IModel
):
editorCommon
.
ISingleEditOperation
{
let
currentText
=
model
.
getValueInRange
(
editRange
);
...
...
src/vs/editor/contrib/goToDeclaration/goToDeclaration.ts
浏览文件 @
7b0a1cd3
...
...
@@ -7,7 +7,7 @@
import
{
onUnexpectedExternalError
}
from
'
vs/base/common/errors
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
I
ReadOnly
Model
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
registerDefaultLanguageCommand
}
from
'
vs/editor/browser/editorExtensions
'
;
import
LanguageFeatureRegistry
from
'
vs/editor/common/modes/languageFeatureRegistry
'
;
import
{
DefinitionProviderRegistry
,
ImplementationProviderRegistry
,
TypeDefinitionProviderRegistry
,
Location
}
from
'
vs/editor/common/modes
'
;
...
...
@@ -30,10 +30,10 @@ function outputResults(promises: TPromise<Location | Location[]>[]) {
}
function
getDefinitions
<
T
>
(
model
:
I
ReadOnly
Model
,
model
:
IModel
,
position
:
Position
,
registry
:
LanguageFeatureRegistry
<
T
>
,
provide
:
(
provider
:
T
,
model
:
I
ReadOnly
Model
,
position
:
Position
,
token
:
CancellationToken
)
=>
Location
|
Location
[]
|
Thenable
<
Location
|
Location
[]
>
provide
:
(
provider
:
T
,
model
:
IModel
,
position
:
Position
,
token
:
CancellationToken
)
=>
Location
|
Location
[]
|
Thenable
<
Location
|
Location
[]
>
):
TPromise
<
Location
[]
>
{
const
provider
=
registry
.
ordered
(
model
);
...
...
@@ -50,19 +50,19 @@ function getDefinitions<T>(
}
export
function
getDefinitionsAtPosition
(
model
:
I
ReadOnly
Model
,
position
:
Position
):
TPromise
<
Location
[]
>
{
export
function
getDefinitionsAtPosition
(
model
:
IModel
,
position
:
Position
):
TPromise
<
Location
[]
>
{
return
getDefinitions
(
model
,
position
,
DefinitionProviderRegistry
,
(
provider
,
model
,
position
,
token
)
=>
{
return
provider
.
provideDefinition
(
model
,
position
,
token
);
});
}
export
function
getImplementationsAtPosition
(
model
:
I
ReadOnly
Model
,
position
:
Position
):
TPromise
<
Location
[]
>
{
export
function
getImplementationsAtPosition
(
model
:
IModel
,
position
:
Position
):
TPromise
<
Location
[]
>
{
return
getDefinitions
(
model
,
position
,
ImplementationProviderRegistry
,
(
provider
,
model
,
position
,
token
)
=>
{
return
provider
.
provideImplementation
(
model
,
position
,
token
);
});
}
export
function
getTypeDefinitionsAtPosition
(
model
:
I
ReadOnly
Model
,
position
:
Position
):
TPromise
<
Location
[]
>
{
export
function
getTypeDefinitionsAtPosition
(
model
:
IModel
,
position
:
Position
):
TPromise
<
Location
[]
>
{
return
getDefinitions
(
model
,
position
,
TypeDefinitionProviderRegistry
,
(
provider
,
model
,
position
,
token
)
=>
{
return
provider
.
provideTypeDefinition
(
model
,
position
,
token
);
});
...
...
src/vs/editor/contrib/hover/getHover.ts
浏览文件 @
7b0a1cd3
...
...
@@ -8,13 +8,13 @@
import
{
coalesce
}
from
'
vs/base/common/arrays
'
;
import
{
onUnexpectedExternalError
}
from
'
vs/base/common/errors
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
I
ReadOnly
Model
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
registerDefaultLanguageCommand
}
from
'
vs/editor/browser/editorExtensions
'
;
import
{
Hover
,
HoverProviderRegistry
}
from
'
vs/editor/common/modes
'
;
import
{
asWinJsPromise
}
from
'
vs/base/common/async
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
export
function
getHover
(
model
:
I
ReadOnly
Model
,
position
:
Position
):
TPromise
<
Hover
[]
>
{
export
function
getHover
(
model
:
IModel
,
position
:
Position
):
TPromise
<
Hover
[]
>
{
const
supports
=
HoverProviderRegistry
.
ordered
(
model
);
const
values
:
Hover
[]
=
[];
...
...
src/vs/editor/contrib/inPlaceReplace/inPlaceReplaceCommand.ts
浏览文件 @
7b0a1cd3
...
...
@@ -20,11 +20,11 @@ export class InPlaceReplaceCommand implements editorCommon.ICommand {
this
.
_text
=
text
;
}
public
getEditOperations
(
model
:
editorCommon
.
I
Tokenized
Model
,
builder
:
editorCommon
.
IEditOperationBuilder
):
void
{
public
getEditOperations
(
model
:
editorCommon
.
IModel
,
builder
:
editorCommon
.
IEditOperationBuilder
):
void
{
builder
.
addTrackedEditOperation
(
this
.
_editRange
,
this
.
_text
);
}
public
computeCursorState
(
model
:
editorCommon
.
I
Tokenized
Model
,
helper
:
editorCommon
.
ICursorStateComputerData
):
Selection
{
public
computeCursorState
(
model
:
editorCommon
.
IModel
,
helper
:
editorCommon
.
ICursorStateComputerData
):
Selection
{
var
inverseEditOperations
=
helper
.
getInverseEditOperations
();
var
srcRange
=
inverseEditOperations
[
0
].
range
;
...
...
src/vs/editor/contrib/indentation/indentation.ts
浏览文件 @
7b0a1cd3
...
...
@@ -7,7 +7,7 @@ import * as nls from 'vs/nls';
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
*
as
strings
from
'
vs/base/common/strings
'
;
import
{
IEditorContribution
,
IIdentifiedSingleEditOperation
,
ICommand
,
ICursorStateComputerData
,
IEditOperationBuilder
,
I
Tokenized
Model
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IEditorContribution
,
IIdentifiedSingleEditOperation
,
ICommand
,
ICursorStateComputerData
,
IEditOperationBuilder
,
IModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
EditorContextKeys
}
from
'
vs/editor/common/editorContextKeys
'
;
import
{
registerEditorAction
,
ServicesAccessor
,
IActionOptions
,
EditorAction
,
registerEditorContribution
}
from
'
vs/editor/browser/editorExtensions
'
;
import
{
IQuickOpenService
}
from
'
vs/platform/quickOpen/common/quickOpen
'
;
...
...
@@ -45,7 +45,7 @@ export function unshiftIndent(tabSize: number, indentation: string, count?: numb
return
newIndentation
;
}
export
function
getReindentEditOperations
(
model
:
I
Tokenized
Model
,
startLineNumber
:
number
,
endLineNumber
:
number
,
inheritedIndent
?:
string
):
IIdentifiedSingleEditOperation
[]
{
export
function
getReindentEditOperations
(
model
:
IModel
,
startLineNumber
:
number
,
endLineNumber
:
number
,
inheritedIndent
?:
string
):
IIdentifiedSingleEditOperation
[]
{
if
(
model
.
getLineCount
()
===
1
&&
model
.
getLineMaxColumn
(
1
)
===
1
)
{
// Model is empty
return
undefined
;
...
...
@@ -344,7 +344,7 @@ export class AutoIndentOnPasteCommand implements ICommand {
}
}
public
getEditOperations
(
model
:
I
Tokenized
Model
,
builder
:
IEditOperationBuilder
):
void
{
public
getEditOperations
(
model
:
IModel
,
builder
:
IEditOperationBuilder
):
void
{
for
(
let
edit
of
this
.
_edits
)
{
builder
.
addEditOperation
(
Range
.
lift
(
edit
.
range
),
edit
.
text
);
}
...
...
@@ -367,7 +367,7 @@ export class AutoIndentOnPasteCommand implements ICommand {
}
}
public
computeCursorState
(
model
:
I
Tokenized
Model
,
helper
:
ICursorStateComputerData
):
Selection
{
public
computeCursorState
(
model
:
IModel
,
helper
:
ICursorStateComputerData
):
Selection
{
return
helper
.
getTrackedSelection
(
this
.
_selectionId
);
}
}
...
...
@@ -547,7 +547,7 @@ export class AutoIndentOnPaste implements IEditorContribution {
this
.
editor
.
pushUndoStop
();
}
private
shouldIgnoreLine
(
model
:
I
Tokenized
Model
,
lineNumber
:
number
):
boolean
{
private
shouldIgnoreLine
(
model
:
IModel
,
lineNumber
:
number
):
boolean
{
model
.
forceTokenization
(
lineNumber
);
let
nonWhiteSpaceColumn
=
model
.
getLineFirstNonWhitespaceColumn
(
lineNumber
);
if
(
nonWhiteSpaceColumn
===
0
)
{
...
...
@@ -574,7 +574,7 @@ export class AutoIndentOnPaste implements IEditorContribution {
}
}
function
getIndentationEditOperations
(
model
:
I
Tokenized
Model
,
builder
:
IEditOperationBuilder
,
tabSize
:
number
,
tabsToSpaces
:
boolean
):
void
{
function
getIndentationEditOperations
(
model
:
IModel
,
builder
:
IEditOperationBuilder
,
tabSize
:
number
,
tabsToSpaces
:
boolean
):
void
{
if
(
model
.
getLineCount
()
===
1
&&
model
.
getLineMaxColumn
(
1
)
===
1
)
{
// Model is empty
return
;
...
...
@@ -606,12 +606,12 @@ export class IndentationToSpacesCommand implements ICommand {
constructor
(
private
selection
:
Selection
,
private
tabSize
:
number
)
{
}
public
getEditOperations
(
model
:
I
Tokenized
Model
,
builder
:
IEditOperationBuilder
):
void
{
public
getEditOperations
(
model
:
IModel
,
builder
:
IEditOperationBuilder
):
void
{
this
.
selectionId
=
builder
.
trackSelection
(
this
.
selection
);
getIndentationEditOperations
(
model
,
builder
,
this
.
tabSize
,
true
);
}
public
computeCursorState
(
model
:
I
Tokenized
Model
,
helper
:
ICursorStateComputerData
):
Selection
{
public
computeCursorState
(
model
:
IModel
,
helper
:
ICursorStateComputerData
):
Selection
{
return
helper
.
getTrackedSelection
(
this
.
selectionId
);
}
}
...
...
@@ -622,12 +622,12 @@ export class IndentationToTabsCommand implements ICommand {
constructor
(
private
selection
:
Selection
,
private
tabSize
:
number
)
{
}
public
getEditOperations
(
model
:
I
Tokenized
Model
,
builder
:
IEditOperationBuilder
):
void
{
public
getEditOperations
(
model
:
IModel
,
builder
:
IEditOperationBuilder
):
void
{
this
.
selectionId
=
builder
.
trackSelection
(
this
.
selection
);
getIndentationEditOperations
(
model
,
builder
,
this
.
tabSize
,
false
);
}
public
computeCursorState
(
model
:
I
Tokenized
Model
,
helper
:
ICursorStateComputerData
):
Selection
{
public
computeCursorState
(
model
:
IModel
,
helper
:
ICursorStateComputerData
):
Selection
{
return
helper
.
getTrackedSelection
(
this
.
selectionId
);
}
}
...
...
src/vs/editor/contrib/linesOperations/copyLinesCommand.ts
浏览文件 @
7b0a1cd3
...
...
@@ -23,7 +23,7 @@ export class CopyLinesCommand implements editorCommon.ICommand {
this
.
_isCopyingDown
=
isCopyingDown
;
}
public
getEditOperations
(
model
:
editorCommon
.
I
Tokenized
Model
,
builder
:
editorCommon
.
IEditOperationBuilder
):
void
{
public
getEditOperations
(
model
:
editorCommon
.
IModel
,
builder
:
editorCommon
.
IEditOperationBuilder
):
void
{
var
s
=
this
.
_selection
;
this
.
_startLineNumberDelta
=
0
;
...
...
@@ -57,7 +57,7 @@ export class CopyLinesCommand implements editorCommon.ICommand {
this
.
_selectionDirection
=
this
.
_selection
.
getDirection
();
}
public
computeCursorState
(
model
:
editorCommon
.
I
Tokenized
Model
,
helper
:
editorCommon
.
ICursorStateComputerData
):
Selection
{
public
computeCursorState
(
model
:
editorCommon
.
IModel
,
helper
:
editorCommon
.
ICursorStateComputerData
):
Selection
{
var
result
=
helper
.
getTrackedSelection
(
this
.
_selectionId
);
if
(
this
.
_startLineNumberDelta
!==
0
||
this
.
_endLineNumberDelta
!==
0
)
{
...
...
src/vs/editor/contrib/linesOperations/deleteLinesCommand.ts
浏览文件 @
7b0a1cd3
...
...
@@ -6,7 +6,7 @@
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
Selection
}
from
'
vs/editor/common/core/selection
'
;
import
{
ICommand
,
ICursorStateComputerData
,
IEditOperationBuilder
,
I
Tokenized
Model
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ICommand
,
ICursorStateComputerData
,
IEditOperationBuilder
,
IModel
}
from
'
vs/editor/common/editorCommon
'
;
export
class
DeleteLinesCommand
implements
ICommand
{
...
...
@@ -20,7 +20,7 @@ export class DeleteLinesCommand implements ICommand {
this
.
restoreCursorToColumn
=
restoreCursorToColumn
;
}
public
getEditOperations
(
model
:
I
Tokenized
Model
,
builder
:
IEditOperationBuilder
):
void
{
public
getEditOperations
(
model
:
IModel
,
builder
:
IEditOperationBuilder
):
void
{
if
(
model
.
getLineCount
()
===
1
&&
model
.
getLineMaxColumn
(
1
)
===
1
)
{
// Model is empty
return
;
...
...
@@ -42,7 +42,7 @@ export class DeleteLinesCommand implements ICommand {
builder
.
addTrackedEditOperation
(
new
Range
(
startLineNumber
,
startColumn
,
endLineNumber
,
endColumn
),
null
);
}
public
computeCursorState
(
model
:
I
Tokenized
Model
,
helper
:
ICursorStateComputerData
):
Selection
{
public
computeCursorState
(
model
:
IModel
,
helper
:
ICursorStateComputerData
):
Selection
{
var
inverseEditOperations
=
helper
.
getInverseEditOperations
();
var
srcRange
=
inverseEditOperations
[
0
].
range
;
return
new
Selection
(
...
...
src/vs/editor/contrib/linesOperations/moveLinesCommand.ts
浏览文件 @
7b0a1cd3
...
...
@@ -7,7 +7,7 @@
import
*
as
strings
from
'
vs/base/common/strings
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
Selection
}
from
'
vs/editor/common/core/selection
'
;
import
{
ICommand
,
ICursorStateComputerData
,
IEditOperationBuilder
,
I
Tokenized
Model
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ICommand
,
ICursorStateComputerData
,
IEditOperationBuilder
,
IModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
LanguageConfigurationRegistry
,
IIndentConverter
}
from
'
vs/editor/common/modes/languageConfigurationRegistry
'
;
import
{
ShiftCommand
}
from
'
vs/editor/common/commands/shiftCommand
'
;
import
*
as
IndentUtil
from
'
vs/editor/contrib/indentation/indentUtils
'
;
...
...
@@ -31,7 +31,7 @@ export class MoveLinesCommand implements ICommand {
this
.
_moveEndLineSelectionShrink
=
false
;
}
public
getEditOperations
(
model
:
I
Tokenized
Model
,
builder
:
IEditOperationBuilder
):
void
{
public
getEditOperations
(
model
:
IModel
,
builder
:
IEditOperationBuilder
):
void
{
var
modelLineCount
=
model
.
getLineCount
();
...
...
@@ -238,7 +238,7 @@ export class MoveLinesCommand implements ICommand {
};
}
private
matchEnterRule
(
model
:
I
Tokenized
Model
,
indentConverter
:
IIndentConverter
,
tabSize
:
number
,
line
:
number
,
oneLineAbove
:
number
,
oneLineAboveText
?:
string
)
{
private
matchEnterRule
(
model
:
IModel
,
indentConverter
:
IIndentConverter
,
tabSize
:
number
,
line
:
number
,
oneLineAbove
:
number
,
oneLineAboveText
?:
string
)
{
let
validPrecedingLine
=
oneLineAbove
;
while
(
validPrecedingLine
>=
1
)
{
// ship empty lines as empty lines just inherit indentation
...
...
@@ -297,7 +297,7 @@ export class MoveLinesCommand implements ICommand {
return
str
.
replace
(
/^
\s
+/
,
''
);
}
private
shouldAutoIndent
(
model
:
I
Tokenized
Model
,
selection
:
Selection
)
{
private
shouldAutoIndent
(
model
:
IModel
,
selection
:
Selection
)
{
if
(
!
this
.
_autoIndent
)
{
return
false
;
}
...
...
@@ -319,7 +319,7 @@ export class MoveLinesCommand implements ICommand {
return
true
;
}
private
getIndentEditsOfMovingBlock
(
model
:
I
Tokenized
Model
,
builder
:
IEditOperationBuilder
,
s
:
Selection
,
tabSize
:
number
,
insertSpaces
:
boolean
,
offset
:
number
)
{
private
getIndentEditsOfMovingBlock
(
model
:
IModel
,
builder
:
IEditOperationBuilder
,
s
:
Selection
,
tabSize
:
number
,
insertSpaces
:
boolean
,
offset
:
number
)
{
for
(
let
i
=
s
.
startLineNumber
;
i
<=
s
.
endLineNumber
;
i
++
)
{
let
lineContent
=
model
.
getLineContent
(
i
);
let
originalIndent
=
strings
.
getLeadingWhitespace
(
lineContent
);
...
...
@@ -340,7 +340,7 @@ export class MoveLinesCommand implements ICommand {
}
}
public
computeCursorState
(
model
:
I
Tokenized
Model
,
helper
:
ICursorStateComputerData
):
Selection
{
public
computeCursorState
(
model
:
IModel
,
helper
:
ICursorStateComputerData
):
Selection
{
var
result
=
helper
.
getTrackedSelection
(
this
.
_selectionId
);
if
(
this
.
_moveEndPositionDown
)
{
...
...
src/vs/editor/contrib/linesOperations/sortLinesCommand.ts
浏览文件 @
7b0a1cd3
...
...
@@ -20,7 +20,7 @@ export class SortLinesCommand implements editorCommon.ICommand {
this
.
descending
=
descending
;
}
public
getEditOperations
(
model
:
editorCommon
.
I
Tokenized
Model
,
builder
:
editorCommon
.
IEditOperationBuilder
):
void
{
public
getEditOperations
(
model
:
editorCommon
.
IModel
,
builder
:
editorCommon
.
IEditOperationBuilder
):
void
{
let
op
=
sortLines
(
model
,
this
.
selection
,
this
.
descending
);
if
(
op
)
{
builder
.
addEditOperation
(
op
.
range
,
op
.
text
);
...
...
@@ -29,11 +29,11 @@ export class SortLinesCommand implements editorCommon.ICommand {
this
.
selectionId
=
builder
.
trackSelection
(
this
.
selection
);
}
public
computeCursorState
(
model
:
editorCommon
.
I
Tokenized
Model
,
helper
:
editorCommon
.
ICursorStateComputerData
):
Selection
{
public
computeCursorState
(
model
:
editorCommon
.
IModel
,
helper
:
editorCommon
.
ICursorStateComputerData
):
Selection
{
return
helper
.
getTrackedSelection
(
this
.
selectionId
);
}
public
static
canRun
(
model
:
editorCommon
.
I
Text
Model
,
selection
:
Selection
,
descending
:
boolean
):
boolean
{
public
static
canRun
(
model
:
editorCommon
.
IModel
,
selection
:
Selection
,
descending
:
boolean
):
boolean
{
let
data
=
getSortData
(
model
,
selection
,
descending
);
if
(
!
data
)
{
...
...
@@ -50,7 +50,7 @@ export class SortLinesCommand implements editorCommon.ICommand {
}
}
function
getSortData
(
model
:
editorCommon
.
I
Text
Model
,
selection
:
Selection
,
descending
:
boolean
)
{
function
getSortData
(
model
:
editorCommon
.
IModel
,
selection
:
Selection
,
descending
:
boolean
)
{
let
startLineNumber
=
selection
.
startLineNumber
;
let
endLineNumber
=
selection
.
endLineNumber
;
...
...
@@ -91,7 +91,7 @@ function getSortData(model: editorCommon.ITextModel, selection: Selection, desce
/**
* Generate commands for sorting lines on a model.
*/
function
sortLines
(
model
:
editorCommon
.
I
Text
Model
,
selection
:
Selection
,
descending
:
boolean
):
editorCommon
.
IIdentifiedSingleEditOperation
{
function
sortLines
(
model
:
editorCommon
.
IModel
,
selection
:
Selection
,
descending
:
boolean
):
editorCommon
.
IIdentifiedSingleEditOperation
{
let
data
=
getSortData
(
model
,
selection
,
descending
);
if
(
!
data
)
{
...
...
src/vs/editor/contrib/links/getLinks.ts
浏览文件 @
7b0a1cd3
...
...
@@ -9,7 +9,7 @@ import { onUnexpectedExternalError } from 'vs/base/common/errors';
import
URI
from
'
vs/base/common/uri
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
Range
,
IRange
}
from
'
vs/editor/common/core/range
'
;
import
{
I
ReadOnly
Model
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ILink
,
LinkProvider
,
LinkProviderRegistry
}
from
'
vs/editor/common/modes
'
;
import
{
asWinJsPromise
}
from
'
vs/base/common/async
'
;
import
{
CommandsRegistry
}
from
'
vs/platform/commands/common/commands
'
;
...
...
@@ -65,7 +65,7 @@ export class Link implements ILink {
}
}
export
function
getLinks
(
model
:
I
ReadOnly
Model
):
TPromise
<
Link
[]
>
{
export
function
getLinks
(
model
:
IModel
):
TPromise
<
Link
[]
>
{
let
links
:
Link
[]
=
[];
...
...
src/vs/editor/contrib/parameterHints/provideSignatureHelp.ts
浏览文件 @
7b0a1cd3
...
...
@@ -7,7 +7,7 @@
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
onUnexpectedExternalError
}
from
'
vs/base/common/errors
'
;
import
{
I
ReadOnly
Model
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
registerDefaultLanguageCommand
}
from
'
vs/editor/browser/editorExtensions
'
;
import
{
SignatureHelp
,
SignatureHelpProviderRegistry
}
from
'
vs/editor/common/modes
'
;
import
{
asWinJsPromise
,
sequence
}
from
'
vs/base/common/async
'
;
...
...
@@ -19,7 +19,7 @@ export const Context = {
MultipleSignatures
:
new
RawContextKey
<
boolean
>
(
'
parameterHintsMultipleSignatures
'
,
false
),
};
export
function
provideSignatureHelp
(
model
:
I
ReadOnly
Model
,
position
:
Position
):
TPromise
<
SignatureHelp
>
{
export
function
provideSignatureHelp
(
model
:
IModel
,
position
:
Position
):
TPromise
<
SignatureHelp
>
{
const
supports
=
SignatureHelpProviderRegistry
.
ordered
(
model
);
let
result
:
SignatureHelp
;
...
...
src/vs/editor/contrib/quickFix/quickFix.ts
浏览文件 @
7b0a1cd3
...
...
@@ -5,7 +5,7 @@
'
use strict
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
I
ReadOnly
Model
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
CodeActionProviderRegistry
,
CodeAction
}
from
'
vs/editor/common/modes
'
;
import
{
asWinJsPromise
}
from
'
vs/base/common/async
'
;
...
...
@@ -15,7 +15,7 @@ import { IModelService } from 'vs/editor/common/services/modelService';
import
{
registerLanguageCommand
}
from
'
vs/editor/browser/editorExtensions
'
;
import
{
isFalsyOrEmpty
}
from
'
vs/base/common/arrays
'
;
export
function
getCodeActions
(
model
:
I
ReadOnly
Model
,
range
:
Range
):
TPromise
<
CodeAction
[]
>
{
export
function
getCodeActions
(
model
:
IModel
,
range
:
Range
):
TPromise
<
CodeAction
[]
>
{
const
allResults
:
CodeAction
[]
=
[];
const
promises
=
CodeActionProviderRegistry
.
all
(
model
).
map
(
support
=>
{
...
...
src/vs/editor/contrib/referenceSearch/referenceSearch.ts
浏览文件 @
7b0a1cd3
...
...
@@ -197,7 +197,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
});
export
function
provideReferences
(
model
:
editorCommon
.
I
ReadOnly
Model
,
position
:
Position
):
TPromise
<
Location
[]
>
{
export
function
provideReferences
(
model
:
editorCommon
.
IModel
,
position
:
Position
):
TPromise
<
Location
[]
>
{
// collect references from all providers
const
promises
=
ReferenceProviderRegistry
.
ordered
(
model
).
map
(
provider
=>
{
...
...
src/vs/editor/contrib/rename/rename.ts
浏览文件 @
7b0a1cd3
...
...
@@ -15,7 +15,7 @@ import { RawContextKey, IContextKey, IContextKeyService, ContextKeyExpr } from '
import
{
IMessageService
}
from
'
vs/platform/message/common/message
'
;
import
{
IProgressService
}
from
'
vs/platform/progress/common/progress
'
;
import
{
registerEditorAction
,
registerEditorContribution
,
ServicesAccessor
,
EditorAction
,
EditorCommand
,
registerEditorCommand
,
registerDefaultLanguageCommand
}
from
'
vs/editor/browser/editorExtensions
'
;
import
{
IEditorContribution
,
I
ReadOnly
Model
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IEditorContribution
,
IModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
EditorContextKeys
}
from
'
vs/editor/common/editorContextKeys
'
;
import
{
createBulkEdit
}
from
'
vs/editor/browser/services/bulkEdit
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
...
...
@@ -33,7 +33,7 @@ import { EditorState, CodeEditorStateFlag } from 'vs/editor/browser/core/editorS
import
{
KeybindingsRegistry
}
from
'
vs/platform/keybinding/common/keybindingsRegistry
'
;
export
function
rename
(
model
:
I
ReadOnly
Model
,
position
:
Position
,
newName
:
string
):
TPromise
<
WorkspaceEdit
>
{
export
function
rename
(
model
:
IModel
,
position
:
Position
,
newName
:
string
):
TPromise
<
WorkspaceEdit
>
{
const
supports
=
RenameProviderRegistry
.
ordered
(
model
);
const
rejects
:
string
[]
=
[];
...
...
src/vs/editor/contrib/wordHighlighter/wordHighlighter.ts
浏览文件 @
7b0a1cd3
...
...
@@ -34,7 +34,7 @@ export const overviewRulerWordHighlightStrongForeground = registerColor('editorO
export
const
ctxHasWordHighlights
=
new
RawContextKey
<
boolean
>
(
'
hasWordHighlights
'
,
false
);
export
function
getOccurrencesAtPosition
(
model
:
editorCommon
.
I
ReadOnly
Model
,
position
:
Position
):
TPromise
<
DocumentHighlight
[]
>
{
export
function
getOccurrencesAtPosition
(
model
:
editorCommon
.
IModel
,
position
:
Position
):
TPromise
<
DocumentHighlight
[]
>
{
const
orderedByScore
=
DocumentHighlightProviderRegistry
.
ordered
(
model
);
let
foundResult
=
false
;
...
...
src/vs/editor/standalone/browser/standaloneLanguages.ts
浏览文件 @
7b0a1cd3
...
...
@@ -263,7 +263,7 @@ export function registerSignatureHelpProvider(languageId: string, provider: mode
*/
export
function
registerHoverProvider
(
languageId
:
string
,
provider
:
modes
.
HoverProvider
):
IDisposable
{
return
modes
.
HoverProviderRegistry
.
register
(
languageId
,
{
provideHover
:
(
model
:
editorCommon
.
I
ReadOnly
Model
,
position
:
Position
,
token
:
CancellationToken
):
Thenable
<
modes
.
Hover
>
=>
{
provideHover
:
(
model
:
editorCommon
.
IModel
,
position
:
Position
,
token
:
CancellationToken
):
Thenable
<
modes
.
Hover
>
=>
{
let
word
=
model
.
getWordAtPosition
(
position
);
return
toThenable
<
modes
.
Hover
>
(
provider
.
provideHover
(
model
,
position
,
token
)).
then
((
value
)
=>
{
...
...
@@ -329,7 +329,7 @@ export function registerCodeLensProvider(languageId: string, provider: modes.Cod
*/
export
function
registerCodeActionProvider
(
languageId
:
string
,
provider
:
CodeActionProvider
):
IDisposable
{
return
modes
.
CodeActionProviderRegistry
.
register
(
languageId
,
{
provideCodeActions
:
(
model
:
editorCommon
.
I
ReadOnly
Model
,
range
:
Range
,
token
:
CancellationToken
):
(
modes
.
Command
|
modes
.
CodeAction
)[]
|
Thenable
<
(
modes
.
Command
|
modes
.
CodeAction
)[]
>
=>
{
provideCodeActions
:
(
model
:
editorCommon
.
IModel
,
range
:
Range
,
token
:
CancellationToken
):
(
modes
.
Command
|
modes
.
CodeAction
)[]
|
Thenable
<
(
modes
.
Command
|
modes
.
CodeAction
)[]
>
=>
{
let
markers
=
StaticServices
.
markerService
.
get
().
read
({
resource
:
model
.
uri
}).
filter
(
m
=>
{
return
Range
.
areIntersectingOrTouching
(
m
,
range
);
});
...
...
@@ -373,10 +373,10 @@ export function registerCompletionItemProvider(languageId: string, provider: Com
let
adapter
=
new
SuggestAdapter
(
provider
);
return
modes
.
SuggestRegistry
.
register
(
languageId
,
{
triggerCharacters
:
provider
.
triggerCharacters
,
provideCompletionItems
:
(
model
:
editorCommon
.
I
ReadOnly
Model
,
position
:
Position
,
context
:
modes
.
SuggestContext
,
token
:
CancellationToken
):
Thenable
<
modes
.
ISuggestResult
>
=>
{
provideCompletionItems
:
(
model
:
editorCommon
.
IModel
,
position
:
Position
,
context
:
modes
.
SuggestContext
,
token
:
CancellationToken
):
Thenable
<
modes
.
ISuggestResult
>
=>
{
return
adapter
.
provideCompletionItems
(
model
,
position
,
context
,
token
);
},
resolveCompletionItem
:
(
model
:
editorCommon
.
I
ReadOnly
Model
,
position
:
Position
,
suggestion
:
modes
.
ISuggestion
,
token
:
CancellationToken
):
Thenable
<
modes
.
ISuggestion
>
=>
{
resolveCompletionItem
:
(
model
:
editorCommon
.
IModel
,
position
:
Position
,
suggestion
:
modes
.
ISuggestion
,
token
:
CancellationToken
):
Thenable
<
modes
.
ISuggestion
>
=>
{
return
adapter
.
resolveCompletionItem
(
model
,
position
,
suggestion
,
token
);
}
});
...
...
@@ -411,7 +411,7 @@ export interface CodeActionProvider {
/**
* Provide commands for the given document and range.
*/
provideCodeActions
(
model
:
editorCommon
.
I
ReadOnly
Model
,
range
:
Range
,
context
:
CodeActionContext
,
token
:
CancellationToken
):
(
modes
.
Command
|
modes
.
CodeAction
)[]
|
Thenable
<
(
modes
.
Command
|
modes
.
CodeAction
)[]
>
;
provideCodeActions
(
model
:
editorCommon
.
IModel
,
range
:
Range
,
context
:
CodeActionContext
,
token
:
CancellationToken
):
(
modes
.
Command
|
modes
.
CodeAction
)[]
|
Thenable
<
(
modes
.
Command
|
modes
.
CodeAction
)[]
>
;
}
/**
...
...
@@ -576,7 +576,7 @@ export interface CompletionItemProvider {
/**
* Provide completion items for the given position and document.
*/
provideCompletionItems
(
document
:
editorCommon
.
I
ReadOnly
Model
,
position
:
Position
,
token
:
CancellationToken
,
context
:
CompletionContext
):
CompletionItem
[]
|
Thenable
<
CompletionItem
[]
>
|
CompletionList
|
Thenable
<
CompletionList
>
;
provideCompletionItems
(
document
:
editorCommon
.
IModel
,
position
:
Position
,
token
:
CancellationToken
,
context
:
CompletionContext
):
CompletionItem
[]
|
Thenable
<
CompletionItem
[]
>
|
CompletionList
|
Thenable
<
CompletionList
>
;
/**
* Given a completion item fill in more data, like [doc-comment](#CompletionItem.documentation)
...
...
@@ -665,7 +665,7 @@ class SuggestAdapter {
return
suggestion
;
}
provideCompletionItems
(
model
:
editorCommon
.
I
ReadOnly
Model
,
position
:
Position
,
context
:
modes
.
SuggestContext
,
token
:
CancellationToken
):
Thenable
<
modes
.
ISuggestResult
>
{
provideCompletionItems
(
model
:
editorCommon
.
IModel
,
position
:
Position
,
context
:
modes
.
SuggestContext
,
token
:
CancellationToken
):
Thenable
<
modes
.
ISuggestResult
>
{
const
result
=
this
.
_provider
.
provideCompletionItems
(
model
,
position
,
token
,
context
);
return
toThenable
<
CompletionItem
[]
|
CompletionList
>
(
result
).
then
(
value
=>
{
const
result
:
modes
.
ISuggestResult
=
{
...
...
@@ -708,7 +708,7 @@ class SuggestAdapter {
});
}
resolveCompletionItem
(
model
:
editorCommon
.
I
ReadOnly
Model
,
position
:
Position
,
suggestion
:
modes
.
ISuggestion
,
token
:
CancellationToken
):
Thenable
<
modes
.
ISuggestion
>
{
resolveCompletionItem
(
model
:
editorCommon
.
IModel
,
position
:
Position
,
suggestion
:
modes
.
ISuggestion
,
token
:
CancellationToken
):
Thenable
<
modes
.
ISuggestion
>
{
if
(
typeof
this
.
_provider
.
resolveCompletionItem
!==
'
function
'
)
{
return
TPromise
.
as
(
suggestion
);
}
...
...
src/vs/editor/test/browser/controller/cursor.test.ts
浏览文件 @
7b0a1cd3
...
...
@@ -13,7 +13,7 @@ import { Selection } from 'vs/editor/common/core/selection';
import
{
EndOfLinePreference
,
Handler
,
DefaultEndOfLine
,
ITextModelCreationOptions
,
ICommand
,
I
Tokenized
Model
,
IEditOperationBuilder
,
ICursorStateComputerData
,
EndOfLineSequence
IModel
,
IEditOperationBuilder
,
ICursorStateComputerData
,
EndOfLineSequence
}
from
'
vs/editor/common/editorCommon
'
;
import
{
TextModel
}
from
'
vs/editor/common/model/textModel
'
;
import
{
IndentAction
,
IndentationRule
}
from
'
vs/editor/common/modes/languageConfiguration
'
;
...
...
@@ -2087,12 +2087,12 @@ suite('Editor Controller - Cursor Configuration', () => {
private
_selectionId
:
string
=
null
;
public
getEditOperations
(
model
:
I
Tokenized
Model
,
builder
:
IEditOperationBuilder
):
void
{
public
getEditOperations
(
model
:
IModel
,
builder
:
IEditOperationBuilder
):
void
{
builder
.
addEditOperation
(
new
Range
(
1
,
13
,
1
,
14
),
''
);
this
.
_selectionId
=
builder
.
trackSelection
(
cursor
.
getSelection
());
}
public
computeCursorState
(
model
:
I
Tokenized
Model
,
helper
:
ICursorStateComputerData
):
Selection
{
public
computeCursorState
(
model
:
IModel
,
helper
:
ICursorStateComputerData
):
Selection
{
return
helper
.
getTrackedSelection
(
this
.
_selectionId
);
}
...
...
src/vs/monaco.d.ts
浏览文件 @
7b0a1cd3
...
...
@@ -1371,14 +1371,14 @@ declare module monaco.editor {
* @param model The model the command will execute on.
* @param builder A helper to collect the needed edit operations and to track selections.
*/
getEditOperations
(
model
:
I
Tokenized
Model
,
builder
:
IEditOperationBuilder
):
void
;
getEditOperations
(
model
:
IModel
,
builder
:
IEditOperationBuilder
):
void
;
/**
* Compute the cursor state after the edit operations were applied.
* @param model The model the commad has executed on.
* @param helper A helper to get inverse edit operations and to get previously tracked selections.
* @return The cursor state after the command executed.
*/
computeCursorState
(
model
:
I
Tokenized
Model
,
helper
:
ICursorStateComputerData
):
Selection
;
computeCursorState
(
model
:
IModel
,
helper
:
ICursorStateComputerData
):
Selection
;
}
/**
...
...
@@ -1453,10 +1453,27 @@ declare module monaco.editor {
trimAutoWhitespace
?:
boolean
;
}
export
class
FindMatch
{
_findMatchBrand
:
void
;
readonly
range
:
Range
;
readonly
matches
:
string
[];
}
/**
* Describes the behavior of decorations when typing/editing near their edges.
* Note: Please do not edit the values, as they very carefully match `DecorationRangeBehavior`
*/
export
enum
TrackedRangeStickiness
{
AlwaysGrowsWhenTypingAtEdges
=
0
,
NeverGrowsWhenTypingAtEdges
=
1
,
GrowsOnlyWhenTypingBefore
=
2
,
GrowsOnlyWhenTypingAfter
=
3
,
}
/**
* A
textual read-only
model.
* A model.
*/
export
interface
I
Text
Model
{
export
interface
IModel
{
/**
* Get the resolved options for this model.
*/
...
...
@@ -1629,15 +1646,6 @@ declare module monaco.editor {
* @return The range where the previous match is. It is null if no previous match has been found.
*/
findPreviousMatch
(
searchString
:
string
,
searchStart
:
IPosition
,
isRegex
:
boolean
,
matchCase
:
boolean
,
wordSeparators
:
string
,
captureMatches
:
boolean
):
FindMatch
;
}
export
class
FindMatch
{
_findMatchBrand
:
void
;
readonly
range
:
Range
;
readonly
matches
:
string
[];
}
export
interface
IReadOnlyModel
extends
ITextModel
{
/**
* Gets the resource associated with this editor model.
*/
...
...
@@ -1660,12 +1668,6 @@ declare module monaco.editor {
* @return The word under or besides `position`. Will never be null.
*/
getWordUntilPosition
(
position
:
IPosition
):
IWordAtPosition
;
}
/**
* A model that is tokenized.
*/
export
interface
ITokenizedModel
extends
ITextModel
{
/**
* Get the language associated with this model.
*/
...
...
@@ -1684,23 +1686,6 @@ declare module monaco.editor {
* @return The word under or besides `position`. Will never be null.
*/
getWordUntilPosition
(
position
:
IPosition
):
IWordAtPosition
;
}
/**
* Describes the behavior of decorations when typing/editing near their edges.
* Note: Please do not edit the values, as they very carefully match `DecorationRangeBehavior`
*/
export
enum
TrackedRangeStickiness
{
AlwaysGrowsWhenTypingAtEdges
=
0
,
NeverGrowsWhenTypingAtEdges
=
1
,
GrowsOnlyWhenTypingBefore
=
2
,
GrowsOnlyWhenTypingAfter
=
3
,
}
/**
* A model that can have decorations.
*/
export
interface
ITextModelWithDecorations
{
/**
* Perform a minimum ammount of operations, in order to transform the decorations
* identified by `oldDecorations` to the decorations described by `newDecorations`
...
...
@@ -1762,12 +1747,6 @@ declare module monaco.editor {
* @param filterOutValidation If set, it will ignore decorations specific to validation (i.e. warnings, errors).
*/
getOverviewRulerDecorations
(
ownerId
?:
number
,
filterOutValidation
?:
boolean
):
IModelDecoration
[];
}
/**
* An editable text model.
*/
export
interface
IEditableTextModel
extends
ITextModel
{
/**
* Normalize a string containing whitespace according to indentation rules (converts to spaces or to tabs).
*/
...
...
@@ -1806,12 +1785,6 @@ declare module monaco.editor {
* @return The inverse edit operations, that, when applied, will bring the model back to the previous state.
*/
applyEdits
(
operations
:
IIdentifiedSingleEditOperation
[]):
IIdentifiedSingleEditOperation
[];
}
/**
* A model.
*/
export
interface
IModel
extends
IReadOnlyModel
,
IEditableTextModel
,
ITokenizedModel
,
ITextModelWithDecorations
{
/**
* An event emitted when the contents of the model have changed.
* @event
...
...
@@ -3901,6 +3874,9 @@ declare module monaco.editor {
readonly
lineHeight
:
number
;
readonly
letterSpacing
:
number
;
}
//compatibility:
export
type
IReadOnlyModel
=
IModel
;
}
declare
module
monaco
.
languages
{
...
...
@@ -4080,7 +4056,7 @@ declare module monaco.languages {
/**
* Provide commands for the given document and range.
*/
provideCodeActions
(
model
:
editor
.
I
ReadOnly
Model
,
range
:
Range
,
context
:
CodeActionContext
,
token
:
CancellationToken
):
(
Command
|
CodeAction
)[]
|
Thenable
<
(
Command
|
CodeAction
)[]
>
;
provideCodeActions
(
model
:
editor
.
IModel
,
range
:
Range
,
context
:
CodeActionContext
,
token
:
CancellationToken
):
(
Command
|
CodeAction
)[]
|
Thenable
<
(
Command
|
CodeAction
)[]
>
;
}
/**
...
...
@@ -4244,7 +4220,7 @@ declare module monaco.languages {
/**
* Provide completion items for the given position and document.
*/
provideCompletionItems
(
document
:
editor
.
I
ReadOnly
Model
,
position
:
Position
,
token
:
CancellationToken
,
context
:
CompletionContext
):
CompletionItem
[]
|
Thenable
<
CompletionItem
[]
>
|
CompletionList
|
Thenable
<
CompletionList
>
;
provideCompletionItems
(
document
:
editor
.
IModel
,
position
:
Position
,
token
:
CancellationToken
,
context
:
CompletionContext
):
CompletionItem
[]
|
Thenable
<
CompletionItem
[]
>
|
CompletionList
|
Thenable
<
CompletionList
>
;
/**
* Given a completion item fill in more data, like [doc-comment](#CompletionItem.documentation)
* or [details](#CompletionItem.detail).
...
...
@@ -4505,7 +4481,7 @@ declare module monaco.languages {
* position will be merged by the editor. A hover can have a range which defaults
* to the word range at the position when omitted.
*/
provideHover
(
model
:
editor
.
I
ReadOnly
Model
,
position
:
Position
,
token
:
CancellationToken
):
Hover
|
Thenable
<
Hover
>
;
provideHover
(
model
:
editor
.
IModel
,
position
:
Position
,
token
:
CancellationToken
):
Hover
|
Thenable
<
Hover
>
;
}
/**
...
...
@@ -4591,7 +4567,7 @@ declare module monaco.languages {
/**
* Provide help for the signature at the given position and document.
*/
provideSignatureHelp
(
model
:
editor
.
I
ReadOnly
Model
,
position
:
Position
,
token
:
CancellationToken
):
SignatureHelp
|
Thenable
<
SignatureHelp
>
;
provideSignatureHelp
(
model
:
editor
.
IModel
,
position
:
Position
,
token
:
CancellationToken
):
SignatureHelp
|
Thenable
<
SignatureHelp
>
;
}
/**
...
...
@@ -4637,7 +4613,7 @@ declare module monaco.languages {
* Provide a set of document highlights, like all occurrences of a variable or
* all exit-points of a function.
*/
provideDocumentHighlights
(
model
:
editor
.
I
ReadOnly
Model
,
position
:
Position
,
token
:
CancellationToken
):
DocumentHighlight
[]
|
Thenable
<
DocumentHighlight
[]
>
;
provideDocumentHighlights
(
model
:
editor
.
IModel
,
position
:
Position
,
token
:
CancellationToken
):
DocumentHighlight
[]
|
Thenable
<
DocumentHighlight
[]
>
;
}
/**
...
...
@@ -4659,7 +4635,7 @@ declare module monaco.languages {
/**
* Provide a set of project-wide references for the given position and document.
*/
provideReferences
(
model
:
editor
.
I
ReadOnly
Model
,
position
:
Position
,
context
:
ReferenceContext
,
token
:
CancellationToken
):
Location
[]
|
Thenable
<
Location
[]
>
;
provideReferences
(
model
:
editor
.
IModel
,
position
:
Position
,
context
:
ReferenceContext
,
token
:
CancellationToken
):
Location
[]
|
Thenable
<
Location
[]
>
;
}
/**
...
...
@@ -4693,7 +4669,7 @@ declare module monaco.languages {
/**
* Provide the definition of the symbol at the given position and document.
*/
provideDefinition
(
model
:
editor
.
I
ReadOnly
Model
,
position
:
Position
,
token
:
CancellationToken
):
Definition
|
Thenable
<
Definition
>
;
provideDefinition
(
model
:
editor
.
IModel
,
position
:
Position
,
token
:
CancellationToken
):
Definition
|
Thenable
<
Definition
>
;
}
/**
...
...
@@ -4704,7 +4680,7 @@ declare module monaco.languages {
/**
* Provide the implementation of the symbol at the given position and document.
*/
provideImplementation
(
model
:
editor
.
I
ReadOnly
Model
,
position
:
Position
,
token
:
CancellationToken
):
Definition
|
Thenable
<
Definition
>
;
provideImplementation
(
model
:
editor
.
IModel
,
position
:
Position
,
token
:
CancellationToken
):
Definition
|
Thenable
<
Definition
>
;
}
/**
...
...
@@ -4715,7 +4691,7 @@ declare module monaco.languages {
/**
* Provide the type definition of the symbol at the given position and document.
*/
provideTypeDefinition
(
model
:
editor
.
I
ReadOnly
Model
,
position
:
Position
,
token
:
CancellationToken
):
Definition
|
Thenable
<
Definition
>
;
provideTypeDefinition
(
model
:
editor
.
IModel
,
position
:
Position
,
token
:
CancellationToken
):
Definition
|
Thenable
<
Definition
>
;
}
/**
...
...
@@ -4781,7 +4757,7 @@ declare module monaco.languages {
/**
* Provide symbol information for the given document.
*/
provideDocumentSymbols
(
model
:
editor
.
I
ReadOnly
Model
,
token
:
CancellationToken
):
SymbolInformation
[]
|
Thenable
<
SymbolInformation
[]
>
;
provideDocumentSymbols
(
model
:
editor
.
IModel
,
token
:
CancellationToken
):
SymbolInformation
[]
|
Thenable
<
SymbolInformation
[]
>
;
}
export
interface
TextEdit
{
...
...
@@ -4812,7 +4788,7 @@ declare module monaco.languages {
/**
* Provide formatting edits for a whole document.
*/
provideDocumentFormattingEdits
(
model
:
editor
.
I
ReadOnly
Model
,
options
:
FormattingOptions
,
token
:
CancellationToken
):
TextEdit
[]
|
Thenable
<
TextEdit
[]
>
;
provideDocumentFormattingEdits
(
model
:
editor
.
IModel
,
options
:
FormattingOptions
,
token
:
CancellationToken
):
TextEdit
[]
|
Thenable
<
TextEdit
[]
>
;
}
/**
...
...
@@ -4827,7 +4803,7 @@ declare module monaco.languages {
* or larger range. Often this is done by adjusting the start and end
* of the range to full syntax nodes.
*/
provideDocumentRangeFormattingEdits
(
model
:
editor
.
I
ReadOnly
Model
,
range
:
Range
,
options
:
FormattingOptions
,
token
:
CancellationToken
):
TextEdit
[]
|
Thenable
<
TextEdit
[]
>
;
provideDocumentRangeFormattingEdits
(
model
:
editor
.
IModel
,
range
:
Range
,
options
:
FormattingOptions
,
token
:
CancellationToken
):
TextEdit
[]
|
Thenable
<
TextEdit
[]
>
;
}
/**
...
...
@@ -4843,7 +4819,7 @@ declare module monaco.languages {
* what range the position to expand to, like find the matching `{`
* when `}` has been entered.
*/
provideOnTypeFormattingEdits
(
model
:
editor
.
I
ReadOnly
Model
,
position
:
Position
,
ch
:
string
,
options
:
FormattingOptions
,
token
:
CancellationToken
):
TextEdit
[]
|
Thenable
<
TextEdit
[]
>
;
provideOnTypeFormattingEdits
(
model
:
editor
.
IModel
,
position
:
Position
,
ch
:
string
,
options
:
FormattingOptions
,
token
:
CancellationToken
):
TextEdit
[]
|
Thenable
<
TextEdit
[]
>
;
}
/**
...
...
@@ -4858,7 +4834,7 @@ declare module monaco.languages {
* A provider of links.
*/
export
interface
LinkProvider
{
provideLinks
(
model
:
editor
.
I
ReadOnly
Model
,
token
:
CancellationToken
):
ILink
[]
|
Thenable
<
ILink
[]
>
;
provideLinks
(
model
:
editor
.
IModel
,
token
:
CancellationToken
):
ILink
[]
|
Thenable
<
ILink
[]
>
;
resolveLink
?:
(
link
:
ILink
,
token
:
CancellationToken
)
=>
ILink
|
Thenable
<
ILink
>
;
}
...
...
@@ -4927,11 +4903,11 @@ declare module monaco.languages {
/**
* Provides the color ranges for a specific model.
*/
provideDocumentColors
(
model
:
editor
.
I
ReadOnly
Model
,
token
:
CancellationToken
):
IColorInformation
[]
|
Thenable
<
IColorInformation
[]
>
;
provideDocumentColors
(
model
:
editor
.
IModel
,
token
:
CancellationToken
):
IColorInformation
[]
|
Thenable
<
IColorInformation
[]
>
;
/**
* Provide the string representations for a color.
*/
provideColorPresentations
(
model
:
editor
.
I
ReadOnly
Model
,
colorInfo
:
IColorInformation
,
token
:
CancellationToken
):
IColorPresentation
[]
|
Thenable
<
IColorPresentation
[]
>
;
provideColorPresentations
(
model
:
editor
.
IModel
,
colorInfo
:
IColorInformation
,
token
:
CancellationToken
):
IColorPresentation
[]
|
Thenable
<
IColorPresentation
[]
>
;
}
export
interface
IResourceEdit
{
...
...
@@ -4946,7 +4922,7 @@ declare module monaco.languages {
}
export
interface
RenameProvider
{
provideRenameEdits
(
model
:
editor
.
I
ReadOnly
Model
,
position
:
Position
,
newName
:
string
,
token
:
CancellationToken
):
WorkspaceEdit
|
Thenable
<
WorkspaceEdit
>
;
provideRenameEdits
(
model
:
editor
.
IModel
,
position
:
Position
,
newName
:
string
,
token
:
CancellationToken
):
WorkspaceEdit
|
Thenable
<
WorkspaceEdit
>
;
}
export
interface
Command
{
...
...
@@ -4964,8 +4940,8 @@ declare module monaco.languages {
export
interface
CodeLensProvider
{
onDidChange
?:
IEvent
<
this
>
;
provideCodeLenses
(
model
:
editor
.
I
ReadOnly
Model
,
token
:
CancellationToken
):
ICodeLensSymbol
[]
|
Thenable
<
ICodeLensSymbol
[]
>
;
resolveCodeLens
?(
model
:
editor
.
I
ReadOnly
Model
,
codeLens
:
ICodeLensSymbol
,
token
:
CancellationToken
):
ICodeLensSymbol
|
Thenable
<
ICodeLensSymbol
>
;
provideCodeLenses
(
model
:
editor
.
IModel
,
token
:
CancellationToken
):
ICodeLensSymbol
[]
|
Thenable
<
ICodeLensSymbol
[]
>
;
resolveCodeLens
?(
model
:
editor
.
IModel
,
codeLens
:
ICodeLensSymbol
,
token
:
CancellationToken
):
ICodeLensSymbol
|
Thenable
<
ICodeLensSymbol
>
;
}
export
interface
ILanguageExtensionPoint
{
...
...
src/vs/workbench/api/electron-browser/mainThreadLanguageFeatures.ts
浏览文件 @
7b0a1cd3
...
...
@@ -8,7 +8,7 @@ import { TPromise } from 'vs/base/common/winjs.base';
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
Emitter
}
from
'
vs/base/common/event
'
;
import
*
as
vscode
from
'
vscode
'
;
import
{
I
ReadOnly
Model
,
ISingleEditOperation
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IModel
,
ISingleEditOperation
}
from
'
vs/editor/common/editorCommon
'
;
import
*
as
modes
from
'
vs/editor/common/modes
'
;
import
{
WorkspaceSymbolProviderRegistry
,
IWorkspaceSymbolProvider
}
from
'
vs/workbench/parts/search/common/search
'
;
import
{
wireCancellationToken
}
from
'
vs/base/common/async
'
;
...
...
@@ -111,7 +111,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
$registerOutlineSupport
(
handle
:
number
,
selector
:
vscode
.
DocumentSelector
):
void
{
this
.
_registrations
[
handle
]
=
modes
.
DocumentSymbolProviderRegistry
.
register
(
toLanguageSelector
(
selector
),
<
modes
.
DocumentSymbolProvider
>
{
provideDocumentSymbols
:
(
model
:
I
ReadOnly
Model
,
token
:
CancellationToken
):
Thenable
<
modes
.
SymbolInformation
[]
>
=>
{
provideDocumentSymbols
:
(
model
:
IModel
,
token
:
CancellationToken
):
Thenable
<
modes
.
SymbolInformation
[]
>
=>
{
return
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideDocumentSymbols
(
handle
,
model
.
uri
)).
then
(
MainThreadLanguageFeatures
.
_reviveSymbolInformationDto
);
}
});
...
...
@@ -122,10 +122,10 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
$registerCodeLensSupport
(
handle
:
number
,
selector
:
vscode
.
DocumentSelector
,
eventHandle
:
number
):
void
{
const
provider
=
<
modes
.
CodeLensProvider
>
{
provideCodeLenses
:
(
model
:
I
ReadOnly
Model
,
token
:
CancellationToken
):
modes
.
ICodeLensSymbol
[]
|
Thenable
<
modes
.
ICodeLensSymbol
[]
>
=>
{
provideCodeLenses
:
(
model
:
IModel
,
token
:
CancellationToken
):
modes
.
ICodeLensSymbol
[]
|
Thenable
<
modes
.
ICodeLensSymbol
[]
>
=>
{
return
this
.
_heapService
.
trackRecursive
(
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideCodeLenses
(
handle
,
model
.
uri
)));
},
resolveCodeLens
:
(
model
:
I
ReadOnly
Model
,
codeLens
:
modes
.
ICodeLensSymbol
,
token
:
CancellationToken
):
modes
.
ICodeLensSymbol
|
Thenable
<
modes
.
ICodeLensSymbol
>
=>
{
resolveCodeLens
:
(
model
:
IModel
,
codeLens
:
modes
.
ICodeLensSymbol
,
token
:
CancellationToken
):
modes
.
ICodeLensSymbol
|
Thenable
<
modes
.
ICodeLensSymbol
>
=>
{
return
this
.
_heapService
.
trackRecursive
(
wireCancellationToken
(
token
,
this
.
_proxy
.
$resolveCodeLens
(
handle
,
model
.
uri
,
codeLens
)));
}
};
...
...
@@ -176,7 +176,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
$registerHoverProvider
(
handle
:
number
,
selector
:
vscode
.
DocumentSelector
):
void
{
this
.
_registrations
[
handle
]
=
modes
.
HoverProviderRegistry
.
register
(
toLanguageSelector
(
selector
),
<
modes
.
HoverProvider
>
{
provideHover
:
(
model
:
I
ReadOnly
Model
,
position
:
EditorPosition
,
token
:
CancellationToken
):
Thenable
<
modes
.
Hover
>
=>
{
provideHover
:
(
model
:
IModel
,
position
:
EditorPosition
,
token
:
CancellationToken
):
Thenable
<
modes
.
Hover
>
=>
{
return
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideHover
(
handle
,
model
.
uri
,
position
));
}
});
...
...
@@ -186,7 +186,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
$registerDocumentHighlightProvider
(
handle
:
number
,
selector
:
vscode
.
DocumentSelector
):
void
{
this
.
_registrations
[
handle
]
=
modes
.
DocumentHighlightProviderRegistry
.
register
(
toLanguageSelector
(
selector
),
<
modes
.
DocumentHighlightProvider
>
{
provideDocumentHighlights
:
(
model
:
I
ReadOnly
Model
,
position
:
EditorPosition
,
token
:
CancellationToken
):
Thenable
<
modes
.
DocumentHighlight
[]
>
=>
{
provideDocumentHighlights
:
(
model
:
IModel
,
position
:
EditorPosition
,
token
:
CancellationToken
):
Thenable
<
modes
.
DocumentHighlight
[]
>
=>
{
return
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideDocumentHighlights
(
handle
,
model
.
uri
,
position
));
}
});
...
...
@@ -196,7 +196,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
$registerReferenceSupport
(
handle
:
number
,
selector
:
vscode
.
DocumentSelector
):
void
{
this
.
_registrations
[
handle
]
=
modes
.
ReferenceProviderRegistry
.
register
(
toLanguageSelector
(
selector
),
<
modes
.
ReferenceProvider
>
{
provideReferences
:
(
model
:
I
ReadOnly
Model
,
position
:
EditorPosition
,
context
:
modes
.
ReferenceContext
,
token
:
CancellationToken
):
Thenable
<
modes
.
Location
[]
>
=>
{
provideReferences
:
(
model
:
IModel
,
position
:
EditorPosition
,
context
:
modes
.
ReferenceContext
,
token
:
CancellationToken
):
Thenable
<
modes
.
Location
[]
>
=>
{
return
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideReferences
(
handle
,
model
.
uri
,
position
,
context
)).
then
(
MainThreadLanguageFeatures
.
_reviveLocationDto
);
}
});
...
...
@@ -206,7 +206,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
$registerQuickFixSupport
(
handle
:
number
,
selector
:
vscode
.
DocumentSelector
):
void
{
this
.
_registrations
[
handle
]
=
modes
.
CodeActionProviderRegistry
.
register
(
toLanguageSelector
(
selector
),
<
modes
.
CodeActionProvider
>
{
provideCodeActions
:
(
model
:
I
ReadOnly
Model
,
range
:
EditorRange
,
token
:
CancellationToken
):
Thenable
<
modes
.
CodeAction
[]
>
=>
{
provideCodeActions
:
(
model
:
IModel
,
range
:
EditorRange
,
token
:
CancellationToken
):
Thenable
<
modes
.
CodeAction
[]
>
=>
{
return
this
.
_heapService
.
trackRecursive
(
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideCodeActions
(
handle
,
model
.
uri
,
range
))).
then
(
MainThreadLanguageFeatures
.
_reviveCodeActionDto
);
}
});
...
...
@@ -216,7 +216,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
$registerDocumentFormattingSupport
(
handle
:
number
,
selector
:
vscode
.
DocumentSelector
):
void
{
this
.
_registrations
[
handle
]
=
modes
.
DocumentFormattingEditProviderRegistry
.
register
(
toLanguageSelector
(
selector
),
<
modes
.
DocumentFormattingEditProvider
>
{
provideDocumentFormattingEdits
:
(
model
:
I
ReadOnly
Model
,
options
:
modes
.
FormattingOptions
,
token
:
CancellationToken
):
Thenable
<
ISingleEditOperation
[]
>
=>
{
provideDocumentFormattingEdits
:
(
model
:
IModel
,
options
:
modes
.
FormattingOptions
,
token
:
CancellationToken
):
Thenable
<
ISingleEditOperation
[]
>
=>
{
return
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideDocumentFormattingEdits
(
handle
,
model
.
uri
,
options
));
}
});
...
...
@@ -224,7 +224,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
$registerRangeFormattingSupport
(
handle
:
number
,
selector
:
vscode
.
DocumentSelector
):
void
{
this
.
_registrations
[
handle
]
=
modes
.
DocumentRangeFormattingEditProviderRegistry
.
register
(
toLanguageSelector
(
selector
),
<
modes
.
DocumentRangeFormattingEditProvider
>
{
provideDocumentRangeFormattingEdits
:
(
model
:
I
ReadOnly
Model
,
range
:
EditorRange
,
options
:
modes
.
FormattingOptions
,
token
:
CancellationToken
):
Thenable
<
ISingleEditOperation
[]
>
=>
{
provideDocumentRangeFormattingEdits
:
(
model
:
IModel
,
range
:
EditorRange
,
options
:
modes
.
FormattingOptions
,
token
:
CancellationToken
):
Thenable
<
ISingleEditOperation
[]
>
=>
{
return
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideDocumentRangeFormattingEdits
(
handle
,
model
.
uri
,
range
,
options
));
}
});
...
...
@@ -235,7 +235,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
autoFormatTriggerCharacters
,
provideOnTypeFormattingEdits
:
(
model
:
I
ReadOnly
Model
,
position
:
EditorPosition
,
ch
:
string
,
options
:
modes
.
FormattingOptions
,
token
:
CancellationToken
):
Thenable
<
ISingleEditOperation
[]
>
=>
{
provideOnTypeFormattingEdits
:
(
model
:
IModel
,
position
:
EditorPosition
,
ch
:
string
,
options
:
modes
.
FormattingOptions
,
token
:
CancellationToken
):
Thenable
<
ISingleEditOperation
[]
>
=>
{
return
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideOnTypeFormattingEdits
(
handle
,
model
.
uri
,
position
,
ch
,
options
));
}
});
...
...
@@ -265,7 +265,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
$registerRenameSupport
(
handle
:
number
,
selector
:
vscode
.
DocumentSelector
):
void
{
this
.
_registrations
[
handle
]
=
modes
.
RenameProviderRegistry
.
register
(
toLanguageSelector
(
selector
),
<
modes
.
RenameProvider
>
{
provideRenameEdits
:
(
model
:
I
ReadOnly
Model
,
position
:
EditorPosition
,
newName
:
string
,
token
:
CancellationToken
):
Thenable
<
modes
.
WorkspaceEdit
>
=>
{
provideRenameEdits
:
(
model
:
IModel
,
position
:
EditorPosition
,
newName
:
string
,
token
:
CancellationToken
):
Thenable
<
modes
.
WorkspaceEdit
>
=>
{
return
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideRenameEdits
(
handle
,
model
.
uri
,
position
,
newName
)).
then
(
MainThreadLanguageFeatures
.
_reviveWorkspaceEditDto
);
}
});
...
...
@@ -276,7 +276,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
$registerSuggestSupport
(
handle
:
number
,
selector
:
vscode
.
DocumentSelector
,
triggerCharacters
:
string
[],
supportsResolveDetails
:
boolean
):
void
{
this
.
_registrations
[
handle
]
=
modes
.
SuggestRegistry
.
register
(
toLanguageSelector
(
selector
),
<
modes
.
ISuggestSupport
>
{
triggerCharacters
,
provideCompletionItems
:
(
model
:
I
ReadOnly
Model
,
position
:
EditorPosition
,
context
:
modes
.
SuggestContext
,
token
:
CancellationToken
):
Thenable
<
modes
.
ISuggestResult
>
=>
{
provideCompletionItems
:
(
model
:
IModel
,
position
:
EditorPosition
,
context
:
modes
.
SuggestContext
,
token
:
CancellationToken
):
Thenable
<
modes
.
ISuggestResult
>
=>
{
return
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideCompletionItems
(
handle
,
model
.
uri
,
position
,
context
)).
then
(
result
=>
{
if
(
!
result
)
{
return
result
;
...
...
@@ -301,7 +301,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
signatureHelpTriggerCharacters
:
triggerCharacter
,
provideSignatureHelp
:
(
model
:
I
ReadOnly
Model
,
position
:
EditorPosition
,
token
:
CancellationToken
):
Thenable
<
modes
.
SignatureHelp
>
=>
{
provideSignatureHelp
:
(
model
:
IModel
,
position
:
EditorPosition
,
token
:
CancellationToken
):
Thenable
<
modes
.
SignatureHelp
>
=>
{
return
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideSignatureHelp
(
handle
,
model
.
uri
,
position
));
}
...
...
src/vs/workbench/parts/debug/electron-browser/repl.ts
浏览文件 @
7b0a1cd3
...
...
@@ -18,7 +18,7 @@ import { KeyCode } from 'vs/base/common/keyCodes';
import
{
ITree
,
ITreeOptions
}
from
'
vs/base/parts/tree/browser/tree
'
;
import
{
Context
as
SuggestContext
}
from
'
vs/editor/contrib/suggest/suggest
'
;
import
{
SuggestController
}
from
'
vs/editor/contrib/suggest/suggestController
'
;
import
{
I
ReadOnly
Model
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
EditorContextKeys
}
from
'
vs/editor/common/editorContextKeys
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
*
as
modes
from
'
vs/editor/common/modes
'
;
...
...
@@ -170,7 +170,7 @@ export class Repl extends Panel implements IPrivateReplService {
modes
.
SuggestRegistry
.
register
({
scheme
:
debug
.
DEBUG_SCHEME
},
{
triggerCharacters
:
[
'
.
'
],
provideCompletionItems
:
(
model
:
I
ReadOnly
Model
,
position
:
Position
,
_context
:
modes
.
SuggestContext
,
token
:
CancellationToken
):
Thenable
<
modes
.
ISuggestResult
>
=>
{
provideCompletionItems
:
(
model
:
IModel
,
position
:
Position
,
_context
:
modes
.
SuggestContext
,
token
:
CancellationToken
):
Thenable
<
modes
.
ISuggestResult
>
=>
{
const
word
=
this
.
replInput
.
getModel
().
getWordAtPosition
(
position
);
const
overwriteBefore
=
word
?
word
.
word
.
length
:
0
;
const
text
=
this
.
replInput
.
getModel
().
getLineContent
(
position
.
lineNumber
);
...
...
src/vs/workbench/parts/preferences/common/smartSnippetInserter.ts
浏览文件 @
7b0a1cd3
...
...
@@ -31,7 +31,7 @@ export class SmartSnippetInserter {
return
false
;
}
private
static
offsetToPosition
(
model
:
editorCommon
.
I
Text
Model
,
offset
:
number
):
Position
{
private
static
offsetToPosition
(
model
:
editorCommon
.
IModel
,
offset
:
number
):
Position
{
let
offsetBeforeLine
=
0
;
let
eolLength
=
model
.
getEOL
().
length
;
let
lineCount
=
model
.
getLineCount
();
...
...
@@ -53,7 +53,7 @@ export class SmartSnippetInserter {
);
}
public
static
insertSnippet
(
model
:
editorCommon
.
I
Text
Model
,
_position
:
Position
):
InsertSnippetResult
{
public
static
insertSnippet
(
model
:
editorCommon
.
IModel
,
_position
:
Position
):
InsertSnippetResult
{
let
desiredPosition
=
model
.
getValueLengthInRange
(
new
Range
(
1
,
1
,
_position
.
lineNumber
,
_position
.
column
));
...
...
src/vs/workbench/parts/quickopen/browser/gotoLineHandler.ts
浏览文件 @
7b0a1cd3
...
...
@@ -11,7 +11,7 @@ import errors = require('vs/base/common/errors');
import
{
IEntryRunContext
,
Mode
,
IAutoFocus
}
from
'
vs/base/parts/quickopen/common/quickOpen
'
;
import
{
QuickOpenModel
}
from
'
vs/base/parts/quickopen/browser/quickOpenModel
'
;
import
{
QuickOpenHandler
,
EditorQuickOpenEntry
,
QuickOpenAction
}
from
'
vs/workbench/browser/quickopen
'
;
import
{
IEditor
,
IModelDecorationsChangeAccessor
,
OverviewRulerLane
,
IModelDeltaDecoration
,
IEditorViewState
,
I
Text
Model
,
IDiffEditorModel
,
ScrollType
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IEditor
,
IModelDecorationsChangeAccessor
,
OverviewRulerLane
,
IModelDeltaDecoration
,
IEditorViewState
,
IModel
,
IDiffEditorModel
,
ScrollType
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
Position
,
IEditorInput
,
ITextEditorOptions
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IQuickOpenService
}
from
'
vs/platform/quickOpen/common/quickOpen
'
;
...
...
@@ -115,7 +115,7 @@ class GotoLineEntry extends EditorQuickOpenEntry {
model
=
(
<
IDiffEditorModel
>
model
).
modified
;
// Support for diff editor models
}
return
model
&&
types
.
isFunction
((
<
I
TextModel
>
model
).
getLineCount
)
?
(
<
IText
Model
>
model
).
getLineCount
()
:
-
1
;
return
model
&&
types
.
isFunction
((
<
I
Model
>
model
).
getLineCount
)
?
(
<
I
Model
>
model
).
getLineCount
()
:
-
1
;
}
public
run
(
mode
:
Mode
,
context
:
IEntryRunContext
):
boolean
{
...
...
src/vs/workbench/parts/quickopen/browser/gotoSymbolHandler.ts
浏览文件 @
7b0a1cd3
...
...
@@ -15,7 +15,7 @@ import { IEntryRunContext, Mode, IAutoFocus } from 'vs/base/parts/quickopen/comm
import
{
QuickOpenModel
,
IHighlight
}
from
'
vs/base/parts/quickopen/browser/quickOpenModel
'
;
import
{
QuickOpenHandler
,
EditorQuickOpenEntryGroup
,
QuickOpenAction
}
from
'
vs/workbench/browser/quickopen
'
;
import
filters
=
require
(
'
vs/base/common/filters
'
);
import
{
IEditor
,
IModelDecorationsChangeAccessor
,
OverviewRulerLane
,
IModelDeltaDecoration
,
IModel
,
I
TokenizedModel
,
I
DiffEditorModel
,
IEditorViewState
,
ScrollType
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IEditor
,
IModelDecorationsChangeAccessor
,
OverviewRulerLane
,
IModelDeltaDecoration
,
IModel
,
IDiffEditorModel
,
IEditorViewState
,
ScrollType
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IQuickOpenService
}
from
'
vs/platform/quickOpen/common/quickOpen
'
;
import
{
Position
,
IEditorInput
,
ITextEditorOptions
}
from
'
vs/platform/editor/common/editor
'
;
...
...
@@ -426,7 +426,7 @@ export class GotoSymbolHandler extends QuickOpenHandler {
model
=
(
<
IDiffEditorModel
>
model
).
modified
;
// Support for diff editor models
}
if
(
model
&&
types
.
isFunction
((
<
I
Tokenized
Model
>
model
).
getLanguageIdentifier
))
{
if
(
model
&&
types
.
isFunction
((
<
IModel
>
model
).
getLanguageIdentifier
))
{
canRun
=
DocumentSymbolProviderRegistry
.
has
(
<
IModel
>
model
);
}
}
...
...
@@ -485,7 +485,7 @@ export class GotoSymbolHandler extends QuickOpenHandler {
model
=
(
<
IDiffEditorModel
>
model
).
modified
;
// Support for diff editor models
}
if
(
model
&&
types
.
isFunction
((
<
I
Tokenized
Model
>
model
).
getLanguageIdentifier
))
{
if
(
model
&&
types
.
isFunction
((
<
IModel
>
model
).
getLanguageIdentifier
))
{
// Ask cache first
const
modelId
=
(
<
IModel
>
model
).
id
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录