Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
139a4a23
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,发现更多精彩内容 >>
提交
139a4a23
编写于
11月 10, 2017
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Reduce usage of ICommonCodeEditor (#37834)
上级
2a8744fa
变更
23
隐藏空白更改
内联
并排
Showing
23 changed file
with
123 addition
and
54 deletion
+123
-54
src/vs/editor/browser/core/editorState.ts
src/vs/editor/browser/core/editorState.ts
+3
-3
src/vs/editor/browser/services/bulkEdit.ts
src/vs/editor/browser/services/bulkEdit.ts
+4
-3
src/vs/editor/common/editorCommon.ts
src/vs/editor/common/editorCommon.ts
+0
-11
src/vs/editor/contrib/format/formatActions.ts
src/vs/editor/contrib/format/formatActions.ts
+1
-1
src/vs/editor/contrib/goToDeclaration/goToDeclarationMouse.ts
...vs/editor/contrib/goToDeclaration/goToDeclarationMouse.ts
+1
-1
src/vs/editor/contrib/inPlaceReplace/inPlaceReplace.ts
src/vs/editor/contrib/inPlaceReplace/inPlaceReplace.ts
+1
-1
src/vs/editor/contrib/quickFix/quickFixCommands.ts
src/vs/editor/contrib/quickFix/quickFixCommands.ts
+1
-1
src/vs/editor/contrib/rename/rename.ts
src/vs/editor/contrib/rename/rename.ts
+2
-2
src/vs/editor/test/browser/core/editorState.test.ts
src/vs/editor/test/browser/core/editorState.test.ts
+1
-1
src/vs/workbench/api/electron-browser/mainThreadEditors.ts
src/vs/workbench/api/electron-browser/mainThreadEditors.ts
+1
-1
src/vs/workbench/browser/parts/editor/rangeDecorations.ts
src/vs/workbench/browser/parts/editor/rangeDecorations.ts
+8
-7
src/vs/workbench/electron-browser/workbench.ts
src/vs/workbench/electron-browser/workbench.ts
+1
-1
src/vs/workbench/parts/files/browser/editors/fileEditorTracker.ts
...orkbench/parts/files/browser/editors/fileEditorTracker.ts
+3
-2
src/vs/workbench/parts/files/browser/files.contribution.ts
src/vs/workbench/parts/files/browser/files.contribution.ts
+1
-1
src/vs/workbench/parts/files/test/browser/fileEditorTracker.test.ts
...kbench/parts/files/test/browser/fileEditorTracker.test.ts
+2
-2
src/vs/workbench/parts/markers/browser/markersPanel.ts
src/vs/workbench/parts/markers/browser/markersPanel.ts
+1
-1
src/vs/workbench/parts/preferences/browser/preferencesRenderers.ts
...rkbench/parts/preferences/browser/preferencesRenderers.ts
+1
-1
src/vs/workbench/parts/search/browser/replaceService.ts
src/vs/workbench/parts/search/browser/replaceService.ts
+1
-1
src/vs/workbench/parts/search/browser/searchViewlet.ts
src/vs/workbench/parts/search/browser/searchViewlet.ts
+4
-4
src/vs/workbench/parts/search/common/searchModel.ts
src/vs/workbench/parts/search/common/searchModel.ts
+82
-5
src/vs/workbench/services/configurationResolver/electron-browser/configurationResolverService.ts
...Resolver/electron-browser/configurationResolverService.ts
+2
-2
src/vs/workbench/services/configurationResolver/test/electron-browser/configurationResolverService.test.ts
...est/electron-browser/configurationResolverService.test.ts
+1
-1
src/vs/workbench/test/browser/parts/editor/rangeDecorations.test.ts
...kbench/test/browser/parts/editor/rangeDecorations.test.ts
+1
-1
未找到文件。
src/vs/editor/
common
/core/editorState.ts
→
src/vs/editor/
browser
/core/editorState.ts
浏览文件 @
139a4a23
...
...
@@ -5,9 +5,9 @@
'
use strict
'
;
import
*
as
strings
from
'
vs/base/common/strings
'
;
import
{
ICommonCodeEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
export
const
enum
CodeEditorStateFlag
{
Value
=
1
,
...
...
@@ -26,7 +26,7 @@ export class EditorState {
private
readonly
scrollLeft
:
number
;
private
readonly
scrollTop
:
number
;
constructor
(
editor
:
ICo
mmonCo
deEditor
,
flags
:
number
)
{
constructor
(
editor
:
ICodeEditor
,
flags
:
number
)
{
this
.
flags
=
flags
;
if
((
this
.
flags
&
CodeEditorStateFlag
.
Value
)
!==
0
)
{
...
...
@@ -67,7 +67,7 @@ export class EditorState {
return
true
;
}
public
validate
(
editor
:
ICo
mmonCo
deEditor
):
boolean
{
public
validate
(
editor
:
ICodeEditor
):
boolean
{
return
this
.
_equals
(
new
EditorState
(
editor
,
this
.
flags
));
}
}
src/vs/editor/
common
/services/bulkEdit.ts
→
src/vs/editor/
browser
/services/bulkEdit.ts
浏览文件 @
139a4a23
...
...
@@ -15,8 +15,9 @@ import { IFileService, IFileChange } from 'vs/platform/files/common/files';
import
{
EditOperation
}
from
'
vs/editor/common/core/editOperation
'
;
import
{
Range
,
IRange
}
from
'
vs/editor/common/core/range
'
;
import
{
Selection
,
ISelection
}
from
'
vs/editor/common/core/selection
'
;
import
{
IIdentifiedSingleEditOperation
,
IModel
,
EndOfLineSequence
,
ICommonCodeEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IIdentifiedSingleEditOperation
,
IModel
,
EndOfLineSequence
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IProgressRunner
}
from
'
vs/platform/progress/common/progress
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
export
interface
IResourceEdit
{
resource
:
URI
;
...
...
@@ -297,14 +298,14 @@ export interface BulkEdit {
ariaMessage
():
string
;
}
export
function
bulkEdit
(
textModelResolverService
:
ITextModelService
,
editor
:
ICo
mmonCo
deEditor
,
edits
:
IResourceEdit
[],
fileService
?:
IFileService
,
progress
:
IProgressRunner
=
null
):
TPromise
<
any
>
{
export
function
bulkEdit
(
textModelResolverService
:
ITextModelService
,
editor
:
ICodeEditor
,
edits
:
IResourceEdit
[],
fileService
?:
IFileService
,
progress
:
IProgressRunner
=
null
):
TPromise
<
any
>
{
let
bulk
=
createBulkEdit
(
textModelResolverService
,
editor
,
fileService
);
bulk
.
add
(
edits
);
bulk
.
progress
(
progress
);
return
bulk
.
finish
();
}
export
function
createBulkEdit
(
textModelResolverService
:
ITextModelService
,
editor
?:
ICo
mmonCo
deEditor
,
fileService
?:
IFileService
):
BulkEdit
{
export
function
createBulkEdit
(
textModelResolverService
:
ITextModelService
,
editor
?:
ICodeEditor
,
fileService
?:
IFileService
):
BulkEdit
{
let
all
:
IResourceEdit
[]
=
[];
let
recording
=
new
ChangeRecorder
(
fileService
).
start
();
...
...
src/vs/editor/common/editorCommon.ts
浏览文件 @
139a4a23
...
...
@@ -2082,17 +2082,6 @@ export var EditorType = {
IDiffEditor
:
'
vs.editor.IDiffEditor
'
};
/**
*@internal
*/
export
function
isCommonCodeEditor
(
thing
:
any
):
thing
is
ICommonCodeEditor
{
if
(
thing
&&
typeof
(
<
ICommonCodeEditor
>
thing
).
getEditorType
===
'
function
'
)
{
return
(
<
ICommonCodeEditor
>
thing
).
getEditorType
()
===
EditorType
.
ICodeEditor
;
}
else
{
return
false
;
}
}
/**
* Built-in commands.
* @internal
...
...
src/vs/editor/contrib/format/formatActions.ts
浏览文件 @
139a4a23
...
...
@@ -21,7 +21,7 @@ import { IEditorWorkerService } from 'vs/editor/common/services/editorWorkerServ
import
{
CharacterSet
}
from
'
vs/editor/common/core/characterClassifier
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
alert
}
from
'
vs/base/browser/ui/aria/aria
'
;
import
{
EditorState
,
CodeEditorStateFlag
}
from
'
vs/editor/
common
/core/editorState
'
;
import
{
EditorState
,
CodeEditorStateFlag
}
from
'
vs/editor/
browser
/core/editorState
'
;
import
{
EditorContextKeys
}
from
'
vs/editor/common/editorContextKeys
'
;
import
{
IMessageService
,
Severity
}
from
'
vs/platform/message/common/message
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
...
...
src/vs/editor/contrib/goToDeclaration/goToDeclarationMouse.ts
浏览文件 @
139a4a23
...
...
@@ -22,7 +22,7 @@ import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import
{
ITextModelService
}
from
'
vs/editor/common/services/resolverService
'
;
import
{
registerThemingParticipant
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
editorActiveLinkForeground
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
EditorState
,
CodeEditorStateFlag
}
from
'
vs/editor/
common
/core/editorState
'
;
import
{
EditorState
,
CodeEditorStateFlag
}
from
'
vs/editor/
browser
/core/editorState
'
;
import
{
DefinitionAction
,
DefinitionActionConfig
}
from
'
./goToDeclarationCommands
'
;
import
{
ClickLinkGesture
,
ClickLinkMouseEvent
,
ClickLinkKeyboardEvent
}
from
'
vs/editor/contrib/goToDeclaration/clickLinkGesture
'
;
...
...
src/vs/editor/contrib/inPlaceReplace/inPlaceReplace.ts
浏览文件 @
139a4a23
...
...
@@ -15,7 +15,7 @@ import { registerEditorAction, ServicesAccessor, EditorAction, registerEditorCon
import
{
IInplaceReplaceSupportResult
}
from
'
vs/editor/common/modes
'
;
import
{
IEditorWorkerService
}
from
'
vs/editor/common/services/editorWorkerService
'
;
import
{
InPlaceReplaceCommand
}
from
'
./inPlaceReplaceCommand
'
;
import
{
EditorState
,
CodeEditorStateFlag
}
from
'
vs/editor/
common
/core/editorState
'
;
import
{
EditorState
,
CodeEditorStateFlag
}
from
'
vs/editor/
browser
/core/editorState
'
;
import
{
registerThemingParticipant
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
editorBracketMatchBorder
}
from
'
vs/editor/common/view/editorColorRegistry
'
;
import
{
ModelDecorationOptions
}
from
'
vs/editor/common/model/textModelWithDecorations
'
;
...
...
src/vs/editor/contrib/quickFix/quickFixCommands.ts
浏览文件 @
139a4a23
...
...
@@ -21,7 +21,7 @@ import { LightBulbWidget } from './lightBulbWidget';
import
{
QuickFixModel
,
QuickFixComputeEvent
}
from
'
./quickFixModel
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
CodeAction
}
from
'
vs/editor/common/modes
'
;
import
{
createBulkEdit
}
from
'
vs/editor/
common
/services/bulkEdit
'
;
import
{
createBulkEdit
}
from
'
vs/editor/
browser
/services/bulkEdit
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
ITextModelService
}
from
'
vs/editor/common/services/resolverService
'
;
...
...
src/vs/editor/contrib/rename/rename.ts
浏览文件 @
139a4a23
...
...
@@ -17,7 +17,7 @@ import { IProgressService } from 'vs/platform/progress/common/progress';
import
{
registerEditorAction
,
registerEditorContribution
,
ServicesAccessor
,
EditorAction
,
EditorCommand
,
registerEditorCommand
,
registerDefaultLanguageCommand
}
from
'
vs/editor/browser/editorExtensions
'
;
import
{
IEditorContribution
,
IReadOnlyModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
EditorContextKeys
}
from
'
vs/editor/common/editorContextKeys
'
;
import
{
createBulkEdit
}
from
'
vs/editor/
common
/services/bulkEdit
'
;
import
{
createBulkEdit
}
from
'
vs/editor/
browser
/services/bulkEdit
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
RenameInputField
from
'
./renameInputField
'
;
import
{
ITextModelService
}
from
'
vs/editor/common/services/resolverService
'
;
...
...
@@ -29,7 +29,7 @@ import { Position } from 'vs/editor/common/core/position';
import
{
alert
}
from
'
vs/base/browser/ui/aria/aria
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
MessageController
}
from
'
vs/editor/contrib/message/messageController
'
;
import
{
EditorState
,
CodeEditorStateFlag
}
from
'
vs/editor/
common
/core/editorState
'
;
import
{
EditorState
,
CodeEditorStateFlag
}
from
'
vs/editor/
browser
/core/editorState
'
;
import
{
KeybindingsRegistry
}
from
'
vs/platform/keybinding/common/keybindingsRegistry
'
;
...
...
src/vs/editor/test/browser/core/editorState.test.ts
浏览文件 @
139a4a23
...
...
@@ -8,7 +8,7 @@
import
*
as
assert
from
'
assert
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
IModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
EditorState
,
CodeEditorStateFlag
}
from
'
vs/editor/
common
/core/editorState
'
;
import
{
EditorState
,
CodeEditorStateFlag
}
from
'
vs/editor/
browser
/core/editorState
'
;
import
{
Selection
}
from
'
vs/editor/common/core/selection
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
...
...
src/vs/workbench/api/electron-browser/mainThreadEditors.ts
浏览文件 @
139a4a23
...
...
@@ -23,7 +23,7 @@ import { IRange } from 'vs/editor/common/core/range';
import
{
ISelection
}
from
'
vs/editor/common/core/selection
'
;
import
{
ITextModelService
}
from
'
vs/editor/common/services/resolverService
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
bulkEdit
,
IResourceEdit
}
from
'
vs/editor/
common
/services/bulkEdit
'
;
import
{
bulkEdit
,
IResourceEdit
}
from
'
vs/editor/
browser
/services/bulkEdit
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
isCodeEditor
,
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
...
...
src/vs/workbench/
common
/editor/rangeDecorations.ts
→
src/vs/workbench/
browser/parts
/editor/rangeDecorations.ts
浏览文件 @
139a4a23
...
...
@@ -11,6 +11,7 @@ import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/edi
import
{
IRange
}
from
'
vs/editor/common/core/range
'
;
import
{
CursorChangeReason
,
ICursorPositionChangedEvent
}
from
'
vs/editor/common/controller/cursorEvents
'
;
import
{
ModelDecorationOptions
}
from
'
vs/editor/common/model/textModelWithDecorations
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
export
interface
IRangeHighlightDecoration
{
resource
:
URI
;
...
...
@@ -21,7 +22,7 @@ export interface IRangeHighlightDecoration {
export
class
RangeHighlightDecorations
implements
IDisposable
{
private
rangeHighlightDecorationId
:
string
=
null
;
private
editor
:
editorCommon
.
ICommon
CodeEditor
=
null
;
private
editor
:
I
CodeEditor
=
null
;
private
editorDisposables
:
IDisposable
[]
=
[];
private
_onHighlightRemoved
:
Emitter
<
void
>
=
new
Emitter
<
void
>
();
...
...
@@ -38,14 +39,14 @@ export class RangeHighlightDecorations implements IDisposable {
this
.
rangeHighlightDecorationId
=
null
;
}
public
highlightRange
(
range
:
IRangeHighlightDecoration
,
editor
?:
editorCommon
.
ICommon
CodeEditor
)
{
public
highlightRange
(
range
:
IRangeHighlightDecoration
,
editor
?:
I
CodeEditor
)
{
editor
=
editor
?
editor
:
this
.
getEditor
(
range
);
if
(
editor
)
{
this
.
doHighlightRange
(
editor
,
range
);
}
}
private
doHighlightRange
(
editor
:
editorCommon
.
ICommon
CodeEditor
,
selectionRange
:
IRangeHighlightDecoration
)
{
private
doHighlightRange
(
editor
:
I
CodeEditor
,
selectionRange
:
IRangeHighlightDecoration
)
{
this
.
removeHighlightRange
();
editor
.
changeDecorations
((
changeAccessor
:
editorCommon
.
IModelDecorationsChangeAccessor
)
=>
{
this
.
rangeHighlightDecorationId
=
changeAccessor
.
addDecoration
(
selectionRange
.
range
,
this
.
createRangeHighlightDecoration
(
selectionRange
.
isWholeLine
));
...
...
@@ -53,18 +54,18 @@ export class RangeHighlightDecorations implements IDisposable {
this
.
setEditor
(
editor
);
}
private
getEditor
(
resourceRange
:
IRangeHighlightDecoration
):
editorCommon
.
ICommon
CodeEditor
{
private
getEditor
(
resourceRange
:
IRangeHighlightDecoration
):
I
CodeEditor
{
const
activeInput
=
this
.
editorService
.
getActiveEditorInput
();
const
resource
=
activeInput
&&
activeInput
.
getResource
();
if
(
resource
)
{
if
(
resource
.
toString
()
===
resourceRange
.
resource
.
toString
())
{
return
<
editorCommon
.
ICommon
CodeEditor
>
this
.
editorService
.
getActiveEditor
().
getControl
();
return
<
I
CodeEditor
>
this
.
editorService
.
getActiveEditor
().
getControl
();
}
}
return
null
;
}
private
setEditor
(
editor
:
editorCommon
.
ICommon
CodeEditor
)
{
private
setEditor
(
editor
:
I
CodeEditor
)
{
if
(
this
.
editor
!==
editor
)
{
this
.
disposeEditorListeners
();
this
.
editor
=
editor
;
...
...
@@ -113,4 +114,4 @@ export class RangeHighlightDecorations implements IDisposable {
this
.
editor
=
null
;
}
}
}
\ No newline at end of file
}
src/vs/workbench/electron-browser/workbench.ts
浏览文件 @
139a4a23
...
...
@@ -57,7 +57,7 @@ import { RemoteFileService } from 'vs/workbench/services/files/electron-browser/
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
IListService
,
ListService
}
from
'
vs/platform/list/browser/listService
'
;
import
{
IConfigurationResolverService
}
from
'
vs/workbench/services/configurationResolver/common/configurationResolver
'
;
import
{
ConfigurationResolverService
}
from
'
vs/workbench/services/configurationResolver/
node
/configurationResolverService
'
;
import
{
ConfigurationResolverService
}
from
'
vs/workbench/services/configurationResolver/
electron-browser
/configurationResolverService
'
;
import
{
IPanelService
}
from
'
vs/workbench/services/panel/common/panelService
'
;
import
{
ITitleService
}
from
'
vs/workbench/services/title/common/titleService
'
;
import
{
WorkbenchMessageService
}
from
'
vs/workbench/services/message/browser/messageService
'
;
...
...
src/vs/workbench/parts/files/
common
/editors/fileEditorTracker.ts
→
src/vs/workbench/parts/files/
browser
/editors/fileEditorTracker.ts
浏览文件 @
139a4a23
...
...
@@ -9,7 +9,7 @@ import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
import
errors
=
require
(
'
vs/base/common/errors
'
);
import
URI
from
'
vs/base/common/uri
'
;
import
paths
=
require
(
'
vs/base/common/paths
'
);
import
{
IEditorViewState
,
isCommonCodeEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IEditorViewState
}
from
'
vs/editor/common/editorCommon
'
;
import
{
toResource
,
SideBySideEditorInput
,
IEditorGroup
,
IWorkbenchEditorConfiguration
}
from
'
vs/workbench/common/editor
'
;
import
{
BINARY_FILE_EDITOR_ID
}
from
'
vs/workbench/parts/files/common/files
'
;
import
{
ITextFileService
,
ITextFileEditorModel
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
...
...
@@ -26,6 +26,7 @@ import { isLinux } from 'vs/base/common/platform';
import
{
ResourceQueue
}
from
'
vs/base/common/async
'
;
import
{
ResourceMap
}
from
'
vs/base/common/map
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
isCodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
export
class
FileEditorTracker
implements
IWorkbenchContribution
{
...
...
@@ -242,7 +243,7 @@ export class FileEditorTracker implements IWorkbenchContribution {
const
editorResource
=
editor
.
input
.
getResource
();
if
(
editorResource
&&
resource
.
toString
()
===
editorResource
.
toString
())
{
const
control
=
editor
.
getControl
();
if
(
isCo
mmonCo
deEditor
(
control
))
{
if
(
isCodeEditor
(
control
))
{
return
control
.
saveViewState
();
}
}
...
...
src/vs/workbench/parts/files/browser/files.contribution.ts
浏览文件 @
139a4a23
...
...
@@ -16,7 +16,7 @@ import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } fr
import
{
IEditorInputFactory
,
EditorInput
,
IFileEditorInput
,
IEditorInputFactoryRegistry
,
Extensions
as
EditorInputExtensions
}
from
'
vs/workbench/common/editor
'
;
import
{
AutoSaveConfiguration
,
HotExitConfiguration
,
SUPPORTED_ENCODINGS
}
from
'
vs/platform/files/common/files
'
;
import
{
FILE_EDITOR_INPUT_ID
,
VIEWLET_ID
,
SortOrderConfiguration
}
from
'
vs/workbench/parts/files/common/files
'
;
import
{
FileEditorTracker
}
from
'
vs/workbench/parts/files/
common
/editors/fileEditorTracker
'
;
import
{
FileEditorTracker
}
from
'
vs/workbench/parts/files/
browser
/editors/fileEditorTracker
'
;
import
{
SaveErrorHandler
}
from
'
vs/workbench/parts/files/browser/saveErrorHandler
'
;
import
{
FileEditorInput
}
from
'
vs/workbench/parts/files/common/editors/fileEditorInput
'
;
import
{
TextFileEditor
}
from
'
vs/workbench/parts/files/browser/editors/textFileEditor
'
;
...
...
src/vs/workbench/parts/files/test/browser/fileEditorTracker.test.ts
浏览文件 @
139a4a23
...
...
@@ -6,7 +6,7 @@
'
use strict
'
;
import
*
as
assert
from
'
assert
'
;
import
{
FileEditorTracker
}
from
'
vs/workbench/parts/files/
common
/editors/fileEditorTracker
'
;
import
{
FileEditorTracker
}
from
'
vs/workbench/parts/files/
browser
/editors/fileEditorTracker
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
join
}
from
'
vs/base/common/paths
'
;
import
{
FileEditorInput
}
from
'
vs/workbench/parts/files/common/editors/fileEditorInput
'
;
...
...
@@ -206,4 +206,4 @@ suite('Files - FileEditorTracker', () => {
});
});
});
});
\ No newline at end of file
});
src/vs/workbench/parts/markers/browser/markersPanel.ts
浏览文件 @
139a4a23
...
...
@@ -28,7 +28,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import
{
CollapseAllAction
,
FilterAction
,
FilterInputBoxActionItem
}
from
'
vs/workbench/parts/markers/browser/markersPanelActions
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
Messages
from
'
vs/workbench/parts/markers/common/messages
'
;
import
{
RangeHighlightDecorations
}
from
'
vs/workbench/
common
/editor/rangeDecorations
'
;
import
{
RangeHighlightDecorations
}
from
'
vs/workbench/
browser/parts
/editor/rangeDecorations
'
;
import
{
IContextKeyService
,
IContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IListService
}
from
'
vs/platform/list/browser/listService
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
...
...
src/vs/workbench/parts/preferences/browser/preferencesRenderers.ts
浏览文件 @
139a4a23
...
...
@@ -23,7 +23,7 @@ import { ICodeEditor, IEditorMouseEvent, MouseTargetType } from 'vs/editor/brows
import
{
IContextMenuService
,
ContextSubMenu
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
SettingsGroupTitleWidget
,
EditPreferenceWidget
,
SettingsHeaderWidget
,
DefaultSettingsHeaderWidget
,
FloatingClickWidget
}
from
'
vs/workbench/parts/preferences/browser/preferencesWidgets
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
RangeHighlightDecorations
}
from
'
vs/workbench/
common
/editor/rangeDecorations
'
;
import
{
RangeHighlightDecorations
}
from
'
vs/workbench/
browser/parts
/editor/rangeDecorations
'
;
import
{
IMarkerService
,
IMarkerData
}
from
'
vs/platform/markers/common/markers
'
;
import
{
IMessageService
,
Severity
}
from
'
vs/platform/message/common/message
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
...
...
src/vs/workbench/parts/search/browser/replaceService.ts
浏览文件 @
139a4a23
...
...
@@ -15,7 +15,7 @@ import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/edi
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
Match
,
FileMatch
,
FileMatchOrMatch
,
ISearchWorkbenchService
}
from
'
vs/workbench/parts/search/common/searchModel
'
;
import
{
BulkEdit
,
IResourceEdit
,
createBulkEdit
}
from
'
vs/editor/
common
/services/bulkEdit
'
;
import
{
BulkEdit
,
IResourceEdit
,
createBulkEdit
}
from
'
vs/editor/
browser
/services/bulkEdit
'
;
import
{
IProgressRunner
}
from
'
vs/platform/progress/common/progress
'
;
import
{
IDiffEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
...
...
src/vs/workbench/parts/search/browser/searchViewlet.ts
浏览文件 @
139a4a23
...
...
@@ -1359,10 +1359,10 @@ export class SearchViewlet extends Viewlet {
}
},
sideBySide
).
then
(
editor
=>
{
if
(
editor
&&
element
instanceof
Match
&&
preserveFocus
)
{
this
.
viewModel
.
searchResult
.
rangeHighlightDecorations
.
highlightRange
(
{
resource
,
range
:
element
.
range
()
},
<
ICodeEditor
>
editor
.
getControl
()
);
this
.
viewModel
.
searchResult
.
rangeHighlightDecorations
.
highlightRange
(
(
<
ICodeEditor
>
editor
.
getControl
()).
getModel
()
,
element
.
range
()
);
}
else
{
this
.
viewModel
.
searchResult
.
rangeHighlightDecorations
.
removeHighlightRange
();
}
...
...
src/vs/workbench/parts/search/common/searchModel.ts
浏览文件 @
139a4a23
...
...
@@ -22,7 +22,6 @@ import { IInstantiationService, createDecorator } from 'vs/platform/instantiatio
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
IReplaceService
}
from
'
vs/workbench/parts/search/common/replace
'
;
import
{
IProgressRunner
}
from
'
vs/platform/progress/common/progress
'
;
import
{
RangeHighlightDecorations
}
from
'
vs/workbench/common/editor/rangeDecorations
'
;
import
{
ModelDecorationOptions
}
from
'
vs/editor/common/model/textModelWithDecorations
'
;
import
{
overviewRulerFindMatchForeground
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
themeColorFromId
}
from
'
vs/platform/theme/common/themeService
'
;
...
...
@@ -626,10 +625,10 @@ export class SearchResult extends Disposable {
}
});
if
(
this
.
_showHighlights
&&
selectedMatch
)
{
this
.
_rangeHighlightDecorations
.
highlightRange
(
{
resource
:
selectedMatch
.
parent
().
resource
(),
range
:
selectedMatch
.
range
()
}
);
this
.
_rangeHighlightDecorations
.
highlightRange
(
selectedMatch
.
parent
().
resource
(),
selectedMatch
.
range
()
);
}
else
{
this
.
_rangeHighlightDecorations
.
removeHighlightRange
();
}
...
...
@@ -841,3 +840,81 @@ export interface ISearchWorkbenchService {
readonly
searchModel
:
SearchModel
;
}
/**
* Can add a range highlight decoration to a model.
* It will automatically remove it when the model has its decorations changed.
*/
export
class
RangeHighlightDecorations
implements
IDisposable
{
private
_decorationId
:
string
=
null
;
private
_model
:
IModel
=
null
;
private
_modelDisposables
:
IDisposable
[]
=
[];
constructor
(
@
IModelService
private
readonly
_modelService
:
IModelService
)
{
}
public
removeHighlightRange
()
{
if
(
this
.
_model
&&
this
.
_decorationId
)
{
this
.
_model
.
deltaDecorations
([
this
.
_decorationId
],
[]);
}
this
.
_decorationId
=
null
;
}
public
highlightRange
(
resource
:
URI
|
IModel
,
range
:
Range
,
ownerId
:
number
=
0
):
void
{
let
model
:
IModel
;
if
(
URI
.
isUri
(
resource
))
{
model
=
this
.
_modelService
.
getModel
(
resource
);
}
else
{
model
=
resource
;
}
if
(
model
)
{
this
.
doHighlightRange
(
model
,
range
);
}
}
private
doHighlightRange
(
model
:
IModel
,
range
:
Range
)
{
this
.
removeHighlightRange
();
this
.
_decorationId
=
model
.
deltaDecorations
([],
[{
range
:
range
,
options
:
RangeHighlightDecorations
.
_RANGE_HIGHLIGHT_DECORATION
}])[
0
];
this
.
setModel
(
model
);
}
private
setModel
(
model
:
IModel
)
{
if
(
this
.
_model
!==
model
)
{
this
.
disposeModelListeners
();
this
.
_model
=
model
;
this
.
_modelDisposables
.
push
(
this
.
_model
.
onDidChangeDecorations
((
e
)
=>
{
this
.
disposeModelListeners
();
this
.
removeHighlightRange
();
this
.
_model
=
null
;
}));
this
.
_modelDisposables
.
push
(
this
.
_model
.
onWillDispose
(()
=>
{
this
.
disposeModelListeners
();
this
.
removeHighlightRange
();
this
.
_model
=
null
;
}));
}
}
private
disposeModelListeners
()
{
this
.
_modelDisposables
.
forEach
(
disposable
=>
disposable
.
dispose
());
this
.
_modelDisposables
=
[];
}
public
dispose
()
{
if
(
this
.
_model
)
{
this
.
removeHighlightRange
();
this
.
disposeModelListeners
();
this
.
_model
=
null
;
}
}
private
static
_RANGE_HIGHLIGHT_DECORATION
=
ModelDecorationOptions
.
register
({
stickiness
:
TrackedRangeStickiness
.
NeverGrowsWhenTypingAtEdges
,
className
:
'
rangeHighlight
'
,
isWholeLine
:
true
});
}
src/vs/workbench/services/configurationResolver/
node
/configurationResolverService.ts
→
src/vs/workbench/services/configurationResolver/
electron-browser
/configurationResolverService.ts
浏览文件 @
139a4a23
...
...
@@ -12,11 +12,11 @@ import { IConfigurationResolverService } from 'vs/workbench/services/configurati
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
ICommandService
}
from
'
vs/platform/commands/common/commands
'
;
import
{
ICommonCodeEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IWorkspaceFolder
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
toResource
}
from
'
vs/workbench/common/editor
'
;
import
{
DiffEditorInput
}
from
'
vs/workbench/common/editor/diffEditorInput
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
export
class
ConfigurationResolverService
implements
IConfigurationResolverService
{
_serviceBrand
:
any
;
...
...
@@ -92,7 +92,7 @@ export class ConfigurationResolverService implements IConfigurationResolverServi
private
get
lineNumber
():
string
{
const
activeEditor
=
this
.
editorService
.
getActiveEditor
();
if
(
activeEditor
)
{
const
editorControl
=
(
<
ICo
mmonCo
deEditor
>
activeEditor
.
getControl
());
const
editorControl
=
(
<
ICodeEditor
>
activeEditor
.
getControl
());
if
(
editorControl
)
{
const
lineNumber
=
editorControl
.
getSelection
().
positionLineNumber
;
return
String
(
lineNumber
);
...
...
src/vs/workbench/services/configurationResolver/test/
node
/configurationResolverService.test.ts
→
src/vs/workbench/services/configurationResolver/test/
electron-browser
/configurationResolverService.test.ts
浏览文件 @
139a4a23
...
...
@@ -10,7 +10,7 @@ import { TPromise } from 'vs/base/common/winjs.base';
import
{
IConfigurationService
,
getConfigurationValue
,
IConfigurationOverrides
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
ICommandService
}
from
'
vs/platform/commands/common/commands
'
;
import
{
IConfigurationResolverService
}
from
'
vs/workbench/services/configurationResolver/common/configurationResolver
'
;
import
{
ConfigurationResolverService
}
from
'
vs/workbench/services/configurationResolver/
node
/configurationResolverService
'
;
import
{
ConfigurationResolverService
}
from
'
vs/workbench/services/configurationResolver/
electron-browser
/configurationResolverService
'
;
import
{
IWorkspaceFolder
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
TestEnvironmentService
,
TestEditorService
}
from
'
vs/workbench/test/workbenchTestServices
'
;
import
{
TestConfigurationService
}
from
'
vs/platform/configuration/test/common/testConfigurationService
'
;
...
...
src/vs/workbench/test/browser/parts/editor/rangeDecorations.test.ts
浏览文件 @
139a4a23
...
...
@@ -11,7 +11,7 @@ import { IModelService } from 'vs/editor/common/services/modelService';
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
ModeServiceImpl
}
from
'
vs/editor/common/services/modeServiceImpl
'
;
import
WorkbenchEditorService
=
require
(
'
vs/workbench/services/editor/common/editorService
'
);
import
{
RangeHighlightDecorations
}
from
'
vs/workbench/
common
/editor/rangeDecorations
'
;
import
{
RangeHighlightDecorations
}
from
'
vs/workbench/
browser/parts
/editor/rangeDecorations
'
;
import
{
Model
}
from
'
vs/editor/common/model/model
'
;
import
{
createTestCodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
{
IEditorInput
}
from
'
vs/platform/editor/common/editor
'
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录