Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
b8143e51
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b8143e51
编写于
6月 08, 2016
作者:
C
CyrusNajmabadi
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #11843 from CyrusNajmabadi/asyncIndentation
Restore the old IIndentationService.
上级
c79306df
3a026cea
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
28 addition
and
9 deletion
+28
-9
src/EditorFeatures/CSharp/Formatting/Indentation/CSharpIndentationService.cs
...CSharp/Formatting/Indentation/CSharpIndentationService.cs
+1
-1
src/EditorFeatures/CSharp/SplitStringLiteral/SplitStringLiteralCommandHandler.StringSplitter.cs
...iteral/SplitStringLiteralCommandHandler.StringSplitter.cs
+1
-1
src/EditorFeatures/Core/Implementation/Formatting/Indentation/AbstractSmartTokenFormatterCommandHandler.cs
.../Indentation/AbstractSmartTokenFormatterCommandHandler.cs
+1
-1
src/EditorFeatures/Core/Implementation/SmartIndent/AbstractIndentationService.cs
.../Implementation/SmartIndent/AbstractIndentationService.cs
+1
-1
src/EditorFeatures/Core/Implementation/SmartIndent/IIndentationService.cs
...es/Core/Implementation/SmartIndent/IIndentationService.cs
+5
-0
src/EditorFeatures/Core/Implementation/SmartIndent/SmartIndent.cs
...orFeatures/Core/Implementation/SmartIndent/SmartIndent.cs
+18
-4
src/EditorFeatures/VisualBasic/Formatting/Indentation/VisualBasicIndentationService.vb
...c/Formatting/Indentation/VisualBasicIndentationService.vb
+1
-1
未找到文件。
src/EditorFeatures/CSharp/Formatting/Indentation/CSharpIndentationService.cs
浏览文件 @
b8143e51
...
...
@@ -21,7 +21,7 @@
namespace
Microsoft.CodeAnalysis.Editor.CSharp.Formatting.Indentation
{
[
ExportLanguageService
(
typeof
(
IIndentationService
),
LanguageNames
.
CSharp
),
Shared
]
[
ExportLanguageService
(
typeof
(
I
Synchronous
IndentationService
),
LanguageNames
.
CSharp
),
Shared
]
internal
partial
class
CSharpIndentationService
:
AbstractIndentationService
{
private
static
readonly
IFormattingRule
s_instance
=
new
FormattingRule
();
...
...
src/EditorFeatures/CSharp/SplitStringLiteral/SplitStringLiteralCommandHandler.StringSplitter.cs
浏览文件 @
b8143e51
...
...
@@ -150,7 +150,7 @@ private string GetIndentString(SyntaxNode newRoot)
{
var
newDocument
=
Document
.
WithSyntaxRoot
(
newRoot
);
var
indentationService
=
newDocument
.
GetLanguageService
<
IIndentationService
>();
var
indentationService
=
newDocument
.
GetLanguageService
<
I
Synchronous
IndentationService
>();
var
originalLineNumber
=
SourceText
.
Lines
.
GetLineFromPosition
(
CursorPosition
).
LineNumber
;
var
desiredIndentation
=
indentationService
.
GetDesiredIndentation
(
newDocument
,
originalLineNumber
+
1
,
CancellationToken
);
...
...
src/EditorFeatures/Core/Implementation/Formatting/Indentation/AbstractSmartTokenFormatterCommandHandler.cs
浏览文件 @
b8143e51
...
...
@@ -128,7 +128,7 @@ internal void ExecuteCommandWorker(ReturnKeyCommandArgs args, CancellationToken
return
;
}
var
indentationService
=
document
.
GetLanguageService
<
IIndentationService
>();
var
indentationService
=
document
.
GetLanguageService
<
I
Synchronous
IndentationService
>();
var
indentation
=
indentationService
.
GetDesiredIndentation
(
document
,
currentPosition
.
GetContainingLine
().
LineNumber
,
cancellationToken
);
...
...
src/EditorFeatures/Core/Implementation/SmartIndent/AbstractIndentationService.cs
浏览文件 @
b8143e51
...
...
@@ -13,7 +13,7 @@
namespace
Microsoft.CodeAnalysis.Editor.Implementation.SmartIndent
{
internal
abstract
partial
class
AbstractIndentationService
:
IIndentationService
internal
abstract
partial
class
AbstractIndentationService
:
I
Synchronous
IndentationService
{
protected
abstract
IFormattingRule
GetSpecializedIndentationFormattingRule
();
...
...
src/EditorFeatures/Core/Implementation/SmartIndent/IIndentationService.cs
浏览文件 @
b8143e51
...
...
@@ -39,6 +39,11 @@ public IndentationResult(int basePosition, int offset) : this()
}
internal
interface
IIndentationService
:
ILanguageService
{
Task
<
IndentationResult
?>
GetDesiredIndentation
(
Document
document
,
int
lineNumber
,
CancellationToken
cancellationToken
);
}
internal
interface
ISynchronousIndentationService
:
ILanguageService
{
IndentationResult
?
GetDesiredIndentation
(
Document
document
,
int
lineNumber
,
CancellationToken
cancellationToken
);
}
...
...
src/EditorFeatures/Core/Implementation/SmartIndent/SmartIndent.cs
浏览文件 @
b8143e51
...
...
@@ -8,6 +8,7 @@
using
Microsoft.CodeAnalysis.Text
;
using
Microsoft.VisualStudio.Text
;
using
Microsoft.VisualStudio.Text.Editor
;
using
Roslyn.Utilities
;
namespace
Microsoft.CodeAnalysis.Editor.Implementation.SmartIndent
{
...
...
@@ -44,10 +45,23 @@ public void Dispose()
using
(
Logger
.
LogBlock
(
FunctionId
.
SmartIndentation_Start
,
cancellationToken
))
{
var
document
=
lineToBeIndented
.
Snapshot
.
GetOpenDocumentInCurrentContextWithChanges
();
var
service
=
document
?.
GetLanguageService
<
IIndentationService
>();
var
result
=
service
?.
GetDesiredIndentation
(
document
,
lineToBeIndented
.
LineNumber
,
cancellationToken
);
return
result
?.
GetIndentation
(
_textView
,
lineToBeIndented
);
var
syncService
=
document
?.
GetLanguageService
<
ISynchronousIndentationService
>();
if
(
syncService
!=
null
)
{
var
result
=
syncService
.
GetDesiredIndentation
(
document
,
lineToBeIndented
.
LineNumber
,
cancellationToken
);
return
result
?.
GetIndentation
(
_textView
,
lineToBeIndented
);
}
var
asyncService
=
document
?.
GetLanguageService
<
IIndentationService
>();
if
(
asyncService
!=
null
)
{
var
result
=
asyncService
.
GetDesiredIndentation
(
document
,
lineToBeIndented
.
LineBreakLength
,
cancellationToken
).
WaitAndGetResult
(
cancellationToken
);
return
result
?.
GetIndentation
(
_textView
,
lineToBeIndented
);
}
return
null
;
}
}
}
}
}
\ No newline at end of file
src/EditorFeatures/VisualBasic/Formatting/Indentation/VisualBasicIndentationService.vb
浏览文件 @
b8143e51
...
...
@@ -14,7 +14,7 @@ Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports
Microsoft.VisualStudio.Text
Namespace
Microsoft.CodeAnalysis.Editor.VisualBasic.Formatting.Indentation
<
ExportLanguageService
(
GetType
(
IIndentationService
),
LanguageNames
.
VisualBasic
),
[
Shared
]
>
<
ExportLanguageService
(
GetType
(
I
Synchronous
IndentationService
),
LanguageNames
.
VisualBasic
),
[
Shared
]
>
Partial
Friend
Class
VisualBasicIndentationService
Inherits
AbstractIndentationService
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录