Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
5d429192
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5d429192
编写于
1月 16, 2017
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debt - fix some layer breakers in workbench
上级
217f9622
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
86 addition
and
88 deletion
+86
-88
src/vs/workbench/browser/parts/editor/editorStatus.ts
src/vs/workbench/browser/parts/editor/editorStatus.ts
+9
-14
src/vs/workbench/common/editor/indentation.ts
src/vs/workbench/common/editor/indentation.ts
+61
-2
src/vs/workbench/electron-browser/workbench.main.ts
src/vs/workbench/electron-browser/workbench.main.ts
+0
-1
src/vs/workbench/parts/extensions/browser/extensionsActions.ts
...s/workbench/parts/extensions/browser/extensionsActions.ts
+14
-3
src/vs/workbench/parts/extensions/electron-browser/extensions.contribution.ts
...ts/extensions/electron-browser/extensions.contribution.ts
+1
-1
src/vs/workbench/parts/indentation/common/indentationCommands.ts
...workbench/parts/indentation/common/indentationCommands.ts
+0
-66
src/vs/workbench/test/common/editor/indentation.test.ts
src/vs/workbench/test/common/editor/indentation.test.ts
+1
-1
未找到文件。
src/vs/workbench/browser/parts/editor/editorStatus.ts
浏览文件 @
5d429192
...
...
@@ -27,7 +27,7 @@ import { IConfigurationEditingService, ConfigurationTarget } from 'vs/workbench/
import
{
IEditorAction
,
ICommonCodeEditor
,
IModelContentChangedEvent
,
IModelOptionsChangedEvent
,
IModelLanguageChangedEvent
,
ICursorPositionChangedEvent
,
EndOfLineSequence
,
EditorType
,
IModel
,
IDiffEditorModel
,
IEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ICodeEditor
,
IDiffEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
TrimTrailingWhitespaceAction
}
from
'
vs/editor/contrib/linesOperations/common/linesOperations
'
;
import
{
IndentUsingSpaces
,
IndentUsingTabs
,
DetectIndentation
,
IndentationToSpacesAction
,
IndentationToTabsAction
}
from
'
vs/workbench/
parts/indentation/common
/indentation
'
;
import
{
IndentUsingSpaces
,
IndentUsingTabs
,
DetectIndentation
,
IndentationToSpacesAction
,
IndentationToTabsAction
}
from
'
vs/workbench/
common/editor
/indentation
'
;
import
{
BaseBinaryResourceEditor
}
from
'
vs/workbench/browser/parts/editor/binaryEditor
'
;
import
{
BinaryResourceDiffEditor
}
from
'
vs/workbench/browser/parts/editor/binaryDiffEditor
'
;
import
{
IEditor
as
IBaseEditor
,
IEditorInput
}
from
'
vs/platform/editor/common/editor
'
;
...
...
@@ -42,10 +42,9 @@ import { StyleMutator } from 'vs/base/browser/styleMutator';
import
{
Selection
}
from
'
vs/editor/common/core/selection
'
;
import
{
IEditorGroupService
}
from
'
vs/workbench/services/group/common/groupService
'
;
import
{
TabFocus
}
from
'
vs/editor/common/config/commonEditorConfig
'
;
import
{
I
TextFileService
}
from
'
vs/workbench/services/textfile/common/textfile
s
'
;
import
{
I
CommandService
}
from
'
vs/platform/commands/common/command
s
'
;
import
{
IExtensionGalleryService
}
from
'
vs/platform/extensionManagement/common/extensionManagement
'
;
import
{
IViewletService
}
from
'
vs/workbench/services/viewlet/browser/viewlet
'
;
import
{
IExtensionsViewlet
,
VIEWLET_ID
}
from
'
vs/workbench/parts/extensions/common/extensions
'
;
import
{
ITextFileService
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
getCodeEditor
as
getEditorWidget
}
from
'
vs/editor/common/services/codeEditorService
'
;
function
getCodeEditor
(
editorWidget
:
IEditor
):
ICommonCodeEditor
{
...
...
@@ -680,24 +679,20 @@ function isWritableCodeEditor(e: IBaseEditor): boolean {
export
class
ShowLanguageExtensionsAction
extends
Action
{
static
ID
=
'
workbench.
extensions.
action.showLanguageExtensions
'
;
static
ID
=
'
workbench.action.showLanguageExtensions
'
;
constructor
(
private
e
xtension
:
string
,
@
I
ViewletService
private
viewletService
:
IViewlet
Service
,
private
fileE
xtension
:
string
,
@
I
CommandService
private
commandService
:
ICommand
Service
,
@
IExtensionGalleryService
galleryService
:
IExtensionGalleryService
)
{
super
(
ShowLanguageExtensionsAction
.
ID
,
nls
.
localize
(
'
showLanguageExtensions
'
,
"
Search Marketplace Extensions for '{0}'...
"
,
extension
),
null
,
true
);
super
(
ShowLanguageExtensionsAction
.
ID
,
nls
.
localize
(
'
showLanguageExtensions
'
,
"
Search Marketplace Extensions for '{0}'...
"
,
fileExtension
));
this
.
enabled
=
galleryService
.
isEnabled
();
}
run
():
TPromise
<
void
>
{
return
this
.
viewletService
.
openViewlet
(
VIEWLET_ID
,
true
)
.
then
(
viewlet
=>
viewlet
as
IExtensionsViewlet
)
.
then
(
viewlet
=>
{
viewlet
.
search
(
`ext:
${
this
.
extension
.
replace
(
/^
\.
/
,
''
)}
`
);
viewlet
.
focus
();
});
return
this
.
commandService
.
executeCommand
(
'
workbench.extensions.action.showLanguageExtensions
'
,
this
.
fileExtension
).
then
(()
=>
void
0
);
}
}
...
...
src/vs/workbench/
parts/indentation/common
/indentation.ts
→
src/vs/workbench/
common/editor
/indentation.ts
浏览文件 @
5d429192
...
...
@@ -5,11 +5,12 @@
import
*
as
nls
from
'
vs/nls
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
ICommonCodeEditor
,
EditorContextKeys
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ICommonCodeEditor
,
EditorContextKeys
,
ICommand
,
ICursorStateComputerData
,
IEditOperationBuilder
,
ITokenizedModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
editorAction
,
ServicesAccessor
,
IActionOptions
,
EditorAction
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
IndentationToSpacesCommand
,
IndentationToTabsCommand
}
from
'
vs/workbench/parts/indentation/common/indentationCommands
'
;
import
{
IQuickOpenService
}
from
'
vs/platform/quickOpen/common/quickOpen
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
Selection
}
from
'
vs/editor/common/core/selection
'
;
@
editorAction
export
class
IndentationToSpacesAction
extends
EditorAction
{
...
...
@@ -160,3 +161,61 @@ export class DetectIndentation extends EditorAction {
model
.
detectIndentation
(
creationOpts
.
insertSpaces
,
creationOpts
.
tabSize
);
}
}
function
getIndentationEditOperations
(
model
:
ITokenizedModel
,
builder
:
IEditOperationBuilder
,
tabSize
:
number
,
tabsToSpaces
:
boolean
):
void
{
if
(
model
.
getLineCount
()
===
1
&&
model
.
getLineMaxColumn
(
1
)
===
1
)
{
// Model is empty
return
;
}
let
spaces
=
''
;
for
(
let
i
=
0
;
i
<
tabSize
;
i
++
)
{
spaces
+=
'
'
;
}
const
content
=
model
.
getLinesContent
();
for
(
let
i
=
0
;
i
<
content
.
length
;
i
++
)
{
let
lastIndentationColumn
=
model
.
getLineFirstNonWhitespaceColumn
(
i
+
1
);
if
(
lastIndentationColumn
===
0
)
{
lastIndentationColumn
=
model
.
getLineMaxColumn
(
i
+
1
);
}
const
text
=
(
tabsToSpaces
?
content
[
i
].
substr
(
0
,
lastIndentationColumn
).
replace
(
/
\t
/ig
,
spaces
)
:
content
[
i
].
substr
(
0
,
lastIndentationColumn
).
replace
(
new
RegExp
(
spaces
,
'
gi
'
),
'
\t
'
))
+
content
[
i
].
substr
(
lastIndentationColumn
);
builder
.
addEditOperation
(
new
Range
(
i
+
1
,
1
,
i
+
1
,
model
.
getLineMaxColumn
(
i
+
1
)),
text
);
}
}
export
class
IndentationToSpacesCommand
implements
ICommand
{
private
selectionId
:
string
;
constructor
(
private
selection
:
Selection
,
private
tabSize
:
number
)
{
}
public
getEditOperations
(
model
:
ITokenizedModel
,
builder
:
IEditOperationBuilder
):
void
{
this
.
selectionId
=
builder
.
trackSelection
(
this
.
selection
);
getIndentationEditOperations
(
model
,
builder
,
this
.
tabSize
,
true
);
}
public
computeCursorState
(
model
:
ITokenizedModel
,
helper
:
ICursorStateComputerData
):
Selection
{
return
helper
.
getTrackedSelection
(
this
.
selectionId
);
}
}
export
class
IndentationToTabsCommand
implements
ICommand
{
private
selectionId
:
string
;
constructor
(
private
selection
:
Selection
,
private
tabSize
:
number
)
{
}
public
getEditOperations
(
model
:
ITokenizedModel
,
builder
:
IEditOperationBuilder
):
void
{
this
.
selectionId
=
builder
.
trackSelection
(
this
.
selection
);
getIndentationEditOperations
(
model
,
builder
,
this
.
tabSize
,
false
);
}
public
computeCursorState
(
model
:
ITokenizedModel
,
helper
:
ICursorStateComputerData
):
Selection
{
return
helper
.
getTrackedSelection
(
this
.
selectionId
);
}
}
src/vs/workbench/electron-browser/workbench.main.ts
浏览文件 @
5d429192
...
...
@@ -81,7 +81,6 @@ import 'vs/workbench/parts/emmet/browser/emmet.browser.contribution';
import
'
vs/workbench/parts/emmet/node/emmet.contribution
'
;
// Code Editor enhacements
import
'
vs/workbench/parts/indentation/common/indentation
'
;
import
'
vs/workbench/parts/codeEditor/codeEditor.contribution
'
;
import
'
vs/workbench/parts/execution/electron-browser/execution.contribution
'
;
...
...
src/vs/workbench/parts/extensions/browser/extensionsActions.ts
浏览文件 @
5d429192
...
...
@@ -18,7 +18,7 @@ import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import
{
IExtension
,
ExtensionState
,
IExtensionsWorkbenchService
,
VIEWLET_ID
,
IExtensionsViewlet
}
from
'
vs/workbench/parts/extensions/common/extensions
'
;
import
{
ExtensionsConfigurationInitialContent
}
from
'
vs/workbench/parts/extensions/common/extensionsFileTemplate
'
;
import
{
LocalExtensionType
,
IExtensionEnablementService
}
from
'
vs/platform/extensionManagement/common/extensionManagement
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IInstantiationService
,
ServicesAccessor
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IMessageService
}
from
'
vs/platform/message/common/message
'
;
import
{
ToggleViewletAction
}
from
'
vs/workbench/browser/viewlet
'
;
import
{
IViewletService
}
from
'
vs/workbench/services/viewlet/browser/viewlet
'
;
...
...
@@ -29,7 +29,7 @@ import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace
import
{
IWindowService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IExtensionService
,
IExtensionDescription
}
from
'
vs/platform/extensions/common/extensions
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
CommandsRegistry
}
from
'
vs/platform/commands/common/commands
'
;
export
class
InstallAction
extends
Action
{
...
...
@@ -1290,4 +1290,15 @@ export class EnableAllWorkpsaceAction extends Action {
super
.
dispose
();
this
.
disposables
=
dispose
(
this
.
disposables
);
}
}
\ No newline at end of file
}
CommandsRegistry
.
registerCommand
(
'
workbench.extensions.action.showLanguageExtensions
'
,
function
(
accessor
:
ServicesAccessor
,
fileExtension
:
string
)
{
const
viewletService
=
accessor
.
get
(
IViewletService
);
return
viewletService
.
openViewlet
(
VIEWLET_ID
,
true
)
.
then
(
viewlet
=>
viewlet
as
IExtensionsViewlet
)
.
then
(
viewlet
=>
{
viewlet
.
search
(
`ext:
${
fileExtension
.
replace
(
/^
\.
/
,
''
)}
`
);
viewlet
.
focus
();
});
});
src/vs/workbench/parts/extensions/electron-browser/extensions.contribution.ts
浏览文件 @
5d429192
...
...
@@ -149,7 +149,7 @@ const enableAllWorkspaceAction = new SyncActionDescriptor(EnableAllWorkpsaceActi
actionRegistry
.
registerWorkbenchAction
(
enableAllWorkspaceAction
,
'
Extensions: Enable All (Workspace)
'
,
ExtensionsLabel
);
const
checkForUpdatesAction
=
new
SyncActionDescriptor
(
CheckForUpdatesAction
,
CheckForUpdatesAction
.
ID
,
CheckForUpdatesAction
.
LABEL
);
actionRegistry
.
registerWorkbenchAction
(
checkForUpdatesAction
,
`Extensions:
${
CheckForUpdatesAction
.
LABEL
}
`
,
ExtensionsLabel
);
actionRegistry
.
registerWorkbenchAction
(
checkForUpdatesAction
,
`Extensions:
Check for Updates
`
,
ExtensionsLabel
);
Registry
.
as
<
IConfigurationRegistry
>
(
ConfigurationExtensions
.
Configuration
)
.
registerConfiguration
({
...
...
src/vs/workbench/parts/indentation/common/indentationCommands.ts
已删除
100644 → 0
浏览文件 @
217f9622
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
ICommand
,
ICursorStateComputerData
,
IEditOperationBuilder
,
ITokenizedModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
Selection
}
from
'
vs/editor/common/core/selection
'
;
function
getIndentationEditOperations
(
model
:
ITokenizedModel
,
builder
:
IEditOperationBuilder
,
tabSize
:
number
,
tabsToSpaces
:
boolean
):
void
{
if
(
model
.
getLineCount
()
===
1
&&
model
.
getLineMaxColumn
(
1
)
===
1
)
{
// Model is empty
return
;
}
let
spaces
=
''
;
for
(
let
i
=
0
;
i
<
tabSize
;
i
++
)
{
spaces
+=
'
'
;
}
const
content
=
model
.
getLinesContent
();
for
(
let
i
=
0
;
i
<
content
.
length
;
i
++
)
{
let
lastIndentationColumn
=
model
.
getLineFirstNonWhitespaceColumn
(
i
+
1
);
if
(
lastIndentationColumn
===
0
)
{
lastIndentationColumn
=
model
.
getLineMaxColumn
(
i
+
1
);
}
const
text
=
(
tabsToSpaces
?
content
[
i
].
substr
(
0
,
lastIndentationColumn
).
replace
(
/
\t
/ig
,
spaces
)
:
content
[
i
].
substr
(
0
,
lastIndentationColumn
).
replace
(
new
RegExp
(
spaces
,
'
gi
'
),
'
\t
'
))
+
content
[
i
].
substr
(
lastIndentationColumn
);
builder
.
addEditOperation
(
new
Range
(
i
+
1
,
1
,
i
+
1
,
model
.
getLineMaxColumn
(
i
+
1
)),
text
);
}
}
export
class
IndentationToSpacesCommand
implements
ICommand
{
private
selectionId
:
string
;
constructor
(
private
selection
:
Selection
,
private
tabSize
:
number
)
{
}
public
getEditOperations
(
model
:
ITokenizedModel
,
builder
:
IEditOperationBuilder
):
void
{
this
.
selectionId
=
builder
.
trackSelection
(
this
.
selection
);
getIndentationEditOperations
(
model
,
builder
,
this
.
tabSize
,
true
);
}
public
computeCursorState
(
model
:
ITokenizedModel
,
helper
:
ICursorStateComputerData
):
Selection
{
return
helper
.
getTrackedSelection
(
this
.
selectionId
);
}
}
export
class
IndentationToTabsCommand
implements
ICommand
{
private
selectionId
:
string
;
constructor
(
private
selection
:
Selection
,
private
tabSize
:
number
)
{
}
public
getEditOperations
(
model
:
ITokenizedModel
,
builder
:
IEditOperationBuilder
):
void
{
this
.
selectionId
=
builder
.
trackSelection
(
this
.
selection
);
getIndentationEditOperations
(
model
,
builder
,
this
.
tabSize
,
false
);
}
public
computeCursorState
(
model
:
ITokenizedModel
,
helper
:
ICursorStateComputerData
):
Selection
{
return
helper
.
getTrackedSelection
(
this
.
selectionId
);
}
}
src/vs/workbench/
parts/indentation/test/common/indentationCommands
.test.ts
→
src/vs/workbench/
test/common/editor/indentation
.test.ts
浏览文件 @
5d429192
...
...
@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import
{
Selection
}
from
'
vs/editor/common/core/selection
'
;
import
{
IndentationToSpacesCommand
,
IndentationToTabsCommand
}
from
'
vs/workbench/
parts/indentation/common/indentationCommands
'
;
import
{
IndentationToSpacesCommand
,
IndentationToTabsCommand
}
from
'
vs/workbench/
common/editor/indentation
'
;
import
{
testCommand
}
from
'
vs/editor/test/common/commands/commandTestUtils
'
;
function
testIndentationToSpacesCommand
(
lines
:
string
[],
selection
:
Selection
,
tabSize
:
number
,
expectedLines
:
string
[],
expectedSelection
:
Selection
):
void
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录