Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
9de85cbe
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,发现更多精彩内容 >>
提交
9de85cbe
编写于
5月 22, 2016
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove IEditorPosition
上级
3b0df368
变更
51
展开全部
隐藏空白更改
内联
并排
Showing
51 changed file
with
566 addition
and
532 deletion
+566
-532
build/lib/monaco-editor.d.ts
build/lib/monaco-editor.d.ts
+297
-239
build/lib/monaco-editor.d.ts.recipe
build/lib/monaco-editor.d.ts.recipe
+7
-2
build/lib/monaco.js
build/lib/monaco.js
+7
-0
build/lib/monaco.ts
build/lib/monaco.ts
+9
-0
src/vs/editor/browser/controller/mouseHandler.ts
src/vs/editor/browser/controller/mouseHandler.ts
+4
-4
src/vs/editor/browser/controller/mouseTarget.ts
src/vs/editor/browser/controller/mouseTarget.ts
+6
-6
src/vs/editor/browser/editorBrowser.ts
src/vs/editor/browser/editorBrowser.ts
+7
-6
src/vs/editor/browser/view/viewController.ts
src/vs/editor/browser/view/viewController.ts
+14
-14
src/vs/editor/browser/viewParts/contentWidgets/contentWidgets.ts
...editor/browser/viewParts/contentWidgets/contentWidgets.ts
+4
-3
src/vs/editor/browser/viewParts/overviewRuler/decorationsOverviewRuler.ts
...owser/viewParts/overviewRuler/decorationsOverviewRuler.ts
+2
-1
src/vs/editor/browser/widget/diffEditorWidget.ts
src/vs/editor/browser/widget/diffEditorWidget.ts
+2
-1
src/vs/editor/common/commonCodeEditor.ts
src/vs/editor/common/commonCodeEditor.ts
+2
-2
src/vs/editor/common/controller/cursor.ts
src/vs/editor/common/controller/cursor.ts
+2
-2
src/vs/editor/common/controller/cursorCollection.ts
src/vs/editor/common/controller/cursorCollection.ts
+8
-7
src/vs/editor/common/controller/oneCursor.ts
src/vs/editor/common/controller/oneCursor.ts
+20
-20
src/vs/editor/common/controller/textAreaHandler.ts
src/vs/editor/common/controller/textAreaHandler.ts
+3
-3
src/vs/editor/common/controller/textAreaState.ts
src/vs/editor/common/controller/textAreaState.ts
+3
-2
src/vs/editor/common/core/editOperation.ts
src/vs/editor/common/core/editOperation.ts
+3
-2
src/vs/editor/common/core/editorState.ts
src/vs/editor/common/core/editorState.ts
+3
-2
src/vs/editor/common/core/position.ts
src/vs/editor/common/core/position.ts
+3
-3
src/vs/editor/common/core/range.ts
src/vs/editor/common/core/range.ts
+3
-3
src/vs/editor/common/editorCommon.ts
src/vs/editor/common/editorCommon.ts
+20
-62
src/vs/editor/common/editorCommonExtensions.ts
src/vs/editor/common/editorCommonExtensions.ts
+1
-1
src/vs/editor/common/model/mirrorModel.ts
src/vs/editor/common/model/mirrorModel.ts
+1
-3
src/vs/editor/common/model/textModel.ts
src/vs/editor/common/model/textModel.ts
+13
-11
src/vs/editor/common/model/textModelWithMarkers.ts
src/vs/editor/common/model/textModelWithMarkers.ts
+2
-2
src/vs/editor/common/model/textModelWithTokens.ts
src/vs/editor/common/model/textModelWithTokens.ts
+22
-51
src/vs/editor/common/model/textModelWithTrackedRanges.ts
src/vs/editor/common/model/textModelWithTrackedRanges.ts
+4
-3
src/vs/editor/common/modes.ts
src/vs/editor/common/modes.ts
+10
-9
src/vs/editor/common/modes/supports/suggestSupport.ts
src/vs/editor/common/modes/supports/suggestSupport.ts
+3
-2
src/vs/editor/common/viewModel/splitLinesCollection.ts
src/vs/editor/common/viewModel/splitLinesCollection.ts
+6
-6
src/vs/editor/common/viewModel/viewModel.ts
src/vs/editor/common/viewModel/viewModel.ts
+5
-4
src/vs/editor/common/viewModel/viewModelCursors.ts
src/vs/editor/common/viewModel/viewModelCursors.ts
+3
-2
src/vs/editor/common/viewModel/viewModelImpl.ts
src/vs/editor/common/viewModel/viewModelImpl.ts
+6
-6
src/vs/editor/contrib/find/common/findDecorations.ts
src/vs/editor/contrib/find/common/findDecorations.ts
+4
-3
src/vs/editor/contrib/find/common/findModel.ts
src/vs/editor/contrib/find/common/findModel.ts
+2
-2
src/vs/editor/contrib/format/common/format.ts
src/vs/editor/contrib/format/common/format.ts
+3
-2
src/vs/editor/contrib/goToDeclaration/common/goToDeclaration.ts
.../editor/contrib/goToDeclaration/common/goToDeclaration.ts
+3
-2
src/vs/editor/contrib/hover/browser/hoverWidgets.ts
src/vs/editor/contrib/hover/browser/hoverWidgets.ts
+2
-2
src/vs/editor/contrib/hover/common/hover.ts
src/vs/editor/contrib/hover/common/hover.ts
+3
-2
src/vs/editor/contrib/parameterHints/common/parameterHints.ts
...vs/editor/contrib/parameterHints/common/parameterHints.ts
+3
-2
src/vs/editor/contrib/referenceSearch/common/referenceSearch.ts
.../editor/contrib/referenceSearch/common/referenceSearch.ts
+3
-2
src/vs/editor/contrib/rename/common/rename.ts
src/vs/editor/contrib/rename/common/rename.ts
+3
-2
src/vs/editor/contrib/suggest/browser/completionModel.ts
src/vs/editor/contrib/suggest/browser/completionModel.ts
+3
-2
src/vs/editor/contrib/suggest/browser/suggestModel.ts
src/vs/editor/contrib/suggest/browser/suggestModel.ts
+2
-2
src/vs/editor/contrib/suggest/common/suggest.ts
src/vs/editor/contrib/suggest/common/suggest.ts
+3
-2
src/vs/editor/contrib/wordHighlighter/common/wordHighlighter.ts
.../editor/contrib/wordHighlighter/common/wordHighlighter.ts
+2
-1
src/vs/editor/test/common/controller/textAreaState.test.ts
src/vs/editor/test/common/controller/textAreaState.test.ts
+2
-2
src/vs/languages/typescript/common/languageFeatures.ts
src/vs/languages/typescript/common/languageFeatures.ts
+9
-8
src/vs/workbench/api/node/extHostLanguageFeatures.ts
src/vs/workbench/api/node/extHostLanguageFeatures.ts
+10
-9
src/vs/workbench/parts/debug/browser/debugHover.ts
src/vs/workbench/parts/debug/browser/debugHover.ts
+4
-3
未找到文件。
build/lib/monaco-editor.d.ts
浏览文件 @
9de85cbe
此差异已折叠。
点击以展开。
build/lib/monaco-editor.d.ts.recipe
浏览文件 @
9de85cbe
...
...
@@ -66,7 +66,7 @@ declare module monaco {
#include(vs/base/common/uri): URI
#include(vs/base/common/eventEmitter):
IEmitterEvent, ListenerCallback, IBulkListenerCallback, ListenerUnbind
, IEventEmitter
#include(vs/base/common/eventEmitter):
EmitterEvent, ListenerCallback, BulkListenerCallback
, IEventEmitter
#include(vs/base/common/keyCodes): KeyCode, KeyMod
...
...
@@ -91,6 +91,11 @@ declare module monaco {
export interface IConstructorSignature2<A1, A2, T> {
new (context: IPlatformServices, first: A1, second: A2): T;
}
#include(vs/editor/common/editorCommon): IPosition, IRange, IEditorRange, SelectionDirection, ISelection, IEditorSelection
#include(vs/editor/common/core/position): Position
#include(vs/editor/common/core/range): Range
#include(vs/editor/common/core/selection): Selection
}
...
...
@@ -110,7 +115,7 @@ declare module monaco.editor {
#include(vs/editor/common/core/viewLineToken): ViewLineToken
#includeAll(vs/editor/common/editorCommon):
KeyCode, KeyMod
#includeAll(vs/editor/common/editorCommon):
IPosition, IRange, IEditorRange, SelectionDirection, ISelection, IEditorSelection, IFoundBracket
#includeAll(vs/editor/browser/editorBrowser):
...
...
build/lib/monaco.js
浏览文件 @
9de85cbe
...
...
@@ -171,6 +171,13 @@ lines.forEach(function (line) {
typesToExclude_1
[
typeName
]
=
true
;
});
getAllTopLevelDeclarations
(
sourceFile_2
).
forEach
(
function
(
declaration
)
{
if
(
isDeclaration
(
declaration
))
{
if
(
typesToExclude_1
[
declaration
.
name
.
text
])
{
return
;
}
}
else
{
}
result
.
push
(
getMassagedTopLevelDeclarationText
(
sourceFile_2
,
declaration
));
});
return
;
...
...
build/lib/monaco.ts
浏览文件 @
9de85cbe
...
...
@@ -214,6 +214,15 @@ lines.forEach(line => {
});
getAllTopLevelDeclarations
(
sourceFile
).
forEach
((
declaration
)
=>
{
if
(
isDeclaration
(
declaration
))
{
if
(
typesToExclude
[
declaration
.
name
.
text
])
{
return
;
}
}
else
{
// todo
// node is ts.VariableStatement
// return (getNodeText(sourceFile, declaration).indexOf(typeName) >= 0);
}
result
.
push
(
getMassagedTopLevelDeclarationText
(
sourceFile
,
declaration
));
});
return
;
...
...
src/vs/editor/browser/controller/mouseHandler.ts
浏览文件 @
9de85cbe
...
...
@@ -77,10 +77,10 @@ class EventGateKeeper<T> extends Disposable {
}
class
MousePosition
{
public
position
:
editorCommon
.
IEditor
Position
;
public
position
:
Position
;
public
mouseColumn
:
number
;
constructor
(
position
:
editorCommon
.
IEditor
Position
,
mouseColumn
:
number
)
{
constructor
(
position
:
Position
,
mouseColumn
:
number
)
{
this
.
position
=
position
;
this
.
mouseColumn
=
mouseColumn
;
}
...
...
@@ -523,7 +523,7 @@ class MouseDownState {
private
_startedOnLineNumbers
:
boolean
;
public
get
startedOnLineNumbers
():
boolean
{
return
this
.
_startedOnLineNumbers
;
}
private
_lastMouseDownPosition
:
editorCommon
.
IEditor
Position
;
private
_lastMouseDownPosition
:
Position
;
private
_lastMouseDownPositionEqualCount
:
number
;
private
_lastMouseDownCount
:
number
;
private
_lastSetMouseDownCountTime
:
number
;
...
...
@@ -555,7 +555,7 @@ class MouseDownState {
this
.
_startedOnLineNumbers
=
startedOnLineNumbers
;
}
public
trySetCount
(
setMouseDownCount
:
number
,
newMouseDownPosition
:
editorCommon
.
IEditor
Position
):
void
{
public
trySetCount
(
setMouseDownCount
:
number
,
newMouseDownPosition
:
Position
):
void
{
// a. Invalidate multiple clicking if too much time has passed (will be hit by IE because the detail field of mouse events contains garbage in IE10)
let
currentTime
=
(
new
Date
()).
getTime
();
if
(
currentTime
-
this
.
_lastSetMouseDownCountTime
>
MouseDownState
.
CLEAR_MOUSE_DOWN_COUNT_TIME
)
{
...
...
src/vs/editor/browser/controller/mouseTarget.ts
浏览文件 @
9de85cbe
...
...
@@ -6,7 +6,7 @@
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
{
Range
as
EditorRange
}
from
'
vs/editor/common/core/range
'
;
import
{
EditorLayoutInfo
,
IEditor
Position
,
IEditor
Range
,
IPosition
,
MouseTargetType
}
from
'
vs/editor/common/editorCommon
'
;
import
{
EditorLayoutInfo
,
IEditorRange
,
IPosition
,
MouseTargetType
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ClassNames
,
IMouseTarget
,
IViewZoneData
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
IDomNodePosition
}
from
'
vs/base/browser/dom
'
;
import
{
ViewContext
}
from
'
vs/editor/common/view/viewContext
'
;
...
...
@@ -28,11 +28,11 @@ class MouseTarget implements IMouseTarget {
public
element
:
Element
;
public
type
:
MouseTargetType
;
public
mouseColumn
:
number
;
public
position
:
IEditor
Position
;
public
position
:
Position
;
public
range
:
IEditorRange
;
public
detail
:
any
;
constructor
(
element
:
Element
,
type
:
MouseTargetType
,
mouseColumn
:
number
=
0
,
position
:
IEditor
Position
=
null
,
range
:
IEditorRange
=
null
,
detail
:
any
=
null
)
{
constructor
(
element
:
Element
,
type
:
MouseTargetType
,
mouseColumn
:
number
=
0
,
position
:
Position
=
null
,
range
:
IEditorRange
=
null
,
detail
:
any
=
null
)
{
this
.
element
=
element
;
this
.
type
=
type
;
this
.
mouseColumn
=
mouseColumn
;
...
...
@@ -541,9 +541,9 @@ export class MouseTargetFactory {
if
(
viewZoneWhitespace
)
{
var
viewZoneMiddle
=
viewZoneWhitespace
.
verticalOffset
+
viewZoneWhitespace
.
height
/
2
,
lineCount
=
this
.
_context
.
model
.
getLineCount
(),
positionBefore
:
IEditor
Position
=
null
,
position
:
IEditor
Position
,
positionAfter
:
IEditor
Position
=
null
;
positionBefore
:
Position
=
null
,
position
:
Position
,
positionAfter
:
Position
=
null
;
if
(
viewZoneWhitespace
.
afterLineNumber
!==
lineCount
)
{
// There are more lines after this view zone
...
...
src/vs/editor/browser/editorBrowser.ts
浏览文件 @
9de85cbe
...
...
@@ -10,6 +10,7 @@ import {IKeyboardEvent} from 'vs/base/browser/keyboardEvent';
import
{
IMouseEvent
}
from
'
vs/base/browser/mouseEvent
'
;
import
{
IInstantiationService
,
IConstructorSignature1
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
export
interface
IContentWidgetData
{
widget
:
IContentWidget
;
...
...
@@ -69,14 +70,14 @@ export interface IView extends IDisposable {
export
interface
IViewZoneData
{
viewZoneId
:
number
;
positionBefore
:
editorCommon
.
IEditor
Position
;
positionAfter
:
editorCommon
.
IEditor
Position
;
position
:
editorCommon
.
IEditor
Position
;
positionBefore
:
Position
;
positionAfter
:
Position
;
position
:
Position
;
afterLineNumber
:
number
;
}
export
interface
IMouseDispatchData
{
position
:
editorCommon
.
IEditor
Position
;
position
:
Position
;
/**
* Desired mouse column (e.g. when position.column gets clamped to text length -- clicking after text on a line).
*/
...
...
@@ -94,7 +95,7 @@ export interface IMouseDispatchData {
export
interface
IViewController
{
dispatchMouse
(
data
:
IMouseDispatchData
);
moveTo
(
source
:
string
,
position
:
editorCommon
.
IEditor
Position
):
void
;
moveTo
(
source
:
string
,
position
:
Position
):
void
;
paste
(
source
:
string
,
text
:
string
,
pasteOnNewLine
:
boolean
):
void
;
type
(
source
:
string
,
text
:
string
):
void
;
...
...
@@ -323,7 +324,7 @@ export interface IMouseTarget {
/**
* The 'approximate' editor position
*/
position
:
editorCommon
.
IEditor
Position
;
position
:
Position
;
/**
* Desired mouse column (e.g. when position.column gets clamped to text length -- clicking after text on a line).
*/
...
...
src/vs/editor/browser/view/viewController.ts
浏览文件 @
9de85cbe
...
...
@@ -59,7 +59,7 @@ export class ViewController implements IViewController {
this
.
keybindingService
.
executeCommand
(
editorCommon
.
Handler
.
Cut
,
{});
}
private
_validateViewColumn
(
viewPosition
:
editorCommon
.
IEditorPosition
):
editorCommon
.
IEditor
Position
{
private
_validateViewColumn
(
viewPosition
:
Position
):
Position
{
var
minColumn
=
this
.
viewModel
.
getLineMinColumn
(
viewPosition
.
lineNumber
);
if
(
viewPosition
.
column
<
minColumn
)
{
return
new
Position
(
viewPosition
.
lineNumber
,
minColumn
);
...
...
@@ -133,7 +133,7 @@ export class ViewController implements IViewController {
}
}
public
moveTo
(
source
:
string
,
viewPosition
:
editorCommon
.
IEditor
Position
):
void
{
public
moveTo
(
source
:
string
,
viewPosition
:
Position
):
void
{
viewPosition
=
this
.
_validateViewColumn
(
viewPosition
);
this
.
triggerCursorHandler
(
source
,
editorCommon
.
Handler
.
MoveTo
,
{
position
:
this
.
convertViewToModelPosition
(
viewPosition
),
...
...
@@ -141,7 +141,7 @@ export class ViewController implements IViewController {
});
}
private
moveToSelect
(
source
:
string
,
viewPosition
:
editorCommon
.
IEditor
Position
):
void
{
private
moveToSelect
(
source
:
string
,
viewPosition
:
Position
):
void
{
viewPosition
=
this
.
_validateViewColumn
(
viewPosition
);
this
.
triggerCursorHandler
(
source
,
editorCommon
.
Handler
.
MoveToSelect
,
{
position
:
this
.
convertViewToModelPosition
(
viewPosition
),
...
...
@@ -149,7 +149,7 @@ export class ViewController implements IViewController {
});
}
private
columnSelect
(
source
:
string
,
viewPosition
:
editorCommon
.
IEditor
Position
,
mouseColumn
:
number
):
void
{
private
columnSelect
(
source
:
string
,
viewPosition
:
Position
,
mouseColumn
:
number
):
void
{
viewPosition
=
this
.
_validateViewColumn
(
viewPosition
);
this
.
triggerCursorHandler
(
source
,
editorCommon
.
Handler
.
ColumnSelect
,
{
position
:
this
.
convertViewToModelPosition
(
viewPosition
),
...
...
@@ -158,7 +158,7 @@ export class ViewController implements IViewController {
});
}
private
createCursor
(
source
:
string
,
viewPosition
:
editorCommon
.
IEditor
Position
,
wholeLine
:
boolean
):
void
{
private
createCursor
(
source
:
string
,
viewPosition
:
Position
,
wholeLine
:
boolean
):
void
{
viewPosition
=
this
.
_validateViewColumn
(
viewPosition
);
this
.
triggerCursorHandler
(
source
,
editorCommon
.
Handler
.
CreateCursor
,
{
position
:
this
.
convertViewToModelPosition
(
viewPosition
),
...
...
@@ -167,7 +167,7 @@ export class ViewController implements IViewController {
});
}
private
lastCursorMoveToSelect
(
source
:
string
,
viewPosition
:
editorCommon
.
IEditor
Position
):
void
{
private
lastCursorMoveToSelect
(
source
:
string
,
viewPosition
:
Position
):
void
{
viewPosition
=
this
.
_validateViewColumn
(
viewPosition
);
this
.
triggerCursorHandler
(
source
,
editorCommon
.
Handler
.
LastCursorMoveToSelect
,
{
position
:
this
.
convertViewToModelPosition
(
viewPosition
),
...
...
@@ -175,28 +175,28 @@ export class ViewController implements IViewController {
});
}
private
wordSelect
(
source
:
string
,
viewPosition
:
editorCommon
.
IEditor
Position
):
void
{
private
wordSelect
(
source
:
string
,
viewPosition
:
Position
):
void
{
viewPosition
=
this
.
_validateViewColumn
(
viewPosition
);
this
.
triggerCursorHandler
(
source
,
editorCommon
.
Handler
.
WordSelect
,
{
position
:
this
.
convertViewToModelPosition
(
viewPosition
)
});
}
private
wordSelectDrag
(
source
:
string
,
viewPosition
:
editorCommon
.
IEditor
Position
):
void
{
private
wordSelectDrag
(
source
:
string
,
viewPosition
:
Position
):
void
{
viewPosition
=
this
.
_validateViewColumn
(
viewPosition
);
this
.
triggerCursorHandler
(
source
,
editorCommon
.
Handler
.
WordSelectDrag
,
{
position
:
this
.
convertViewToModelPosition
(
viewPosition
)
});
}
private
lastCursorWordSelect
(
source
:
string
,
viewPosition
:
editorCommon
.
IEditor
Position
):
void
{
private
lastCursorWordSelect
(
source
:
string
,
viewPosition
:
Position
):
void
{
viewPosition
=
this
.
_validateViewColumn
(
viewPosition
);
this
.
triggerCursorHandler
(
source
,
editorCommon
.
Handler
.
LastCursorWordSelect
,
{
position
:
this
.
convertViewToModelPosition
(
viewPosition
)
});
}
private
lineSelect
(
source
:
string
,
viewPosition
:
editorCommon
.
IEditor
Position
):
void
{
private
lineSelect
(
source
:
string
,
viewPosition
:
Position
):
void
{
viewPosition
=
this
.
_validateViewColumn
(
viewPosition
);
this
.
triggerCursorHandler
(
source
,
editorCommon
.
Handler
.
LineSelect
,
{
position
:
this
.
convertViewToModelPosition
(
viewPosition
),
...
...
@@ -204,7 +204,7 @@ export class ViewController implements IViewController {
});
}
private
lineSelectDrag
(
source
:
string
,
viewPosition
:
editorCommon
.
IEditor
Position
):
void
{
private
lineSelectDrag
(
source
:
string
,
viewPosition
:
Position
):
void
{
viewPosition
=
this
.
_validateViewColumn
(
viewPosition
);
this
.
triggerCursorHandler
(
source
,
editorCommon
.
Handler
.
LineSelectDrag
,
{
position
:
this
.
convertViewToModelPosition
(
viewPosition
),
...
...
@@ -212,7 +212,7 @@ export class ViewController implements IViewController {
});
}
private
lastCursorLineSelect
(
source
:
string
,
viewPosition
:
editorCommon
.
IEditor
Position
):
void
{
private
lastCursorLineSelect
(
source
:
string
,
viewPosition
:
Position
):
void
{
viewPosition
=
this
.
_validateViewColumn
(
viewPosition
);
this
.
triggerCursorHandler
(
source
,
editorCommon
.
Handler
.
LastCursorLineSelect
,
{
position
:
this
.
convertViewToModelPosition
(
viewPosition
),
...
...
@@ -220,7 +220,7 @@ export class ViewController implements IViewController {
});
}
private
lastCursorLineSelectDrag
(
source
:
string
,
viewPosition
:
editorCommon
.
IEditor
Position
):
void
{
private
lastCursorLineSelectDrag
(
source
:
string
,
viewPosition
:
Position
):
void
{
viewPosition
=
this
.
_validateViewColumn
(
viewPosition
);
this
.
triggerCursorHandler
(
source
,
editorCommon
.
Handler
.
LastCursorLineSelectDrag
,
{
position
:
this
.
convertViewToModelPosition
(
viewPosition
),
...
...
@@ -234,7 +234,7 @@ export class ViewController implements IViewController {
// ----------------------
private
convertViewToModelPosition
(
viewPosition
:
editorCommon
.
IEditorPosition
):
editorCommon
.
IEditor
Position
{
private
convertViewToModelPosition
(
viewPosition
:
Position
):
Position
{
return
this
.
viewModel
.
convertViewPositionToModelPosition
(
viewPosition
.
lineNumber
,
viewPosition
.
column
);
}
...
...
src/vs/editor/browser/viewParts/contentWidgets/contentWidgets.ts
浏览文件 @
9de85cbe
...
...
@@ -13,6 +13,7 @@ import {ClassNames, ContentWidgetPositionPreference, IContentWidget} from 'vs/ed
import
{
ViewPart
}
from
'
vs/editor/browser/view/viewPart
'
;
import
{
ViewContext
}
from
'
vs/editor/common/view/viewContext
'
;
import
{
IRenderingContext
,
IRestrictedRenderingContext
}
from
'
vs/editor/common/view/renderingContext
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
interface
IWidgetData
{
allowEditorOverflow
:
boolean
;
...
...
@@ -184,7 +185,7 @@ export class ViewContentWidgets extends ViewPart {
}
}
private
_layoutBoxInViewport
(
position
:
editorCommon
.
IEditor
Position
,
domNode
:
HTMLElement
,
ctx
:
IRenderingContext
):
IBoxLayoutResult
{
private
_layoutBoxInViewport
(
position
:
Position
,
domNode
:
HTMLElement
,
ctx
:
IRenderingContext
):
IBoxLayoutResult
{
let
visibleRange
=
ctx
.
visibleRangeForPosition
(
position
);
...
...
@@ -228,7 +229,7 @@ export class ViewContentWidgets extends ViewPart {
};
}
private
_layoutBoxInPage
(
position
:
editorCommon
.
IEditor
Position
,
domNode
:
HTMLElement
,
ctx
:
IRenderingContext
):
IBoxLayoutResult
{
private
_layoutBoxInPage
(
position
:
Position
,
domNode
:
HTMLElement
,
ctx
:
IRenderingContext
):
IBoxLayoutResult
{
let
visibleRange
=
ctx
.
visibleRangeForPosition
(
position
);
if
(
!
visibleRange
)
{
...
...
@@ -282,7 +283,7 @@ export class ViewContentWidgets extends ViewPart {
};
}
private
_prepareRenderWidgetAtExactPosition
(
position
:
editorCommon
.
IEditor
Position
,
ctx
:
IRenderingContext
):
IMyWidgetRenderData
{
private
_prepareRenderWidgetAtExactPosition
(
position
:
Position
,
ctx
:
IRenderingContext
):
IMyWidgetRenderData
{
let
visibleRange
=
ctx
.
visibleRangeForPosition
(
position
);
if
(
!
visibleRange
)
{
...
...
src/vs/editor/browser/viewParts/overviewRuler/decorationsOverviewRuler.ts
浏览文件 @
9de85cbe
...
...
@@ -11,6 +11,7 @@ import {ViewPart} from 'vs/editor/browser/view/viewPart';
import
{
OverviewRulerImpl
}
from
'
vs/editor/browser/viewParts/overviewRuler/overviewRulerImpl
'
;
import
{
ViewContext
}
from
'
vs/editor/common/view/viewContext
'
;
import
{
IRenderingContext
,
IRestrictedRenderingContext
}
from
'
vs/editor/common/view/renderingContext
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
export
class
DecorationsOverviewRuler
extends
ViewPart
{
...
...
@@ -25,7 +26,7 @@ export class DecorationsOverviewRuler extends ViewPart {
private
_shouldUpdateCursorPosition
:
boolean
;
private
_hideCursor
:
boolean
;
private
_cursorPositions
:
editorCommon
.
IEditor
Position
[];
private
_cursorPositions
:
Position
[];
private
_zonesFromDecorations
:
OverviewRulerZone
[];
private
_zonesFromCursors
:
OverviewRulerZone
[];
...
...
src/vs/editor/browser/widget/diffEditorWidget.ts
浏览文件 @
9de85cbe
...
...
@@ -25,6 +25,7 @@ import * as editorBrowser from 'vs/editor/browser/editorBrowser';
import
{
CodeEditorWidget
}
from
'
vs/editor/browser/widget/codeEditorWidget
'
;
import
{
ViewLineToken
,
ViewLineTokens
}
from
'
vs/editor/common/core/viewLineToken
'
;
import
{
Configuration
}
from
'
vs/editor/browser/config/configuration
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
interface
IEditorDiffDecorations
{
decorations
:
editorCommon
.
IModelDeltaDecoration
[];
...
...
@@ -503,7 +504,7 @@ export class DiffEditorWidget extends EventEmitter implements editorBrowser.IDif
return
this
.
modifiedEditor
.
getVisibleColumnFromPosition
(
position
);
}
public
getPosition
():
editorCommon
.
IEditor
Position
{
public
getPosition
():
Position
{
return
this
.
modifiedEditor
.
getPosition
();
}
...
...
src/vs/editor/common/commonCodeEditor.ts
浏览文件 @
9de85cbe
...
...
@@ -300,7 +300,7 @@ export abstract class CommonCodeEditor extends EventEmitter implements IActionPr
return
CursorMoveHelper
.
visibleColumnFromColumn
(
this
.
model
,
position
.
lineNumber
,
position
.
column
,
tabSize
)
+
1
;
}
public
getPosition
():
editorCommon
.
IEditor
Position
{
public
getPosition
():
Position
{
if
(
!
this
.
cursor
)
{
return
null
;
}
...
...
@@ -757,7 +757,7 @@ export abstract class CommonCodeEditor extends EventEmitter implements IActionPr
convertViewSelectionToModelSelection
:
(
viewSelection
:
editorCommon
.
ISelection
)
=>
{
return
this
.
viewModel
.
convertViewSelectionToModelSelection
(
viewSelection
);
},
validateViewPosition
:
(
viewLineNumber
:
number
,
viewColumn
:
number
,
modelPosition
:
editorCommon
.
IEditor
Position
)
=>
{
validateViewPosition
:
(
viewLineNumber
:
number
,
viewColumn
:
number
,
modelPosition
:
Position
)
=>
{
return
this
.
viewModel
.
validateViewPosition
(
viewLineNumber
,
viewColumn
,
modelPosition
);
},
validateViewRange
:
(
viewStartLineNumber
:
number
,
viewStartColumn
:
number
,
viewEndLineNumber
:
number
,
viewEndColumn
:
number
,
modelRange
:
editorCommon
.
IEditorRange
)
=>
{
...
...
src/vs/editor/common/controller/cursor.ts
浏览文件 @
9de85cbe
...
...
@@ -116,7 +116,7 @@ export class Cursor extends EventEmitter {
convertViewSelectionToModelSelection
:
(
viewSelection
:
editorCommon
.
IEditorSelection
)
=>
{
return
viewSelection
;
},
validateViewPosition
:
(
viewLineNumber
:
number
,
viewColumn
:
number
,
modelPosition
:
editorCommon
.
IEditor
Position
)
=>
{
validateViewPosition
:
(
viewLineNumber
:
number
,
viewColumn
:
number
,
modelPosition
:
Position
)
=>
{
return
modelPosition
;
},
validateViewRange
:
(
viewStartLineNumber
:
number
,
viewStartColumn
:
number
,
viewEndLineNumber
:
number
,
viewEndColumn
:
number
,
modelRange
:
editorCommon
.
IEditorRange
)
=>
{
...
...
@@ -289,7 +289,7 @@ export class Cursor extends EventEmitter {
return
this
.
cursors
.
getSelections
();
}
public
getPosition
():
editorCommon
.
IEditor
Position
{
public
getPosition
():
Position
{
return
this
.
cursors
.
getPosition
(
0
);
}
...
...
src/vs/editor/common/controller/cursorCollection.ts
浏览文件 @
9de85cbe
...
...
@@ -7,8 +7,9 @@
import
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
import
{
IModeConfiguration
,
IOneCursorState
,
IViewModelHelper
,
OneCursor
}
from
'
vs/editor/common/controller/oneCursor
'
;
import
{
Selection
}
from
'
vs/editor/common/core/selection
'
;
import
{
IConfiguration
,
IEditor
Position
,
IEditor
Selection
,
IModel
,
ISelection
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IConfiguration
,
IEditorSelection
,
IModel
,
ISelection
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IAutoClosingPair
}
from
'
vs/editor/common/modes
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
export
interface
ICursorCollectionState
{
primary
:
IOneCursorState
;
...
...
@@ -78,7 +79,7 @@ export class CursorCollection {
return
result
;
}
public
getPosition
(
index
:
number
):
IEditor
Position
{
public
getPosition
(
index
:
number
):
Position
{
if
(
index
===
0
)
{
return
this
.
primaryCursor
.
getPosition
();
}
else
{
...
...
@@ -86,7 +87,7 @@ export class CursorCollection {
}
}
public
getViewPosition
(
index
:
number
):
IEditor
Position
{
public
getViewPosition
(
index
:
number
):
Position
{
if
(
index
===
0
)
{
return
this
.
primaryCursor
.
getViewPosition
();
}
else
{
...
...
@@ -94,8 +95,8 @@ export class CursorCollection {
}
}
public
getPositions
():
IEditor
Position
[]
{
var
result
:
IEditor
Position
[]
=
[];
public
getPositions
():
Position
[]
{
var
result
:
Position
[]
=
[];
result
.
push
(
this
.
primaryCursor
.
getPosition
());
for
(
var
i
=
0
,
len
=
this
.
secondaryCursors
.
length
;
i
<
len
;
i
++
)
{
result
.
push
(
this
.
secondaryCursors
[
i
].
getPosition
());
...
...
@@ -103,8 +104,8 @@ export class CursorCollection {
return
result
;
}
public
getViewPositions
():
IEditor
Position
[]
{
var
result
:
IEditor
Position
[]
=
[];
public
getViewPositions
():
Position
[]
{
var
result
:
Position
[]
=
[];
result
.
push
(
this
.
primaryCursor
.
getViewPosition
());
for
(
var
i
=
0
,
len
=
this
.
secondaryCursors
.
length
;
i
<
len
;
i
++
)
{
result
.
push
(
this
.
secondaryCursors
[
i
].
getViewPosition
());
...
...
src/vs/editor/common/controller/oneCursor.ts
浏览文件 @
9de85cbe
...
...
@@ -57,21 +57,21 @@ export interface IViewModelHelper {
viewModel
:
ICursorMoveHelperModel
;
convertModelPositionToViewPosition
(
lineNumber
:
number
,
column
:
number
):
editorCommon
.
IEditor
Position
;
convertModelPositionToViewPosition
(
lineNumber
:
number
,
column
:
number
):
Position
;
convertModelRangeToViewRange
(
modelRange
:
editorCommon
.
IEditorRange
):
editorCommon
.
IEditorRange
;
convertViewToModelPosition
(
lineNumber
:
number
,
column
:
number
):
editorCommon
.
IEditor
Position
;
convertViewToModelPosition
(
lineNumber
:
number
,
column
:
number
):
Position
;
convertViewSelectionToModelSelection
(
viewSelection
:
editorCommon
.
IEditorSelection
):
editorCommon
.
IEditorSelection
;
validateViewPosition
(
viewLineNumber
:
number
,
viewColumn
:
number
,
modelPosition
:
editorCommon
.
IEditorPosition
):
editorCommon
.
IEditor
Position
;
validateViewPosition
(
viewLineNumber
:
number
,
viewColumn
:
number
,
modelPosition
:
Position
):
Position
;
validateViewRange
(
viewStartLineNumber
:
number
,
viewStartColumn
:
number
,
viewEndLineNumber
:
number
,
viewEndColumn
:
number
,
modelRange
:
editorCommon
.
IEditorRange
):
editorCommon
.
IEditorRange
;
}
export
interface
IOneCursorState
{
selectionStart
:
editorCommon
.
IEditorRange
;
viewSelectionStart
:
editorCommon
.
IEditorRange
;
position
:
editorCommon
.
IEditor
Position
;
viewPosition
:
editorCommon
.
IEditor
Position
;
position
:
Position
;
viewPosition
:
Position
;
leftoverVisibleColumns
:
number
;
selectionStartLeftoverVisibleColumns
:
number
;
}
...
...
@@ -132,8 +132,8 @@ export class OneCursor {
private
selectionStartLeftoverVisibleColumns
:
number
;
// --- position
private
position
:
editorCommon
.
IEditor
Position
;
private
viewPosition
:
editorCommon
.
IEditor
Position
;
private
position
:
Position
;
private
viewPosition
:
Position
;
private
leftoverVisibleColumns
:
number
;
// --- bracket match decorations
...
...
@@ -171,8 +171,8 @@ export class OneCursor {
private
_set
(
selectionStart
:
editorCommon
.
IEditorRange
,
selectionStartLeftoverVisibleColumns
:
number
,
position
:
editorCommon
.
IEditor
Position
,
leftoverVisibleColumns
:
number
,
viewSelectionStart
:
editorCommon
.
IEditorRange
,
viewPosition
:
editorCommon
.
IEditor
Position
position
:
Position
,
leftoverVisibleColumns
:
number
,
viewSelectionStart
:
editorCommon
.
IEditorRange
,
viewPosition
:
Position
):
void
{
this
.
selectionStart
=
selectionStart
;
this
.
selectionStartLeftoverVisibleColumns
=
selectionStartLeftoverVisibleColumns
;
...
...
@@ -276,7 +276,7 @@ export class OneCursor {
this
.
bracketDecorations
=
this
.
model
.
deltaDecorations
(
this
.
bracketDecorations
,
newDecorations
,
this
.
editorId
);
}
private
static
computeSelection
(
selectionStart
:
editorCommon
.
IEditorRange
,
position
:
editorCommon
.
IEditor
Position
):
Selection
{
private
static
computeSelection
(
selectionStart
:
editorCommon
.
IEditorRange
,
position
:
Position
):
Selection
{
let
startLineNumber
:
number
,
startColumn
:
number
,
endLineNumber
:
number
,
endColumn
:
number
;
if
(
selectionStart
.
isEmpty
())
{
startLineNumber
=
selectionStart
.
startLineNumber
;
...
...
@@ -458,20 +458,20 @@ export class OneCursor {
public
getSelectionStart
():
editorCommon
.
IEditorRange
{
return
this
.
selectionStart
;
}
public
getPosition
():
editorCommon
.
IEditor
Position
{
public
getPosition
():
Position
{
return
this
.
position
;
}
public
getSelection
():
editorCommon
.
IEditorSelection
{
return
this
.
_cachedSelection
;
}
public
getViewPosition
():
editorCommon
.
IEditor
Position
{
public
getViewPosition
():
Position
{
return
this
.
viewPosition
;
}
public
getViewSelection
():
editorCommon
.
IEditorSelection
{
return
this
.
_cachedViewSelection
;
}
public
getValidViewPosition
():
editorCommon
.
IEditor
Position
{
public
getValidViewPosition
():
Position
{
return
this
.
viewModelHelper
.
validateViewPosition
(
this
.
viewPosition
.
lineNumber
,
this
.
viewPosition
.
column
,
this
.
position
);
}
...
...
@@ -492,10 +492,10 @@ export class OneCursor {
}
// -- utils
public
validatePosition
(
position
:
editorCommon
.
IPosition
):
editorCommon
.
IEditor
Position
{
public
validatePosition
(
position
:
editorCommon
.
IPosition
):
Position
{
return
this
.
model
.
validatePosition
(
position
);
}
public
validateViewPosition
(
viewLineNumber
:
number
,
viewColumn
:
number
,
modelPosition
:
editorCommon
.
IEditorPosition
):
editorCommon
.
IEditor
Position
{
public
validateViewPosition
(
viewLineNumber
:
number
,
viewColumn
:
number
,
modelPosition
:
Position
):
Position
{
return
this
.
viewModelHelper
.
validateViewPosition
(
viewLineNumber
,
viewColumn
,
modelPosition
);
}
public
convertViewToModelPosition
(
lineNumber
:
number
,
column
:
number
):
editorCommon
.
IPosition
{
...
...
@@ -512,10 +512,10 @@ export class OneCursor {
public
getLineContent
(
lineNumber
:
number
):
string
{
return
this
.
model
.
getLineContent
(
lineNumber
);
}
public
findPreviousWordOnLine
(
position
:
editorCommon
.
IEditor
Position
):
IFindWordResult
{
public
findPreviousWordOnLine
(
position
:
Position
):
IFindWordResult
{
return
this
.
helper
.
findPreviousWordOnLine
(
position
);
}
public
findNextWordOnLine
(
position
:
editorCommon
.
IEditor
Position
):
IFindWordResult
{
public
findNextWordOnLine
(
position
:
Position
):
IFindWordResult
{
return
this
.
helper
.
findNextWordOnLine
(
position
);
}
public
getLeftOfPosition
(
lineNumber
:
number
,
column
:
number
):
editorCommon
.
IPosition
{
...
...
@@ -1187,7 +1187,7 @@ export class OneCursorOp {
return
this
.
_enter
(
cursor
,
true
,
ctx
);
}
private
static
_enter
(
cursor
:
OneCursor
,
keepPosition
:
boolean
,
ctx
:
IOneCursorOperationContext
,
position
?:
editorCommon
.
IEditor
Position
,
range
?:
editorCommon
.
IEditorRange
):
boolean
{
private
static
_enter
(
cursor
:
OneCursor
,
keepPosition
:
boolean
,
ctx
:
IOneCursorOperationContext
,
position
?:
Position
,
range
?:
editorCommon
.
IEditorRange
):
boolean
{
if
(
typeof
position
===
'
undefined
'
)
{
position
=
cursor
.
getPosition
();
}
...
...
@@ -2020,7 +2020,7 @@ class CursorHelper {
return
{
start
:
start
,
end
:
end
,
wordType
:
wordType
};
}
public
findPreviousWordOnLine
(
_position
:
editorCommon
.
IEditor
Position
):
IFindWordResult
{
public
findPreviousWordOnLine
(
_position
:
Position
):
IFindWordResult
{
let
position
=
this
.
model
.
validatePosition
(
_position
);
let
wordSeparators
=
getMapForWordSeparators
(
this
.
configuration
.
editor
.
wordSeparators
);
let
lineContent
=
this
.
model
.
getLineContent
(
position
.
lineNumber
);
...
...
@@ -2072,7 +2072,7 @@ class CursorHelper {
return
len
;
}
public
findNextWordOnLine
(
_position
:
editorCommon
.
IEditor
Position
):
IFindWordResult
{
public
findNextWordOnLine
(
_position
:
Position
):
IFindWordResult
{
let
position
=
this
.
model
.
validatePosition
(
_position
);
let
wordSeparators
=
getMapForWordSeparators
(
this
.
configuration
.
editor
.
wordSeparators
);
let
lineContent
=
this
.
model
.
getLineContent
(
position
.
lineNumber
);
...
...
src/vs/editor/common/controller/textAreaHandler.ts
浏览文件 @
9de85cbe
...
...
@@ -11,7 +11,7 @@ import {Disposable} from 'vs/base/common/lifecycle';
import
{
IClipboardEvent
,
ICompositionEvent
,
IKeyboardEventWrapper
,
ISimpleModel
,
ITextAreaWrapper
,
ITypeData
,
TextAreaState
,
TextAreaStrategy
,
createTextAreaState
}
from
'
vs/editor/common/controller/textAreaState
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
EndOfLinePreference
,
IEditor
Position
,
IEditor
Range
}
from
'
vs/editor/common/editorCommon
'
;
import
{
EndOfLinePreference
,
IEditorRange
}
from
'
vs/editor/common/editorCommon
'
;
enum
ReadFromTextArea
{
Type
,
...
...
@@ -74,7 +74,7 @@ export class TextAreaHandler extends Disposable {
private
asyncTriggerCut
:
RunOnceScheduler
;
private
lastCompositionEndTime
:
number
;
private
cursorPosition
:
IEditor
Position
;
private
cursorPosition
:
Position
;
private
textAreaState
:
TextAreaState
;
private
textareaIsShownAtCursor
:
boolean
;
...
...
@@ -249,7 +249,7 @@ export class TextAreaHandler extends Disposable {
this
.
_writePlaceholderAndSelectTextArea
(
'
selection changed
'
);
}
public
setCursorPosition
(
primary
:
IEditor
Position
):
void
{
public
setCursorPosition
(
primary
:
Position
):
void
{
this
.
cursorPosition
=
primary
;
}
...
...
src/vs/editor/common/controller/textAreaState.ts
浏览文件 @
9de85cbe
...
...
@@ -7,7 +7,8 @@
import
Event
from
'
vs/base/common/event
'
;
import
{
commonPrefixLength
,
commonSuffixLength
}
from
'
vs/base/common/strings
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
EndOfLinePreference
,
IEditorPosition
,
IEditorRange
,
IRange
}
from
'
vs/editor/common/editorCommon
'
;
import
{
EndOfLinePreference
,
IEditorRange
,
IRange
}
from
'
vs/editor/common/editorCommon
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
export
interface
IClipboardEvent
{
canUseTextData
():
boolean
;
...
...
@@ -54,7 +55,7 @@ export interface ISimpleModel {
getValueInRange
(
range
:
IRange
,
eol
:
EndOfLinePreference
):
string
;
getModelLineContent
(
lineNumber
:
number
):
string
;
getLineCount
():
number
;
convertViewPositionToModelPosition
(
viewLineNumber
:
number
,
viewColumn
:
number
):
IEditor
Position
;
convertViewPositionToModelPosition
(
viewLineNumber
:
number
,
viewColumn
:
number
):
Position
;
}
export
interface
ITypeData
{
...
...
src/vs/editor/common/core/editOperation.ts
浏览文件 @
9de85cbe
...
...
@@ -5,11 +5,12 @@
'
use strict
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
IEditorPosition
,
IEditorRange
,
IIdentifiedSingleEditOperation
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IEditorRange
,
IIdentifiedSingleEditOperation
}
from
'
vs/editor/common/editorCommon
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
export
class
EditOperation
{
public
static
insert
(
position
:
IEditor
Position
,
text
:
string
):
IIdentifiedSingleEditOperation
{
public
static
insert
(
position
:
Position
,
text
:
string
):
IIdentifiedSingleEditOperation
{
return
{
identifier
:
null
,
range
:
new
Range
(
position
.
lineNumber
,
position
.
column
,
position
.
lineNumber
,
position
.
column
),
...
...
src/vs/editor/common/core/editorState.ts
浏览文件 @
9de85cbe
...
...
@@ -5,13 +5,14 @@
'
use strict
'
;
import
*
as
strings
from
'
vs/base/common/strings
'
;
import
{
CodeEditorStateFlag
,
ICodeEditorState
,
ICommonCodeEditor
,
IEditorPosition
,
IEditorRange
}
from
'
vs/editor/common/editorCommon
'
;
import
{
CodeEditorStateFlag
,
ICodeEditorState
,
ICommonCodeEditor
,
IEditorRange
}
from
'
vs/editor/common/editorCommon
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
export
class
EditorState
implements
ICodeEditorState
{
private
flags
:
CodeEditorStateFlag
[];
private
position
:
IEditor
Position
;
private
position
:
Position
;
private
selection
:
IEditorRange
;
private
modelVersionId
:
string
;
private
scrollLeft
:
number
;
...
...
src/vs/editor/common/core/position.ts
浏览文件 @
9de85cbe
...
...
@@ -4,9 +4,9 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
I
EditorPosition
,
I
Position
,
IRange
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IPosition
,
IRange
}
from
'
vs/editor/common/editorCommon
'
;
export
class
Position
implements
IEditorPosition
{
export
class
Position
{
public
lineNumber
:
number
;
public
column
:
number
;
...
...
@@ -67,7 +67,7 @@ export class Position implements IEditorPosition {
// ---
public
static
lift
(
pos
:
IPosition
):
IEditor
Position
{
public
static
lift
(
pos
:
IPosition
):
Position
{
return
new
Position
(
pos
.
lineNumber
,
pos
.
column
);
}
...
...
src/vs/editor/common/core/range.ts
浏览文件 @
9de85cbe
...
...
@@ -6,7 +6,7 @@
'
use strict
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
{
IEditor
Position
,
IEditor
Range
,
IPosition
,
IRange
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IEditorRange
,
IPosition
,
IRange
}
from
'
vs/editor/common/editorCommon
'
;
export
class
Range
implements
IEditorRange
{
...
...
@@ -53,11 +53,11 @@ export class Range implements IEditorRange {
return
Range
.
equalsRange
(
this
,
other
);
}
public
getEndPosition
():
IEditor
Position
{
public
getEndPosition
():
Position
{
return
new
Position
(
this
.
endLineNumber
,
this
.
endColumn
);
}
public
getStartPosition
():
IEditor
Position
{
public
getStartPosition
():
Position
{
return
new
Position
(
this
.
startLineNumber
,
this
.
startColumn
);
}
...
...
src/vs/editor/common/editorCommon.ts
浏览文件 @
9de85cbe
...
...
@@ -14,6 +14,7 @@ import {ILineContext, IMode, IModeTransition, IToken} from 'vs/editor/common/mod
import
{
ViewLineToken
}
from
'
vs/editor/common/core/viewLineToken
'
;
import
{
ScrollbarVisibility
}
from
'
vs/base/browser/ui/scrollbar/scrollableElementOptions
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
export
interface
Event
<
T
>
{
(
listener
:
(
e
:
T
)
=>
any
,
thisArg
?:
any
):
IDisposable
;
...
...
@@ -35,28 +36,6 @@ export interface IPosition {
column
:
number
;
}
/**
* A position in the editor.
*/
export
interface
IEditorPosition
extends
IPosition
{
/**
* Test if this position equals other position
*/
equals
(
other
:
IPosition
):
boolean
;
/**
* Test if this position is before other position. If the two positions are equal, the result will be false.
*/
isBefore
(
other
:
IPosition
):
boolean
;
/**
* Test if this position is before other position. If the two positions are equal, the result will be true.
*/
isBeforeOrEqual
(
other
:
IPosition
):
boolean
;
/**
* Clone this position.
*/
clone
():
IEditorPosition
;
}
/**
* A range in the editor. This interface is suitable for serialization.
*/
...
...
@@ -111,7 +90,7 @@ export interface IEditorRange extends IRange {
/**
* Return the end position (which will be after or equal to the start position)
*/
getEndPosition
():
IEditor
Position
;
getEndPosition
():
Position
;
/**
* Create a new range using this range's start position, and using endLineNumber and endColumn as the end position.
*/
...
...
@@ -119,7 +98,7 @@ export interface IEditorRange extends IRange {
/**
* Return the start position (which will be before or equal to the end position)
*/
getStartPosition
():
IEditor
Position
;
getStartPosition
():
Position
;
/**
* Create a new range using this range's end position, and using startLineNumber and startColumn as the start position.
*/
...
...
@@ -1480,6 +1459,11 @@ export interface ITextModel {
*/
setValue
(
newValue
:
string
):
void
;
/**
* Replace the entire text buffer value contained in this model.
*/
setValueFromRawText
(
newValue
:
IRawText
):
void
;
/**
* Get the text stored in this model.
* @param eol The end of line character preference. Defaults to `EndOfLinePreference.TextDefined`.
...
...
@@ -1565,7 +1549,7 @@ export interface ITextModel {
/**
* Create a valid position,
*/
validatePosition
(
position
:
IPosition
):
IEditor
Position
;
validatePosition
(
position
:
IPosition
):
Position
;
/**
* Advances the given position by the given offest (negative offsets are also accepted)
...
...
@@ -1577,7 +1561,7 @@ export interface ITextModel {
* If the ofsset is such that the new position would be in the middle of a multi-byte
* line terminator, throws an exception.
*/
modifyPosition
(
position
:
IPosition
,
offset
:
number
):
IEditor
Position
;
modifyPosition
(
position
:
IPosition
,
offset
:
number
):
Position
;
/**
* Create a valid range.
...
...
@@ -1666,17 +1650,6 @@ export interface ITokenizedModel extends ITextModel {
/*package*/
_getLineModeTransitions
(
lineNumber
:
number
):
IModeTransition
[];
/**
* Replace the entire text buffer value contained in this model.
* Optionally, the language mode of the model can be changed.
* This call clears all of the undo / redo stack,
* removes all decorations or tracked ranges, emits a
* ModelContentChanged(ModelContentChangedFlush) event and
* unbinds the mirror model from the previous mode to the new
* one if the mode has changed.
*/
setValue
(
newValue
:
string
,
newMode
?:
IMode
):
void
;
/**
* Get the current language mode associated with the model.
*/
...
...
@@ -1685,8 +1658,8 @@ export interface ITokenizedModel extends ITextModel {
/**
* Set the current language mode associated with the model.
*/
setMode
(
newMode
:
IMode
):
void
;
setMode
(
newModePromise
:
TPromise
<
IMode
>
):
void
;
setMode
(
newMode
:
IMode
|
TPromise
<
IMode
>
):
void
;
/**
* A mode can be currently pending loading if a promise is used when constructing a model or calling setMode().
*
...
...
@@ -1761,7 +1734,7 @@ export interface ITextModelWithMarkers extends ITextModel {
/*package*/
_addMarker
(
lineNumber
:
number
,
column
:
number
,
stickToPreviousCharacter
:
boolean
):
string
;
/*package*/
_changeMarker
(
id
:
string
,
newLineNumber
:
number
,
newColumn
:
number
):
void
;
/*package*/
_changeMarkerStickiness
(
id
:
string
,
newStickToPreviousCharacter
:
boolean
):
void
;
/*package*/
_getMarker
(
id
:
string
):
IEditor
Position
;
/*package*/
_getMarker
(
id
:
string
):
Position
;
/*package*/
_removeMarker
(
id
:
string
):
void
;
/*package*/
_getLineMarkers
(
lineNumber
:
number
):
IReadOnlyLineMarker
[];
}
...
...
@@ -2033,21 +2006,6 @@ export interface IModel extends IReadOnlyModel, IEditableTextModel, ITextModelWi
*/
findPreviousMatch
(
searchString
:
string
,
searchStart
:
IPosition
,
isRegex
:
boolean
,
matchCase
:
boolean
,
wholeWord
:
boolean
):
IEditorRange
;
/**
* Replace the entire text buffer value contained in this model.
* Optionally, the language mode of the model can be changed.
* This call clears all of the undo / redo stack,
* removes all decorations or tracked ranges, emits a
* ModelContentChanged(ModelContentChangedFlush) event and
* unbinds the mirror model from the previous mode to the new
* one if the mode has changed.
*/
setValue
(
newValue
:
string
,
newMode
?:
IMode
):
void
;
setValue
(
newValue
:
string
,
newModePromise
:
TPromise
<
IMode
>
):
void
;
setValueFromRawText
(
newValue
:
IRawText
,
newMode
?:
IMode
):
void
;
setValueFromRawText
(
newValue
:
IRawText
,
newModePromise
:
TPromise
<
IMode
>
):
void
;
onBeforeAttached
():
void
;
onBeforeDetached
():
void
;
...
...
@@ -2267,19 +2225,19 @@ export interface ICursorPositionChangedEvent {
/**
* Primary cursor's position.
*/
position
:
IEditor
Position
;
position
:
Position
;
/**
* Primary cursor's view position
*/
viewPosition
:
IEditor
Position
;
viewPosition
:
Position
;
/**
* Secondary cursors' position.
*/
secondaryPositions
:
IEditor
Position
[];
secondaryPositions
:
Position
[];
/**
* Secondary cursors' view position.
*/
secondaryViewPositions
:
IEditor
Position
[];
secondaryViewPositions
:
Position
[];
/**
* Reason.
*/
...
...
@@ -2921,11 +2879,11 @@ export interface IViewCursorPositionChangedEvent {
/**
* Primary cursor's position.
*/
position
:
IEditor
Position
;
position
:
Position
;
/**
* Secondary cursors' position.
*/
secondaryPositions
:
IEditor
Position
[];
secondaryPositions
:
Position
[];
/**
* Is the primary cursor in the editable range?
*/
...
...
@@ -3135,7 +3093,7 @@ export interface IEditor {
/**
* Returns the primary position of the cursor.
*/
getPosition
():
IEditor
Position
;
getPosition
():
Position
;
/**
* Set the primary position of the cursor. This will remove any secondary cursors.
...
...
src/vs/editor/common/editorCommonExtensions.ts
浏览文件 @
9de85cbe
...
...
@@ -102,7 +102,7 @@ export module CommonEditorRegistry {
});
}
export
function
registerDefaultLanguageCommand
(
id
:
string
,
handler
:
(
model
:
editorCommon
.
IModel
,
position
:
editorCommon
.
IEditor
Position
,
args
:
{
[
n
:
string
]:
any
})
=>
any
)
{
export
function
registerDefaultLanguageCommand
(
id
:
string
,
handler
:
(
model
:
editorCommon
.
IModel
,
position
:
Position
,
args
:
{
[
n
:
string
]:
any
})
=>
any
)
{
registerLanguageCommand
(
id
,
function
(
accessor
,
args
)
{
const
{
resource
,
position
}
=
args
;
...
...
src/vs/editor/common/model/mirrorModel.ts
浏览文件 @
9de85cbe
...
...
@@ -289,9 +289,7 @@ export class MirrorModel extends AbstractMirrorModel implements editorCommon.IMi
this
.
_embeddedModels
=
{};
}
public
setMode
(
newMode
:
IMode
):
void
;
public
setMode
(
newModePromise
:
TPromise
<
IMode
>
):
void
;
public
setMode
(
newModeOrPromise
:
any
):
void
{
public
setMode
(
newModeOrPromise
:
IMode
|
TPromise
<
IMode
>
):
void
{
super
.
setMode
(
newModeOrPromise
);
this
.
_updateEmbeddedModels
();
}
...
...
src/vs/editor/common/model/textModel.ts
浏览文件 @
9de85cbe
...
...
@@ -265,16 +265,18 @@ export class TextModel extends OrderGuaranteeEventEmitter implements editorCommo
}
public
setValue
(
value
:
string
):
void
{
let
rawText
:
editorCommon
.
IRawText
=
null
;
if
(
value
!==
null
)
{
rawText
=
TextModel
.
toRawText
(
value
,
{
tabSize
:
this
.
_options
.
tabSize
,
insertSpaces
:
this
.
_options
.
insertSpaces
,
trimAutoWhitespace
:
this
.
_options
.
trimAutoWhitespace
,
detectIndentation
:
false
,
defaultEOL
:
this
.
_options
.
defaultEOL
});
if
(
value
===
null
)
{
// There's nothing to do
return
;
}
let
rawText
:
editorCommon
.
IRawText
=
null
;
rawText
=
TextModel
.
toRawText
(
value
,
{
tabSize
:
this
.
_options
.
tabSize
,
insertSpaces
:
this
.
_options
.
insertSpaces
,
trimAutoWhitespace
:
this
.
_options
.
trimAutoWhitespace
,
detectIndentation
:
false
,
defaultEOL
:
this
.
_options
.
defaultEOL
});
this
.
setValueFromRawText
(
rawText
);
}
...
...
@@ -512,7 +514,7 @@ export class TextModel extends OrderGuaranteeEventEmitter implements editorCommo
return
lineNumber
;
}
public
validatePosition
(
position
:
editorCommon
.
IPosition
):
editorCommon
.
IEditor
Position
{
public
validatePosition
(
position
:
editorCommon
.
IPosition
):
Position
{
var
lineNumber
=
position
.
lineNumber
?
position
.
lineNumber
:
1
;
var
column
=
position
.
column
?
position
.
column
:
1
;
...
...
@@ -543,7 +545,7 @@ export class TextModel extends OrderGuaranteeEventEmitter implements editorCommo
return
new
Range
(
start
.
lineNumber
,
start
.
column
,
end
.
lineNumber
,
end
.
column
);
}
public
modifyPosition
(
rawPosition
:
editorCommon
.
IPosition
,
offset
:
number
)
:
editorCommon
.
IEditor
Position
{
public
modifyPosition
(
rawPosition
:
editorCommon
.
IPosition
,
offset
:
number
)
:
Position
{
var
position
=
this
.
validatePosition
(
rawPosition
);
// Handle positive offsets, one line at a time
...
...
src/vs/editor/common/model/textModelWithMarkers.ts
浏览文件 @
9de85cbe
...
...
@@ -7,7 +7,7 @@
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IdGenerator
}
from
'
vs/base/common/idGenerator
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
{
I
EditorPosition
,
I
ModelContentChangedFlushEvent
,
IRawText
,
IReadOnlyLineMarker
,
ITextModelWithMarkers
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IModelContentChangedFlushEvent
,
IRawText
,
IReadOnlyLineMarker
,
ITextModelWithMarkers
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ILineMarker
,
ModelLine
}
from
'
vs/editor/common/model/modelLine
'
;
import
{
TextModelWithTokens
}
from
'
vs/editor/common/model/textModelWithTokens
'
;
import
{
IMode
}
from
'
vs/editor/common/modes
'
;
...
...
@@ -135,7 +135,7 @@ export class TextModelWithMarkers extends TextModelWithTokens implements ITextMo
}
}
_getMarker
(
id
:
string
):
IEditor
Position
{
_getMarker
(
id
:
string
):
Position
{
if
(
this
.
_markerIdToMarker
.
hasOwnProperty
(
id
))
{
var
marker
=
this
.
_markerIdToMarker
[
id
];
return
new
Position
(
marker
.
line
.
lineNumber
,
marker
.
column
);
...
...
src/vs/editor/common/model/textModelWithTokens.ts
浏览文件 @
9de85cbe
...
...
@@ -24,6 +24,7 @@ import {BracketsUtils} from 'vs/editor/common/modes/supports/richEditBrackets';
import
{
ModeTransition
}
from
'
vs/editor/common/core/modeTransition
'
;
import
{
LineToken
}
from
'
vs/editor/common/model/lineToken
'
;
import
{
TokensInflatorMap
}
from
'
vs/editor/common/model/tokensBinaryEncoding
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
class
ModeToModelBinder
implements
IDisposable
{
...
...
@@ -411,62 +412,32 @@ export class TextModelWithTokens extends TextModel implements editorCommon.IToke
return
this
.
_lines
[
lineNumber
-
1
].
getTokens
();
}
public
setValue
(
value
:
string
,
newMode
?:
IMode
):
void
;
public
setValue
(
value
:
string
,
newModePromise
?:
TPromise
<
IMode
>
):
void
;
public
setValue
(
value
:
string
,
newModeOrPromise
:
any
=
null
):
void
{
let
rawText
:
editorCommon
.
IRawText
=
null
;
if
(
value
!==
null
)
{
rawText
=
TextModel
.
toRawText
(
value
,
{
tabSize
:
this
.
_options
.
tabSize
,
insertSpaces
:
this
.
_options
.
insertSpaces
,
detectIndentation
:
false
,
defaultEOL
:
this
.
_options
.
defaultEOL
,
trimAutoWhitespace
:
this
.
_options
.
trimAutoWhitespace
});
}
this
.
setValueFromRawText
(
rawText
,
newModeOrPromise
);
}
public
setValueFromRawText
(
value
:
editorCommon
.
IRawText
,
newMode
?:
IMode
):
void
;
public
setValueFromRawText
(
value
:
editorCommon
.
IRawText
,
newModePromise
?:
TPromise
<
IMode
>
):
void
;
public
setValueFromRawText
(
value
:
editorCommon
.
IRawText
,
newModeOrPromise
:
any
=
null
):
void
{
if
(
value
!==
null
)
{
super
.
setValueFromRawText
(
value
);
}
if
(
newModeOrPromise
)
{
if
(
this
.
_modeToModelBinder
)
{
this
.
_modeToModelBinder
.
dispose
();
this
.
_modeToModelBinder
=
null
;
}
if
(
TPromise
.
is
(
newModeOrPromise
))
{
this
.
_modeToModelBinder
=
new
ModeToModelBinder
(
<
TPromise
<
IMode
>>
newModeOrPromise
,
this
);
}
else
{
var
actualNewMode
=
this
.
_massageMode
(
<
IMode
>
newModeOrPromise
);
if
(
this
.
_mode
!==
actualNewMode
)
{
var
e2
:
editorCommon
.
IModelModeChangedEvent
=
{
oldMode
:
this
.
_mode
,
newMode
:
actualNewMode
};
this
.
_resetMode
(
e2
,
actualNewMode
);
this
.
_emitModelModeChangedEvent
(
e2
);
}
}
}
}
public
getMode
():
IMode
{
return
this
.
_mode
;
}
public
setMode
(
newMode
:
IMode
):
void
;
public
setMode
(
newModePromise
:
TPromise
<
IMode
>
):
void
;
public
setMode
(
newModeOrPromise
:
any
):
void
{
public
setMode
(
newModeOrPromise
:
IMode
|
TPromise
<
IMode
>
):
void
{
if
(
!
newModeOrPromise
)
{
// There's nothing to do
return
;
}
this
.
setValueFromRawText
(
null
,
newModeOrPromise
);
if
(
this
.
_modeToModelBinder
)
{
this
.
_modeToModelBinder
.
dispose
();
this
.
_modeToModelBinder
=
null
;
}
if
(
TPromise
.
is
(
newModeOrPromise
))
{
this
.
_modeToModelBinder
=
new
ModeToModelBinder
(
<
TPromise
<
IMode
>>
newModeOrPromise
,
this
);
}
else
{
var
actualNewMode
=
this
.
_massageMode
(
<
IMode
>
newModeOrPromise
);
if
(
this
.
_mode
!==
actualNewMode
)
{
var
e2
:
editorCommon
.
IModelModeChangedEvent
=
{
oldMode
:
this
.
_mode
,
newMode
:
actualNewMode
};
this
.
_resetMode
(
e2
,
actualNewMode
);
this
.
_emitModelModeChangedEvent
(
e2
);
}
}
}
public
getModeAtPosition
(
_lineNumber
:
number
,
_column
:
number
):
IMode
{
...
...
@@ -809,7 +780,7 @@ export class TextModelWithTokens extends TextModel implements editorCommon.IToke
return
this
.
_matchBracket
(
this
.
validatePosition
(
position
));
}
private
_matchBracket
(
position
:
editorCommon
.
IEditor
Position
):
[
editorCommon
.
IEditorRange
,
editorCommon
.
IEditorRange
]
{
private
_matchBracket
(
position
:
Position
):
[
editorCommon
.
IEditorRange
,
editorCommon
.
IEditorRange
]
{
let
lineNumber
=
position
.
lineNumber
;
let
lineText
=
this
.
_lines
[
lineNumber
-
1
].
text
;
...
...
@@ -913,7 +884,7 @@ export class TextModelWithTokens extends TextModel implements editorCommon.IToke
return
null
;
}
private
_findMatchingBracketUp
(
bracket
:
editorCommon
.
IRichEditBracket
,
position
:
editorCommon
.
IEditor
Position
):
Range
{
private
_findMatchingBracketUp
(
bracket
:
editorCommon
.
IRichEditBracket
,
position
:
Position
):
Range
{
// console.log('_findMatchingBracketUp: ', 'bracket: ', JSON.stringify(bracket), 'startPosition: ', String(position));
let
modeId
=
bracket
.
modeId
;
...
...
@@ -980,7 +951,7 @@ export class TextModelWithTokens extends TextModel implements editorCommon.IToke
return
null
;
}
private
_findMatchingBracketDown
(
bracket
:
editorCommon
.
IRichEditBracket
,
position
:
editorCommon
.
IEditor
Position
):
Range
{
private
_findMatchingBracketDown
(
bracket
:
editorCommon
.
IRichEditBracket
,
position
:
Position
):
Range
{
// console.log('_findMatchingBracketDown: ', 'bracket: ', JSON.stringify(bracket), 'startPosition: ', String(position));
let
modeId
=
bracket
.
modeId
;
...
...
src/vs/editor/common/model/textModelWithTrackedRanges.ts
浏览文件 @
9de85cbe
...
...
@@ -12,6 +12,7 @@ import {ILineMarker} from 'vs/editor/common/model/modelLine';
import
{
INewMarker
,
TextModelWithMarkers
}
from
'
vs/editor/common/model/textModelWithMarkers
'
;
import
{
FullModelRetokenizer
,
IRetokenizeRequest
}
from
'
vs/editor/common/model/textModelWithTokens
'
;
import
{
IMode
}
from
'
vs/editor/common/modes
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
interface
ITrackedRange
{
id
:
string
;
...
...
@@ -256,7 +257,7 @@ export class TextModelWithTrackedRanges extends TextModelWithMarkers implements
}
}
private
_newEditorRange
(
startPosition
:
editorCommon
.
IEditorPosition
,
endPosition
:
editorCommon
.
IEditor
Position
):
editorCommon
.
IEditorRange
{
private
_newEditorRange
(
startPosition
:
Position
,
endPosition
:
Position
):
editorCommon
.
IEditorRange
{
if
(
endPosition
.
isBefore
(
startPosition
))
{
// This tracked range has turned in on itself (end marker before start marker)
// This can happen in extreme editing conditions where lots of text is removed and lots is added
...
...
@@ -314,8 +315,8 @@ export class TextModelWithTrackedRanges extends TextModelWithMarkers implements
i
:
number
,
len
:
number
,
lineNumber
:
number
,
startMarker
:
editorCommon
.
IEditor
Position
,
endMarker
:
editorCommon
.
IEditor
Position
;
startMarker
:
Position
,
endMarker
:
Position
;
for
(
i
=
0
,
len
=
result
.
length
;
i
<
len
;
i
++
)
{
resultMap
[
result
[
i
].
id
]
=
true
;
...
...
src/vs/editor/common/modes.ts
浏览文件 @
9de85cbe
...
...
@@ -13,6 +13,7 @@ import * as editorCommon from 'vs/editor/common/editorCommon';
import
{
ModeTransition
}
from
'
vs/editor/common/core/modeTransition
'
;
import
LanguageFeatureRegistry
from
'
vs/editor/common/modes/languageFeatureRegistry
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
export
interface
ITokenizationResult
{
type
?:
string
;
...
...
@@ -291,7 +292,7 @@ export interface Hover {
}
export
interface
HoverProvider
{
provideHover
(
model
:
editorCommon
.
IReadOnlyModel
,
position
:
editorCommon
.
IEditor
Position
,
token
:
CancellationToken
):
Hover
|
Thenable
<
Hover
>
;
provideHover
(
model
:
editorCommon
.
IReadOnlyModel
,
position
:
Position
,
token
:
CancellationToken
):
Hover
|
Thenable
<
Hover
>
;
}
export
type
SuggestionType
=
'
method
'
...
...
@@ -341,9 +342,9 @@ export interface ISuggestSupport {
filter
?:
IFilter
;
provideCompletionItems
(
model
:
editorCommon
.
IReadOnlyModel
,
position
:
editorCommon
.
IEditor
Position
,
token
:
CancellationToken
):
ISuggestResult
[]
|
Thenable
<
ISuggestResult
[]
>
;
provideCompletionItems
(
model
:
editorCommon
.
IReadOnlyModel
,
position
:
Position
,
token
:
CancellationToken
):
ISuggestResult
[]
|
Thenable
<
ISuggestResult
[]
>
;
resolveCompletionItem
?(
model
:
editorCommon
.
IReadOnlyModel
,
position
:
editorCommon
.
IEditor
Position
,
item
:
ISuggestion
,
token
:
CancellationToken
):
ISuggestion
|
Thenable
<
ISuggestion
>
;
resolveCompletionItem
?(
model
:
editorCommon
.
IReadOnlyModel
,
position
:
Position
,
item
:
ISuggestion
,
token
:
CancellationToken
):
ISuggestion
|
Thenable
<
ISuggestion
>
;
}
/**
...
...
@@ -376,7 +377,7 @@ export interface SignatureHelpProvider {
signatureHelpTriggerCharacters
:
string
[];
provideSignatureHelp
(
model
:
editorCommon
.
IReadOnlyModel
,
position
:
editorCommon
.
IEditor
Position
,
token
:
CancellationToken
):
SignatureHelp
|
Thenable
<
SignatureHelp
>
;
provideSignatureHelp
(
model
:
editorCommon
.
IReadOnlyModel
,
position
:
Position
,
token
:
CancellationToken
):
SignatureHelp
|
Thenable
<
SignatureHelp
>
;
}
...
...
@@ -390,7 +391,7 @@ export interface DocumentHighlight {
kind
:
DocumentHighlightKind
;
}
export
interface
DocumentHighlightProvider
{
provideDocumentHighlights
(
model
:
editorCommon
.
IReadOnlyModel
,
position
:
editorCommon
.
IEditor
Position
,
token
:
CancellationToken
):
DocumentHighlight
[]
|
Thenable
<
DocumentHighlight
[]
>
;
provideDocumentHighlights
(
model
:
editorCommon
.
IReadOnlyModel
,
position
:
Position
,
token
:
CancellationToken
):
DocumentHighlight
[]
|
Thenable
<
DocumentHighlight
[]
>
;
}
...
...
@@ -398,7 +399,7 @@ export interface ReferenceContext {
includeDeclaration
:
boolean
;
}
export
interface
ReferenceProvider
{
provideReferences
(
model
:
editorCommon
.
IReadOnlyModel
,
position
:
editorCommon
.
IEditor
Position
,
context
:
ReferenceContext
,
token
:
CancellationToken
):
Location
[]
|
Thenable
<
Location
[]
>
;
provideReferences
(
model
:
editorCommon
.
IReadOnlyModel
,
position
:
Position
,
context
:
ReferenceContext
,
token
:
CancellationToken
):
Location
[]
|
Thenable
<
Location
[]
>
;
}
...
...
@@ -408,7 +409,7 @@ export class Location {
}
export
type
Definition
=
Location
|
Location
[];
export
interface
DefinitionProvider
{
provideDefinition
(
model
:
editorCommon
.
IReadOnlyModel
,
position
:
editorCommon
.
IEditor
Position
,
token
:
CancellationToken
):
Definition
|
Thenable
<
Definition
>
;
provideDefinition
(
model
:
editorCommon
.
IReadOnlyModel
,
position
:
Position
,
token
:
CancellationToken
):
Definition
|
Thenable
<
Definition
>
;
}
export
enum
SymbolKind
{
...
...
@@ -551,7 +552,7 @@ export interface DocumentRangeFormattingEditProvider {
}
export
interface
OnTypeFormattingEditProvider
{
autoFormatTriggerCharacters
:
string
[];
provideOnTypeFormattingEdits
(
model
:
editorCommon
.
IReadOnlyModel
,
position
:
editorCommon
.
IEditor
Position
,
ch
:
string
,
options
:
IFormattingOptions
,
token
:
CancellationToken
):
editorCommon
.
ISingleEditOperation
[]
|
Thenable
<
editorCommon
.
ISingleEditOperation
[]
>
;
provideOnTypeFormattingEdits
(
model
:
editorCommon
.
IReadOnlyModel
,
position
:
Position
,
ch
:
string
,
options
:
IFormattingOptions
,
token
:
CancellationToken
):
editorCommon
.
ISingleEditOperation
[]
|
Thenable
<
editorCommon
.
ISingleEditOperation
[]
>
;
}
...
...
@@ -607,7 +608,7 @@ export interface WorkspaceEdit {
rejectReason
?:
string
;
}
export
interface
RenameProvider
{
provideRenameEdits
(
model
:
editorCommon
.
IReadOnlyModel
,
position
:
editorCommon
.
IEditor
Position
,
newName
:
string
,
token
:
CancellationToken
):
WorkspaceEdit
|
Thenable
<
WorkspaceEdit
>
;
provideRenameEdits
(
model
:
editorCommon
.
IReadOnlyModel
,
position
:
Position
,
newName
:
string
,
token
:
CancellationToken
):
WorkspaceEdit
|
Thenable
<
WorkspaceEdit
>
;
}
...
...
src/vs/editor/common/modes/supports/suggestSupport.ts
浏览文件 @
9de85cbe
...
...
@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
IReadOnlyModel
,
IEditorPosition
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IReadOnlyModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ISuggestResult
,
ISuggestSupport
}
from
'
vs/editor/common/modes
'
;
import
{
IFilter
,
matchesStrictPrefix
,
fuzzyContiguousFilter
}
from
'
vs/base/common/filters
'
;
import
{
IEditorWorkerService
}
from
'
vs/editor/common/services/editorWorkerService
'
;
...
...
@@ -14,6 +14,7 @@ import {Registry} from 'vs/platform/platform';
import
{
localize
}
from
'
vs/nls
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
wireCancellationToken
}
from
'
vs/base/common/async
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
export
class
TextualSuggestSupport
implements
ISuggestSupport
{
...
...
@@ -52,7 +53,7 @@ export class TextualSuggestSupport implements ISuggestSupport {
this
.
_configurationService
=
configurationService
;
}
public
provideCompletionItems
(
model
:
IReadOnlyModel
,
position
:
IEditor
Position
,
token
:
CancellationToken
):
ISuggestResult
[]
|
Thenable
<
ISuggestResult
[]
>
{
public
provideCompletionItems
(
model
:
IReadOnlyModel
,
position
:
Position
,
token
:
CancellationToken
):
ISuggestResult
[]
|
Thenable
<
ISuggestResult
[]
>
{
let
config
=
this
.
_configurationService
.
getConfiguration
<
{
wordBasedSuggestions
:
boolean
}
>
(
'
editor
'
);
if
(
!
config
||
config
.
wordBasedSuggestions
)
{
return
wireCancellationToken
(
token
,
this
.
_editorWorkerService
.
textualSuggest
(
model
.
uri
,
position
));
...
...
src/vs/editor/common/viewModel/splitLinesCollection.ts
浏览文件 @
9de85cbe
...
...
@@ -50,7 +50,7 @@ export interface ISplitLine {
getOutputLineMaxColumn
(
model
:
IModel
,
myLineNumber
:
number
,
outputLineIndex
:
number
):
number
;
getOutputLineTokens
(
model
:
IModel
,
myLineNumber
:
number
,
outputLineIndex
:
number
):
ViewLineTokens
;
getInputColumnOfOutputPosition
(
outputLineIndex
:
number
,
outputColumn
:
number
):
number
;
getOutputPositionOfInputPosition
(
deltaLineNumber
:
number
,
inputColumn
:
number
):
editorCommon
.
IEditor
Position
;
getOutputPositionOfInputPosition
(
deltaLineNumber
:
number
,
inputColumn
:
number
):
Position
;
}
class
IdentitySplitLine
implements
ISplitLine
{
...
...
@@ -111,7 +111,7 @@ class IdentitySplitLine implements ISplitLine {
return
outputColumn
;
}
public
getOutputPositionOfInputPosition
(
deltaLineNumber
:
number
,
inputColumn
:
number
):
editorCommon
.
IEditor
Position
{
public
getOutputPositionOfInputPosition
(
deltaLineNumber
:
number
,
inputColumn
:
number
):
Position
{
if
(
!
this
.
_isVisible
)
{
throw
new
Error
(
'
Not supported
'
);
}
...
...
@@ -223,7 +223,7 @@ export class SplitLine implements ISplitLine {
return
this
.
positionMapper
.
getInputOffsetOfOutputPosition
(
outputLineIndex
,
adjustedColumn
)
+
1
;
}
public
getOutputPositionOfInputPosition
(
deltaLineNumber
:
number
,
inputColumn
:
number
):
editorCommon
.
IEditor
Position
{
public
getOutputPositionOfInputPosition
(
deltaLineNumber
:
number
,
inputColumn
:
number
):
Position
{
if
(
!
this
.
_isVisible
)
{
throw
new
Error
(
'
Not supported
'
);
}
...
...
@@ -663,7 +663,7 @@ export class SplitLinesCollection implements ILinesCollection {
return
this
.
lines
[
lineIndex
].
getOutputLineTokens
(
this
.
model
,
lineIndex
+
1
,
remainder
);
}
public
convertOutputPositionToInputPosition
(
viewLineNumber
:
number
,
viewColumn
:
number
):
editorCommon
.
IEditor
Position
{
public
convertOutputPositionToInputPosition
(
viewLineNumber
:
number
,
viewColumn
:
number
):
Position
{
this
.
_ensureValidState
();
viewLineNumber
=
this
.
_toValidOutputLineNumber
(
viewLineNumber
);
...
...
@@ -676,7 +676,7 @@ export class SplitLinesCollection implements ILinesCollection {
return
this
.
model
.
validatePosition
(
new
Position
(
lineIndex
+
1
,
inputColumn
));
}
public
convertInputPositionToOutputPosition
(
_inputLineNumber
:
number
,
_inputColumn
:
number
):
editorCommon
.
IEditor
Position
{
public
convertInputPositionToOutputPosition
(
_inputLineNumber
:
number
,
_inputColumn
:
number
):
Position
{
this
.
_ensureValidState
();
let
validPosition
=
this
.
model
.
validatePosition
(
new
Position
(
_inputLineNumber
,
_inputColumn
));
...
...
@@ -695,7 +695,7 @@ export class SplitLinesCollection implements ILinesCollection {
}
let
deltaLineNumber
=
1
+
(
lineIndex
===
0
?
0
:
this
.
prefixSumComputer
.
getAccumulatedValue
(
lineIndex
-
1
));
let
r
:
editorCommon
.
IEditor
Position
;
let
r
:
Position
;
if
(
lineIndexChanged
)
{
r
=
this
.
lines
[
lineIndex
].
getOutputPositionOfInputPosition
(
deltaLineNumber
,
this
.
model
.
getLineMaxColumn
(
lineIndex
+
1
));
}
else
{
...
...
src/vs/editor/common/viewModel/viewModel.ts
浏览文件 @
9de85cbe
...
...
@@ -5,8 +5,9 @@
'
use strict
'
;
import
{
IEventEmitter
}
from
'
vs/base/common/eventEmitter
'
;
import
{
IModelDecoration
,
IRange
,
IEditorRange
,
EndOfLinePreference
,
IEditorSelection
,
IPosition
,
IEditorPosition
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IModelDecoration
,
IRange
,
IEditorRange
,
EndOfLinePreference
,
IEditorSelection
,
IPosition
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ViewLineTokens
}
from
'
vs/editor/common/core/viewLineToken
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
export
interface
IDecorationsViewportData
{
decorations
:
IModelDecoration
[];
...
...
@@ -32,13 +33,13 @@ export interface IViewModel extends IEventEmitter {
getSelections
():
IEditorSelection
[];
convertViewPositionToModelPosition
(
viewLineNumber
:
number
,
viewColumn
:
number
):
IEditor
Position
;
convertViewPositionToModelPosition
(
viewLineNumber
:
number
,
viewColumn
:
number
):
Position
;
convertViewRangeToModelRange
(
viewRange
:
IRange
):
IEditorRange
;
getModelLineContent
(
lineNumber
:
number
):
string
;
getModelLineMaxColumn
(
modelLineNumber
:
number
):
number
;
validateModelPosition
(
position
:
IPosition
):
IEditor
Position
;
convertModelPositionToViewPosition
(
modelLineNumber
:
number
,
modelColumn
:
number
):
IEditor
Position
;
validateModelPosition
(
position
:
IPosition
):
Position
;
convertModelPositionToViewPosition
(
modelLineNumber
:
number
,
modelColumn
:
number
):
Position
;
convertModelSelectionToViewSelection
(
modelSelection
:
IEditorSelection
):
IEditorSelection
;
modelPositionIsVisible
(
position
:
IPosition
):
boolean
;
}
src/vs/editor/common/viewModel/viewModelCursors.ts
浏览文件 @
9de85cbe
...
...
@@ -7,9 +7,10 @@
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
Selection
}
from
'
vs/editor/common/core/selection
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
export
interface
IConverter
{
validateViewPosition
(
viewLineNumber
:
number
,
viewColumn
:
number
,
modelPosition
:
editorCommon
.
IEditorPosition
):
editorCommon
.
IEditor
Position
;
validateViewPosition
(
viewLineNumber
:
number
,
viewColumn
:
number
,
modelPosition
:
Position
):
Position
;
validateViewSelection
(
viewSelection
:
editorCommon
.
IEditorSelection
,
modelSelection
:
editorCommon
.
IEditorSelection
):
editorCommon
.
IEditorSelection
;
convertModelSelectionToViewSelection
(
modelSelection
:
editorCommon
.
IEditorSelection
):
editorCommon
.
IEditorSelection
;
convertModelRangeToViewRange
(
modelRange
:
editorCommon
.
IRange
):
editorCommon
.
IEditorRange
;
...
...
@@ -54,7 +55,7 @@ export class ViewModelCursors {
position
=
position
.
clone
();
position
.
column
=
stopRenderingLineAfter
;
}
var
secondaryPositions
:
editorCommon
.
IEditor
Position
[]
=
[];
var
secondaryPositions
:
Position
[]
=
[];
for
(
var
i
=
0
,
len
=
e
.
secondaryPositions
.
length
;
i
<
len
;
i
++
)
{
secondaryPositions
[
i
]
=
this
.
converter
.
validateViewPosition
(
e
.
secondaryViewPositions
[
i
].
lineNumber
,
e
.
secondaryViewPositions
[
i
].
column
,
e
.
secondaryPositions
[
i
]);
// Limit position to be somewhere where it can actually be rendered
...
...
src/vs/editor/common/viewModel/viewModelImpl.ts
浏览文件 @
9de85cbe
...
...
@@ -30,8 +30,8 @@ export interface ILinesCollection {
getOutputLineMinColumn
(
outputLineNumber
:
number
):
number
;
getOutputLineMaxColumn
(
outputLineNumber
:
number
):
number
;
getOutputLineTokens
(
outputLineNumber
:
number
):
ViewLineTokens
;
convertOutputPositionToInputPosition
(
viewLineNumber
:
number
,
viewColumn
:
number
):
editorCommon
.
IEditor
Position
;
convertInputPositionToOutputPosition
(
inputLineNumber
:
number
,
inputColumn
:
number
):
editorCommon
.
IEditor
Position
;
convertOutputPositionToInputPosition
(
viewLineNumber
:
number
,
viewColumn
:
number
):
Position
;
convertInputPositionToOutputPosition
(
inputLineNumber
:
number
,
inputColumn
:
number
):
Position
;
setHiddenAreas
(
ranges
:
editorCommon
.
IRange
[],
emit
:(
evenType
:
string
,
payload
:
any
)
=>
void
):
void
;
inputPositionIsVisible
(
inputLineNumber
:
number
,
inputColumn
:
number
):
boolean
;
dispose
():
void
;
...
...
@@ -322,7 +322,7 @@ export class ViewModel extends EventEmitter implements IViewModel {
return
new
Range
(
validViewStart
.
lineNumber
,
validViewStart
.
column
,
validViewEnd
.
lineNumber
,
validViewEnd
.
column
);
}
public
validateViewPosition
(
viewLineNumber
:
number
,
viewColumn
:
number
,
modelPosition
:
editorCommon
.
IEditorPosition
):
editorCommon
.
IEditor
Position
{
public
validateViewPosition
(
viewLineNumber
:
number
,
viewColumn
:
number
,
modelPosition
:
Position
):
Position
{
if
(
viewLineNumber
<
1
)
{
viewLineNumber
=
1
;
}
...
...
@@ -446,7 +446,7 @@ export class ViewModel extends EventEmitter implements IViewModel {
// View -> Model conversion and related methods
public
convertViewPositionToModelPosition
(
viewLineNumber
:
number
,
viewColumn
:
number
):
editorCommon
.
IEditor
Position
{
public
convertViewPositionToModelPosition
(
viewLineNumber
:
number
,
viewColumn
:
number
):
Position
{
return
this
.
lines
.
convertOutputPositionToInputPosition
(
viewLineNumber
,
viewColumn
);
}
...
...
@@ -472,11 +472,11 @@ export class ViewModel extends EventEmitter implements IViewModel {
return
this
.
model
.
getLineMaxColumn
(
modelLineNumber
);
}
public
validateModelPosition
(
position
:
editorCommon
.
IPosition
):
editorCommon
.
IEditor
Position
{
public
validateModelPosition
(
position
:
editorCommon
.
IPosition
):
Position
{
return
this
.
model
.
validatePosition
(
position
);
}
public
convertModelPositionToViewPosition
(
modelLineNumber
:
number
,
modelColumn
:
number
):
editorCommon
.
IEditor
Position
{
public
convertModelPositionToViewPosition
(
modelLineNumber
:
number
,
modelColumn
:
number
):
Position
{
return
this
.
lines
.
convertInputPositionToOutputPosition
(
modelLineNumber
,
modelColumn
);
}
...
...
src/vs/editor/contrib/find/common/findDecorations.ts
浏览文件 @
9de85cbe
...
...
@@ -6,6 +6,7 @@
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
export
class
FindDecorations
implements
IDisposable
{
...
...
@@ -13,7 +14,7 @@ export class FindDecorations implements IDisposable {
private
_decorations
:
string
[];
private
_findScopeDecorationId
:
string
;
private
_highlightedDecorationId
:
string
;
private
_startPosition
:
editorCommon
.
IEditor
Position
;
private
_startPosition
:
Position
;
constructor
(
editor
:
editorCommon
.
ICommonCodeEditor
)
{
this
.
_editor
=
editor
;
...
...
@@ -50,11 +51,11 @@ export class FindDecorations implements IDisposable {
return
null
;
}
public
getStartPosition
():
editorCommon
.
IEditor
Position
{
public
getStartPosition
():
Position
{
return
this
.
_startPosition
;
}
public
setStartPosition
(
newStartPosition
:
editorCommon
.
IEditor
Position
):
void
{
public
setStartPosition
(
newStartPosition
:
Position
):
void
{
this
.
_startPosition
=
newStartPosition
;
this
.
setCurrentFindMatch
(
null
);
}
...
...
src/vs/editor/contrib/find/common/findModel.ts
浏览文件 @
9de85cbe
...
...
@@ -153,7 +153,7 @@ export class FindModelBoundToEditorModel {
return
false
;
}
private
_moveToPrevMatch
(
before
:
editorCommon
.
IEditor
Position
,
isRecursed
:
boolean
=
false
):
void
{
private
_moveToPrevMatch
(
before
:
Position
,
isRecursed
:
boolean
=
false
):
void
{
if
(
this
.
_cannotFind
())
{
return
;
}
...
...
@@ -220,7 +220,7 @@ export class FindModelBoundToEditorModel {
this
.
_moveToPrevMatch
(
this
.
_editor
.
getSelection
().
getStartPosition
());
}
public
_moveToNextMatch
(
after
:
editorCommon
.
IEditor
Position
,
isRecursed
:
boolean
=
false
):
void
{
public
_moveToNextMatch
(
after
:
Position
,
isRecursed
:
boolean
=
false
):
void
{
if
(
this
.
_cannotFind
())
{
return
;
}
...
...
src/vs/editor/contrib/format/common/format.ts
浏览文件 @
9de85cbe
...
...
@@ -9,11 +9,12 @@ import {illegalArgument} from 'vs/base/common/errors';
import
URI
from
'
vs/base/common/uri
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
IReadOnlyModel
,
IEditor
Position
,
IEditor
Range
,
ISingleEditOperation
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IReadOnlyModel
,
IEditorRange
,
ISingleEditOperation
}
from
'
vs/editor/common/editorCommon
'
;
import
{
CommonEditorRegistry
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
DocumentFormattingEditProviderRegistry
,
DocumentRangeFormattingEditProviderRegistry
,
OnTypeFormattingEditProviderRegistry
,
IFormattingOptions
}
from
'
vs/editor/common/modes
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
asWinJsPromise
}
from
'
vs/base/common/async
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
export
function
getDocumentRangeFormattingEdits
(
model
:
IReadOnlyModel
,
range
:
IEditorRange
,
options
:
IFormattingOptions
):
TPromise
<
ISingleEditOperation
[]
>
{
const
[
support
]
=
DocumentRangeFormattingEditProviderRegistry
.
ordered
(
model
);
...
...
@@ -38,7 +39,7 @@ export function getDocumentFormattingEdits(model: IReadOnlyModel, options: IForm
});
}
export
function
getOnTypeFormattingEdits
(
model
:
IReadOnlyModel
,
position
:
IEditor
Position
,
ch
:
string
,
options
:
IFormattingOptions
):
TPromise
<
ISingleEditOperation
[]
>
{
export
function
getOnTypeFormattingEdits
(
model
:
IReadOnlyModel
,
position
:
Position
,
ch
:
string
,
options
:
IFormattingOptions
):
TPromise
<
ISingleEditOperation
[]
>
{
const
[
support
]
=
OnTypeFormattingEditProviderRegistry
.
ordered
(
model
);
if
(
!
support
)
{
return
TPromise
.
as
(
undefined
);
...
...
src/vs/editor/contrib/goToDeclaration/common/goToDeclaration.ts
浏览文件 @
9de85cbe
...
...
@@ -7,13 +7,14 @@
import
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IReadOnlyModel
,
IEditorPosition
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IReadOnlyModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
CommonEditorRegistry
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
DefinitionProviderRegistry
}
from
'
vs/editor/common/modes
'
;
import
{
Location
}
from
'
vs/editor/common/modes
'
;
import
{
asWinJsPromise
}
from
'
vs/base/common/async
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
export
function
getDeclarationsAtPosition
(
model
:
IReadOnlyModel
,
position
:
IEditor
Position
):
TPromise
<
Location
[]
>
{
export
function
getDeclarationsAtPosition
(
model
:
IReadOnlyModel
,
position
:
Position
):
TPromise
<
Location
[]
>
{
const
provider
=
DefinitionProviderRegistry
.
ordered
(
model
);
...
...
src/vs/editor/contrib/hover/browser/hoverWidgets.ts
浏览文件 @
9de85cbe
...
...
@@ -8,7 +8,7 @@ import {CommonKeybindings} from 'vs/base/common/keyCodes';
import
{
IKeyboardEvent
}
from
'
vs/base/browser/keyboardEvent
'
;
import
{
StyleMutator
}
from
'
vs/base/browser/styleMutator
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
{
I
EditorPosition
,
I
Position
,
IConfigurationChangedEvent
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IPosition
,
IConfigurationChangedEvent
}
from
'
vs/editor/common/editorCommon
'
;
import
*
as
editorBrowser
from
'
vs/editor/browser/editorBrowser
'
;
import
{
Widget
}
from
'
vs/base/browser/ui/widget
'
;
...
...
@@ -19,7 +19,7 @@ export class ContentHoverWidget extends Widget implements editorBrowser.IContent
protected
_isVisible
:
boolean
;
private
_containerDomNode
:
HTMLElement
;
protected
_domNode
:
HTMLElement
;
protected
_showAtPosition
:
IEditor
Position
;
protected
_showAtPosition
:
Position
;
private
_stoleFocus
:
boolean
;
// Editor.IContentWidget.allowEditorOverflow
...
...
src/vs/editor/contrib/hover/common/hover.ts
浏览文件 @
9de85cbe
...
...
@@ -8,12 +8,13 @@
import
{
coalesce
}
from
'
vs/base/common/arrays
'
;
import
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IReadOnlyModel
,
IEditorPosition
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IReadOnlyModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
CommonEditorRegistry
}
from
'
vs/editor/common/editorCommonExtensions
'
;
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
:
IReadOnlyModel
,
position
:
IEditor
Position
):
TPromise
<
Hover
[]
>
{
export
function
getHover
(
model
:
IReadOnlyModel
,
position
:
Position
):
TPromise
<
Hover
[]
>
{
const
supports
=
HoverProviderRegistry
.
ordered
(
model
);
const
values
:
Hover
[]
=
[];
...
...
src/vs/editor/contrib/parameterHints/common/parameterHints.ts
浏览文件 @
9de85cbe
...
...
@@ -6,12 +6,13 @@
'
use strict
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IReadOnlyModel
,
IEditorPosition
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IReadOnlyModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
CommonEditorRegistry
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
SignatureHelp
,
SignatureHelpProviderRegistry
}
from
'
vs/editor/common/modes
'
;
import
{
asWinJsPromise
}
from
'
vs/base/common/async
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
export
function
provideSignatureHelp
(
model
:
IReadOnlyModel
,
position
:
IEditor
Position
):
TPromise
<
SignatureHelp
>
{
export
function
provideSignatureHelp
(
model
:
IReadOnlyModel
,
position
:
Position
):
TPromise
<
SignatureHelp
>
{
let
support
=
SignatureHelpProviderRegistry
.
ordered
(
model
)[
0
];
if
(
!
support
)
{
...
...
src/vs/editor/contrib/referenceSearch/common/referenceSearch.ts
浏览文件 @
9de85cbe
...
...
@@ -7,12 +7,13 @@
import
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IReadOnlyModel
,
IEditorPosition
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IReadOnlyModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
CommonEditorRegistry
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
Location
,
ReferenceProviderRegistry
}
from
'
vs/editor/common/modes
'
;
import
{
asWinJsPromise
}
from
'
vs/base/common/async
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
export
function
provideReferences
(
model
:
IReadOnlyModel
,
position
:
IEditor
Position
):
TPromise
<
Location
[]
>
{
export
function
provideReferences
(
model
:
IReadOnlyModel
,
position
:
Position
):
TPromise
<
Location
[]
>
{
// collect references from all providers
const
promises
=
ReferenceProviderRegistry
.
ordered
(
model
).
map
(
provider
=>
{
...
...
src/vs/editor/contrib/rename/common/rename.ts
浏览文件 @
9de85cbe
...
...
@@ -9,11 +9,12 @@ import {localize} from 'vs/nls';
import
{
sequence
,
asWinJsPromise
}
from
'
vs/base/common/async
'
;
import
{
illegalArgument
}
from
'
vs/base/common/errors
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IReadOnlyModel
,
IEditorPosition
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IReadOnlyModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
CommonEditorRegistry
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
WorkspaceEdit
,
RenameProviderRegistry
}
from
'
vs/editor/common/modes
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
export
function
rename
(
model
:
IReadOnlyModel
,
position
:
IEditor
Position
,
newName
:
string
):
TPromise
<
WorkspaceEdit
>
{
export
function
rename
(
model
:
IReadOnlyModel
,
position
:
Position
,
newName
:
string
):
TPromise
<
WorkspaceEdit
>
{
const
supports
=
RenameProviderRegistry
.
ordered
(
model
);
const
rejects
:
string
[]
=
[];
...
...
src/vs/editor/contrib/suggest/browser/completionModel.ts
浏览文件 @
9de85cbe
...
...
@@ -8,11 +8,12 @@
import
{
isFalsyOrEmpty
}
from
'
vs/base/common/arrays
'
;
import
{
assign
}
from
'
vs/base/common/objects
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IReadOnlyModel
,
IEditorPosition
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IReadOnlyModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IFilter
,
IMatch
,
fuzzyContiguousFilter
}
from
'
vs/base/common/filters
'
;
import
{
ISuggestResult
,
ISuggestSupport
,
ISuggestion
}
from
'
vs/editor/common/modes
'
;
import
{
ISuggestResult2
}
from
'
../common/suggest
'
;
import
{
asWinJsPromise
}
from
'
vs/base/common/async
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
export
class
CompletionItem
{
...
...
@@ -30,7 +31,7 @@ export class CompletionItem {
this
.
filter
=
container
.
support
&&
container
.
support
.
filter
||
fuzzyContiguousFilter
;
}
resolveDetails
(
model
:
IReadOnlyModel
,
position
:
IEditor
Position
):
TPromise
<
ISuggestion
>
{
resolveDetails
(
model
:
IReadOnlyModel
,
position
:
Position
):
TPromise
<
ISuggestion
>
{
if
(
!
this
.
_support
||
typeof
this
.
_support
.
resolveCompletionItem
!==
'
function
'
)
{
return
TPromise
.
as
(
this
.
suggestion
);
}
...
...
src/vs/editor/contrib/suggest/browser/suggestModel.ts
浏览文件 @
9de85cbe
...
...
@@ -9,7 +9,7 @@ import Event, { Emitter } from 'vs/base/common/event';
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
startsWith
}
from
'
vs/base/common/strings
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
ICommonCodeEditor
,
ICursorSelectionChangedEvent
,
IEditorPosition
,
CursorChangeReason
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ICommonCodeEditor
,
ICursorSelectionChangedEvent
,
CursorChangeReason
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ISuggestSupport
,
ISuggestion
,
SuggestRegistry
}
from
'
vs/editor/common/modes
'
;
import
{
CodeSnippet
}
from
'
vs/editor/contrib/snippet/common/snippet
'
;
import
{
ISuggestResult2
,
provideCompletionItems
}
from
'
../common/suggest
'
;
...
...
@@ -229,7 +229,7 @@ export class SuggestModel implements IDisposable {
return
actuallyCanceled
;
}
public
getRequestPosition
():
IEditor
Position
{
public
getRequestPosition
():
Position
{
if
(
!
this
.
context
)
{
return
null
;
}
...
...
src/vs/editor/contrib/suggest/common/suggest.ts
浏览文件 @
9de85cbe
...
...
@@ -8,10 +8,11 @@ import {sequence, asWinJsPromise} from 'vs/base/common/async';
import
{
isFalsyOrEmpty
}
from
'
vs/base/common/arrays
'
;
import
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IReadOnlyModel
,
IEditorPosition
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IReadOnlyModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
CommonEditorRegistry
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
ISuggestResult
,
ISuggestSupport
,
SuggestRegistry
}
from
'
vs/editor/common/modes
'
;
import
{
SnippetsRegistry
}
from
'
vs/editor/common/modes/supports
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
export
var
CONTEXT_SUGGEST_WIDGET_VISIBLE
=
'
suggestWidgetVisible
'
;
export
var
CONTEXT_SUGGESTION_SUPPORTS_ACCEPT_ON_KEY
=
'
suggestionSupportsAcceptOnKey
'
;
...
...
@@ -21,7 +22,7 @@ export interface ISuggestResult2 extends ISuggestResult {
support
?:
ISuggestSupport
;
}
export
function
provideCompletionItems
(
model
:
IReadOnlyModel
,
position
:
IEditor
Position
,
groups
?:
ISuggestSupport
[][]):
TPromise
<
ISuggestResult2
[]
>
{
export
function
provideCompletionItems
(
model
:
IReadOnlyModel
,
position
:
Position
,
groups
?:
ISuggestSupport
[][]):
TPromise
<
ISuggestResult2
[]
>
{
if
(
!
groups
)
{
groups
=
SuggestRegistry
.
orderedGroups
(
model
);
...
...
src/vs/editor/contrib/wordHighlighter/common/wordHighlighter.ts
浏览文件 @
9de85cbe
...
...
@@ -12,8 +12,9 @@ import * as editorCommon from 'vs/editor/common/editorCommon';
import
{
CommonEditorRegistry
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
DocumentHighlight
,
DocumentHighlightKind
,
DocumentHighlightProviderRegistry
}
from
'
vs/editor/common/modes
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
export
function
getOccurrencesAtPosition
(
model
:
editorCommon
.
IReadOnlyModel
,
position
:
editorCommon
.
IEditor
Position
):
TPromise
<
DocumentHighlight
[]
>
{
export
function
getOccurrencesAtPosition
(
model
:
editorCommon
.
IReadOnlyModel
,
position
:
Position
):
TPromise
<
DocumentHighlight
[]
>
{
const
orderedByScore
=
DocumentHighlightProviderRegistry
.
ordered
(
model
);
let
foundResult
=
false
;
...
...
src/vs/editor/test/common/controller/textAreaState.test.ts
浏览文件 @
9de85cbe
...
...
@@ -8,7 +8,7 @@ import * as assert from 'assert';
import
{
IENarratorTextAreaState
,
ISimpleModel
,
TextAreaState
}
from
'
vs/editor/common/controller/textAreaState
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
EndOfLinePreference
,
I
EditorPosition
,
I
Range
}
from
'
vs/editor/common/editorCommon
'
;
import
{
EndOfLinePreference
,
IRange
}
from
'
vs/editor/common/editorCommon
'
;
import
{
MockTextAreaWrapper
}
from
'
vs/editor/test/common/mocks/mockTextAreaWrapper
'
;
suite
(
'
TextAreaState
'
,
()
=>
{
...
...
@@ -467,7 +467,7 @@ class SimpleModel implements ISimpleModel {
return
this
.
_lines
.
length
;
}
public
convertViewPositionToModelPosition
(
viewLineNumber
:
number
,
viewColumn
:
number
):
IEditor
Position
{
public
convertViewPositionToModelPosition
(
viewLineNumber
:
number
,
viewColumn
:
number
):
Position
{
return
new
Position
(
viewLineNumber
,
viewColumn
);
}
}
src/vs/languages/typescript/common/languageFeatures.ts
浏览文件 @
9de85cbe
...
...
@@ -17,6 +17,7 @@ import {TypeScriptWorkerProtocol, LanguageServiceDefaults} from 'vs/languages/ty
import
*
as
ts
from
'
vs/languages/typescript/common/lib/typescriptServices
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
wireCancellationToken
}
from
'
vs/base/common/async
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
export
function
register
(
modelService
:
IModelService
,
markerService
:
IMarkerService
,
selector
:
string
,
defaults
:
LanguageServiceDefaults
,
worker
:
(
first
:
URI
,
...
more
:
URI
[])
=>
TPromise
<
TypeScriptWorkerProtocol
>
):
lifecycle
.
IDisposable
{
...
...
@@ -174,7 +175,7 @@ class SuggestAdapter extends Adapter implements modes.ISuggestSupport {
return
true
;
}
provideCompletionItems
(
model
:
editorCommon
.
IReadOnlyModel
,
position
:
editorCommon
.
IEditor
Position
,
token
:
CancellationToken
):
Thenable
<
modes
.
ISuggestResult
[]
>
{
provideCompletionItems
(
model
:
editorCommon
.
IReadOnlyModel
,
position
:
Position
,
token
:
CancellationToken
):
Thenable
<
modes
.
ISuggestResult
[]
>
{
const
wordInfo
=
model
.
getWordUntilPosition
(
position
);
const
resource
=
model
.
uri
;
const
offset
=
this
.
_positionToOffset
(
resource
,
position
);
...
...
@@ -200,7 +201,7 @@ class SuggestAdapter extends Adapter implements modes.ISuggestSupport {
}));
}
resolveCompletionItem
(
model
:
editorCommon
.
IReadOnlyModel
,
position
:
editorCommon
.
IEditor
Position
,
suggestion
:
modes
.
ISuggestion
,
token
:
CancellationToken
):
Thenable
<
modes
.
ISuggestion
>
{
resolveCompletionItem
(
model
:
editorCommon
.
IReadOnlyModel
,
position
:
Position
,
suggestion
:
modes
.
ISuggestion
,
token
:
CancellationToken
):
Thenable
<
modes
.
ISuggestion
>
{
const
resource
=
model
.
uri
;
return
wireCancellationToken
(
token
,
this
.
_worker
(
resource
).
then
(
worker
=>
{
...
...
@@ -247,7 +248,7 @@ class SignatureHelpAdapter extends Adapter implements modes.SignatureHelpProvide
public
signatureHelpTriggerCharacters
=
[
'
(
'
,
'
,
'
];
provideSignatureHelp
(
model
:
editorCommon
.
IReadOnlyModel
,
position
:
editorCommon
.
IEditor
Position
,
token
:
CancellationToken
):
Thenable
<
modes
.
SignatureHelp
>
{
provideSignatureHelp
(
model
:
editorCommon
.
IReadOnlyModel
,
position
:
Position
,
token
:
CancellationToken
):
Thenable
<
modes
.
SignatureHelp
>
{
let
resource
=
model
.
uri
;
return
wireCancellationToken
(
token
,
this
.
_worker
(
resource
).
then
(
worker
=>
worker
.
getSignatureHelpItems
(
resource
.
toString
(),
this
.
_positionToOffset
(
resource
,
position
))).
then
(
info
=>
{
...
...
@@ -296,7 +297,7 @@ class SignatureHelpAdapter extends Adapter implements modes.SignatureHelpProvide
class
QuickInfoAdapter
extends
Adapter
implements
modes
.
HoverProvider
{
provideHover
(
model
:
editorCommon
.
IReadOnlyModel
,
position
:
editorCommon
.
IEditor
Position
,
token
:
CancellationToken
):
Thenable
<
modes
.
Hover
>
{
provideHover
(
model
:
editorCommon
.
IReadOnlyModel
,
position
:
Position
,
token
:
CancellationToken
):
Thenable
<
modes
.
Hover
>
{
let
resource
=
model
.
uri
;
return
wireCancellationToken
(
token
,
this
.
_worker
(
resource
).
then
(
worker
=>
{
...
...
@@ -317,7 +318,7 @@ class QuickInfoAdapter extends Adapter implements modes.HoverProvider {
class
OccurrencesAdapter
extends
Adapter
implements
modes
.
DocumentHighlightProvider
{
public
provideDocumentHighlights
(
model
:
editorCommon
.
IReadOnlyModel
,
position
:
editorCommon
.
IEditor
Position
,
token
:
CancellationToken
):
Thenable
<
modes
.
DocumentHighlight
[]
>
{
public
provideDocumentHighlights
(
model
:
editorCommon
.
IReadOnlyModel
,
position
:
Position
,
token
:
CancellationToken
):
Thenable
<
modes
.
DocumentHighlight
[]
>
{
const
resource
=
model
.
uri
;
return
wireCancellationToken
(
token
,
this
.
_worker
(
resource
).
then
(
worker
=>
{
...
...
@@ -340,7 +341,7 @@ class OccurrencesAdapter extends Adapter implements modes.DocumentHighlightProvi
class
DefinitionAdapter
extends
Adapter
{
public
provideDefinition
(
model
:
editorCommon
.
IReadOnlyModel
,
position
:
editorCommon
.
IEditor
Position
,
token
:
CancellationToken
):
Thenable
<
modes
.
Definition
>
{
public
provideDefinition
(
model
:
editorCommon
.
IReadOnlyModel
,
position
:
Position
,
token
:
CancellationToken
):
Thenable
<
modes
.
Definition
>
{
const
resource
=
model
.
uri
;
return
wireCancellationToken
(
token
,
this
.
_worker
(
resource
).
then
(
worker
=>
{
...
...
@@ -368,7 +369,7 @@ class DefinitionAdapter extends Adapter {
class
ReferenceAdapter
extends
Adapter
implements
modes
.
ReferenceProvider
{
provideReferences
(
model
:
editorCommon
.
IReadOnlyModel
,
position
:
editorCommon
.
IEditor
Position
,
context
:
modes
.
ReferenceContext
,
token
:
CancellationToken
):
Thenable
<
modes
.
Location
[]
>
{
provideReferences
(
model
:
editorCommon
.
IReadOnlyModel
,
position
:
Position
,
context
:
modes
.
ReferenceContext
,
token
:
CancellationToken
):
Thenable
<
modes
.
Location
[]
>
{
const
resource
=
model
.
uri
;
return
wireCancellationToken
(
token
,
this
.
_worker
(
resource
).
then
(
worker
=>
{
...
...
@@ -533,7 +534,7 @@ class FormatOnTypeAdapter extends FormatHelper implements modes.OnTypeFormatting
return
[
'
;
'
,
'
}
'
,
'
\n
'
];
}
provideOnTypeFormattingEdits
(
model
:
editorCommon
.
IReadOnlyModel
,
position
:
editorCommon
.
IEditor
Position
,
ch
:
string
,
options
:
modes
.
IFormattingOptions
,
token
:
CancellationToken
):
Thenable
<
editorCommon
.
ISingleEditOperation
[]
>
{
provideOnTypeFormattingEdits
(
model
:
editorCommon
.
IReadOnlyModel
,
position
:
Position
,
ch
:
string
,
options
:
modes
.
IFormattingOptions
,
token
:
CancellationToken
):
Thenable
<
editorCommon
.
ISingleEditOperation
[]
>
{
const
resource
=
model
.
uri
;
return
wireCancellationToken
(
token
,
this
.
_worker
(
resource
).
then
(
worker
=>
{
...
...
src/vs/workbench/api/node/extHostLanguageFeatures.ts
浏览文件 @
9de85cbe
...
...
@@ -11,7 +11,7 @@ import {Remotable, IThreadService} from 'vs/platform/thread/common/thread';
import
*
as
vscode
from
'
vscode
'
;
import
*
as
TypeConverters
from
'
vs/workbench/api/node/extHostTypeConverters
'
;
import
{
Range
,
Disposable
,
SignatureHelp
,
CompletionList
}
from
'
vs/workbench/api/node/extHostTypes
'
;
import
{
IReadOnlyModel
,
I
EditorPosition
,
I
Position
,
IEditorRange
,
IRange
,
ISingleEditOperation
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IReadOnlyModel
,
IPosition
,
IEditorRange
,
IRange
,
ISingleEditOperation
}
from
'
vs/editor/common/editorCommon
'
;
import
*
as
modes
from
'
vs/editor/common/modes
'
;
import
{
ExtHostModelService
}
from
'
vs/workbench/api/node/extHostDocuments
'
;
import
{
ExtHostCommands
}
from
'
vs/workbench/api/node/extHostCommands
'
;
...
...
@@ -19,6 +19,7 @@ import {ExtHostDiagnostics} from 'vs/workbench/api/node/extHostDiagnostics';
import
{
NavigateTypesSupportRegistry
,
INavigateTypesSupport
,
ITypeBearing
}
from
'
vs/workbench/parts/search/common/search
'
;
import
{
asWinJsPromise
,
ShallowCancelThenPromise
,
wireCancellationToken
}
from
'
vs/base/common/async
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
Position
as
EditorPosition
}
from
'
vs/editor/common/core/position
'
;
// --- adapter
...
...
@@ -875,7 +876,7 @@ export class MainThreadLanguageFeatures {
$registerHoverProvider
(
handle
:
number
,
selector
:
vscode
.
DocumentSelector
):
TPromise
<
any
>
{
this
.
_registrations
[
handle
]
=
modes
.
HoverProviderRegistry
.
register
(
selector
,
<
modes
.
HoverProvider
>
{
provideHover
:
(
model
:
IReadOnlyModel
,
position
:
I
EditorPosition
,
token
:
CancellationToken
):
Thenable
<
modes
.
Hover
>
=>
{
provideHover
:
(
model
:
IReadOnlyModel
,
position
:
EditorPosition
,
token
:
CancellationToken
):
Thenable
<
modes
.
Hover
>
=>
{
return
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideHover
(
handle
,
model
.
uri
,
position
));
}
});
...
...
@@ -886,7 +887,7 @@ export class MainThreadLanguageFeatures {
$registerDocumentHighlightProvider
(
handle
:
number
,
selector
:
vscode
.
DocumentSelector
):
TPromise
<
any
>
{
this
.
_registrations
[
handle
]
=
modes
.
DocumentHighlightProviderRegistry
.
register
(
selector
,
<
modes
.
DocumentHighlightProvider
>
{
provideDocumentHighlights
:
(
model
:
IReadOnlyModel
,
position
:
I
EditorPosition
,
token
:
CancellationToken
):
Thenable
<
modes
.
DocumentHighlight
[]
>
=>
{
provideDocumentHighlights
:
(
model
:
IReadOnlyModel
,
position
:
EditorPosition
,
token
:
CancellationToken
):
Thenable
<
modes
.
DocumentHighlight
[]
>
=>
{
return
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideDocumentHighlights
(
handle
,
model
.
uri
,
position
));
}
});
...
...
@@ -897,7 +898,7 @@ export class MainThreadLanguageFeatures {
$registerReferenceSupport
(
handle
:
number
,
selector
:
vscode
.
DocumentSelector
):
TPromise
<
any
>
{
this
.
_registrations
[
handle
]
=
modes
.
ReferenceProviderRegistry
.
register
(
selector
,
<
modes
.
ReferenceProvider
>
{
provideReferences
:
(
model
:
IReadOnlyModel
,
position
:
I
EditorPosition
,
context
:
modes
.
ReferenceContext
,
token
:
CancellationToken
):
Thenable
<
modes
.
Location
[]
>
=>
{
provideReferences
:
(
model
:
IReadOnlyModel
,
position
:
EditorPosition
,
context
:
modes
.
ReferenceContext
,
token
:
CancellationToken
):
Thenable
<
modes
.
Location
[]
>
=>
{
return
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideReferences
(
handle
,
model
.
uri
,
position
,
context
));
}
});
...
...
@@ -940,7 +941,7 @@ export class MainThreadLanguageFeatures {
autoFormatTriggerCharacters
,
provideOnTypeFormattingEdits
:
(
model
:
IReadOnlyModel
,
position
:
I
EditorPosition
,
ch
:
string
,
options
:
modes
.
IFormattingOptions
,
token
:
CancellationToken
):
Thenable
<
ISingleEditOperation
[]
>
=>
{
provideOnTypeFormattingEdits
:
(
model
:
IReadOnlyModel
,
position
:
EditorPosition
,
ch
:
string
,
options
:
modes
.
IFormattingOptions
,
token
:
CancellationToken
):
Thenable
<
ISingleEditOperation
[]
>
=>
{
return
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideOnTypeFormattingEdits
(
handle
,
model
.
uri
,
position
,
ch
,
options
));
}
});
...
...
@@ -962,7 +963,7 @@ export class MainThreadLanguageFeatures {
$registerRenameSupport
(
handle
:
number
,
selector
:
vscode
.
DocumentSelector
):
TPromise
<
any
>
{
this
.
_registrations
[
handle
]
=
modes
.
RenameProviderRegistry
.
register
(
selector
,
<
modes
.
RenameProvider
>
{
provideRenameEdits
:
(
model
:
IReadOnlyModel
,
position
:
I
EditorPosition
,
newName
:
string
,
token
:
CancellationToken
):
Thenable
<
modes
.
WorkspaceEdit
>
=>
{
provideRenameEdits
:
(
model
:
IReadOnlyModel
,
position
:
EditorPosition
,
newName
:
string
,
token
:
CancellationToken
):
Thenable
<
modes
.
WorkspaceEdit
>
=>
{
return
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideRenameEdits
(
handle
,
model
.
uri
,
position
,
newName
));
}
});
...
...
@@ -975,10 +976,10 @@ export class MainThreadLanguageFeatures {
this
.
_registrations
[
handle
]
=
modes
.
SuggestRegistry
.
register
(
selector
,
<
modes
.
ISuggestSupport
>
{
triggerCharacters
:
triggerCharacters
,
shouldAutotriggerSuggest
:
true
,
provideCompletionItems
:
(
model
:
IReadOnlyModel
,
position
:
I
EditorPosition
,
token
:
CancellationToken
):
Thenable
<
modes
.
ISuggestResult
[]
>
=>
{
provideCompletionItems
:
(
model
:
IReadOnlyModel
,
position
:
EditorPosition
,
token
:
CancellationToken
):
Thenable
<
modes
.
ISuggestResult
[]
>
=>
{
return
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideCompletionItems
(
handle
,
model
.
uri
,
position
));
},
resolveCompletionItem
:
(
model
:
IReadOnlyModel
,
position
:
I
EditorPosition
,
suggestion
:
modes
.
ISuggestion
,
token
:
CancellationToken
):
Thenable
<
modes
.
ISuggestion
>
=>
{
resolveCompletionItem
:
(
model
:
IReadOnlyModel
,
position
:
EditorPosition
,
suggestion
:
modes
.
ISuggestion
,
token
:
CancellationToken
):
Thenable
<
modes
.
ISuggestion
>
=>
{
return
wireCancellationToken
(
token
,
this
.
_proxy
.
$resolveCompletionItem
(
handle
,
model
.
uri
,
position
,
suggestion
));
}
});
...
...
@@ -992,7 +993,7 @@ export class MainThreadLanguageFeatures {
signatureHelpTriggerCharacters
:
triggerCharacter
,
provideSignatureHelp
:
(
model
:
IReadOnlyModel
,
position
:
I
EditorPosition
,
token
:
CancellationToken
):
Thenable
<
modes
.
SignatureHelp
>
=>
{
provideSignatureHelp
:
(
model
:
IReadOnlyModel
,
position
:
EditorPosition
,
token
:
CancellationToken
):
Thenable
<
modes
.
SignatureHelp
>
=>
{
return
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideSignatureHelp
(
handle
,
model
.
uri
,
position
));
}
...
...
src/vs/workbench/parts/debug/browser/debugHover.ts
浏览文件 @
9de85cbe
...
...
@@ -12,13 +12,14 @@ import * as nls from 'vs/nls';
import
{
ITree
}
from
'
vs/base/parts/tree/browser/tree
'
;
import
{
Tree
}
from
'
vs/base/parts/tree/browser/treeImpl
'
;
import
{
DefaultController
,
ICancelableEvent
}
from
'
vs/base/parts/tree/browser/treeDefaults
'
;
import
{
IConfigurationChangedEvent
,
IEditor
Position
,
IEditor
Range
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IConfigurationChangedEvent
,
IEditorRange
}
from
'
vs/editor/common/editorCommon
'
;
import
editorbrowser
=
require
(
'
vs/editor/browser/editorBrowser
'
);
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
debug
=
require
(
'
vs/workbench/parts/debug/common/debug
'
);
import
{
evaluateExpression
,
Expression
}
from
'
vs/workbench/parts/debug/common/debugModel
'
;
import
viewer
=
require
(
'
vs/workbench/parts/debug/browser/debugViewer
'
);
import
{
IKeyboardEvent
}
from
'
vs/base/browser/keyboardEvent
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
const
$
=
dom
.
emmet
;
const
debugTreeOptions
=
{
...
...
@@ -38,7 +39,7 @@ export class DebugHoverWidget implements editorbrowser.IContentWidget {
private
domNode
:
HTMLElement
;
public
isVisible
:
boolean
;
private
tree
:
ITree
;
private
showAtPosition
:
IEditor
Position
;
private
showAtPosition
:
Position
;
private
highlightDecorations
:
string
[];
private
treeContainer
:
HTMLElement
;
private
valueContainer
:
HTMLElement
;
...
...
@@ -175,7 +176,7 @@ export class DebugHoverWidget implements editorbrowser.IContentWidget {
}).
then
(()
=>
variables
.
length
===
1
?
TPromise
.
as
(
variables
[
0
])
:
TPromise
.
as
(
null
));
}
private
doShow
(
position
:
IEditor
Position
,
expression
:
debug
.
IExpression
,
focus
:
boolean
,
forceValueHover
=
false
):
TPromise
<
void
>
{
private
doShow
(
position
:
Position
,
expression
:
debug
.
IExpression
,
focus
:
boolean
,
forceValueHover
=
false
):
TPromise
<
void
>
{
this
.
showAtPosition
=
position
;
this
.
isVisible
=
true
;
this
.
stoleFocus
=
focus
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录