Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
8b62f184
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,发现更多精彩内容 >>
提交
8b62f184
编写于
11月 28, 2016
作者:
C
CyrusNajmabadi
提交者:
GitHub
11月 28, 2016
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #15552 from CyrusNajmabadi/docCommentHandler2
Remove dependency between DocComment insertion and Completion.
上级
7280be7f
530b0000
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
25 addition
and
64 deletion
+25
-64
src/EditorFeatures/CSharp/DocumentationComments/DocumentationCommentCommandHandler.cs
...cumentationComments/DocumentationCommentCommandHandler.cs
+4
-7
src/EditorFeatures/CSharpTest/DocumentationComments/DocumentationCommentTests.cs
...rpTest/DocumentationComments/DocumentationCommentTests.cs
+3
-4
src/EditorFeatures/Core/CommandHandlers/CompletionCommandHandler.cs
...Features/Core/CommandHandlers/CompletionCommandHandler.cs
+2
-1
src/EditorFeatures/Core/Extensibility/Completion/IAsyncCompletionService.cs
.../Core/Extensibility/Completion/IAsyncCompletionService.cs
+0
-2
src/EditorFeatures/Core/Implementation/DocumentationComments/AbstractDocumentationCommentCommandHandler.cs
...ionComments/AbstractDocumentationCommentCommandHandler.cs
+1
-13
src/EditorFeatures/Core/Implementation/IntelliSense/Completion/AsyncCompletionService.cs
...ntation/IntelliSense/Completion/AsyncCompletionService.cs
+0
-10
src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller.cs
...Core/Implementation/IntelliSense/Completion/Controller.cs
+4
-14
src/EditorFeatures/TestUtilities/DocumentationComments/AbstractDocumentationCommentTests.cs
...ocumentationComments/AbstractDocumentationCommentTests.cs
+6
-7
src/EditorFeatures/VisualBasic/DocumentationComments/DocumentationCommentCommandHandler.vb
...cumentationComments/DocumentationCommentCommandHandler.vb
+3
-3
src/EditorFeatures/VisualBasicTest/DocumentationComments/DocumentationCommentTests.vb
...icTest/DocumentationComments/DocumentationCommentTests.vb
+2
-3
未找到文件。
src/EditorFeatures/CSharp/DocumentationComments/DocumentationCommentCommandHandler.cs
浏览文件 @
8b62f184
...
...
@@ -18,6 +18,7 @@ namespace Microsoft.CodeAnalysis.Editor.CSharp.DocumentationComments
{
[
ExportCommandHandler
(
PredefinedCommandHandlerNames
.
DocumentationComments
,
ContentTypeNames
.
CSharpContentType
)]
[
Order
(
After
=
PredefinedCommandHandlerNames
.
Rename
)]
[
Order
(
After
=
PredefinedCommandHandlerNames
.
Completion
)]
internal
class
DocumentationCommentCommandHandler
:
AbstractDocumentationCommentCommandHandler
<
DocumentationCommentTriviaSyntax
,
MemberDeclarationSyntax
>
{
...
...
@@ -25,16 +26,12 @@ internal class DocumentationCommentCommandHandler
public
DocumentationCommentCommandHandler
(
IWaitIndicator
waitIndicator
,
ITextUndoHistoryRegistry
undoHistoryRegistry
,
IEditorOperationsFactoryService
editorOperationsFactoryService
,
IAsyncCompletionService
completionService
)
:
base
(
waitIndicator
,
undoHistoryRegistry
,
editorOperationsFactoryService
,
completionService
)
IEditorOperationsFactoryService
editorOperationsFactoryService
)
:
base
(
waitIndicator
,
undoHistoryRegistry
,
editorOperationsFactoryService
)
{
}
protected
override
string
ExteriorTriviaText
{
get
{
return
"///"
;
}
}
protected
override
string
ExteriorTriviaText
=>
"///"
;
protected
override
MemberDeclarationSyntax
GetContainingMember
(
SyntaxTree
syntaxTree
,
int
position
,
CancellationToken
cancellationToken
)
...
...
src/EditorFeatures/CSharpTest/DocumentationComments/DocumentationCommentTests.cs
浏览文件 @
8b62f184
...
...
@@ -1886,10 +1886,9 @@ protected override char DocumentationCommentCharacter
internal
override
ICommandHandler
CreateCommandHandler
(
IWaitIndicator
waitIndicator
,
ITextUndoHistoryRegistry
undoHistoryRegistry
,
IEditorOperationsFactoryService
editorOperationsFactoryService
,
IAsyncCompletionService
completionService
)
IEditorOperationsFactoryService
editorOperationsFactoryService
)
{
return
new
DocumentationCommentCommandHandler
(
waitIndicator
,
undoHistoryRegistry
,
editorOperationsFactoryService
,
completionService
);
return
new
DocumentationCommentCommandHandler
(
waitIndicator
,
undoHistoryRegistry
,
editorOperationsFactoryService
);
}
protected
override
Task
<
TestWorkspace
>
CreateTestWorkspaceAsync
(
string
code
)
...
...
@@ -1897,4 +1896,4 @@ protected override Task<TestWorkspace> CreateTestWorkspaceAsync(string code)
return
TestWorkspace
.
CreateCSharpAsync
(
code
);
}
}
}
}
\ No newline at end of file
src/EditorFeatures/Core/CommandHandlers/CompletionCommandHandler.cs
浏览文件 @
8b62f184
...
...
@@ -7,7 +7,8 @@ namespace Microsoft.CodeAnalysis.Editor.CommandHandlers
{
[
Export
]
[
ExportCommandHandler
(
PredefinedCommandHandlerNames
.
Completion
,
ContentTypeNames
.
RoslynContentType
)]
[
Order
(
After
=
PredefinedCommandHandlerNames
.
SignatureHelp
)]
[
Order
(
After
=
PredefinedCommandHandlerNames
.
SignatureHelp
,
Before
=
PredefinedCommandHandlerNames
.
DocumentationComments
)]
internal
sealed
class
CompletionCommandHandler
:
AbstractCompletionCommandHandler
{
[
ImportingConstructor
]
...
...
src/EditorFeatures/Core/Extensibility/Completion/IAsyncCompletionService.cs
浏览文件 @
8b62f184
...
...
@@ -8,8 +8,6 @@ namespace Microsoft.CodeAnalysis.Editor
{
internal
interface
IAsyncCompletionService
{
bool
WaitForComputation
(
ITextView
textView
,
ITextBuffer
subjectBuffer
);
bool
TryGetController
(
ITextView
textView
,
ITextBuffer
subjectBuffer
,
out
Controller
controller
);
}
}
src/EditorFeatures/Core/Implementation/DocumentationComments/AbstractDocumentationCommentCommandHandler.cs
浏览文件 @
8b62f184
...
...
@@ -32,23 +32,19 @@ internal abstract class AbstractDocumentationCommentCommandHandler<TDocumentatio
private
readonly
IWaitIndicator
_waitIndicator
;
private
readonly
ITextUndoHistoryRegistry
_undoHistoryRegistry
;
private
readonly
IEditorOperationsFactoryService
_editorOperationsFactoryService
;
private
readonly
IAsyncCompletionService
_completionService
;
protected
AbstractDocumentationCommentCommandHandler
(
IWaitIndicator
waitIndicator
,
ITextUndoHistoryRegistry
undoHistoryRegistry
,
IEditorOperationsFactoryService
editorOperationsFactoryService
,
IAsyncCompletionService
completionService
)
IEditorOperationsFactoryService
editorOperationsFactoryService
)
{
Contract
.
ThrowIfNull
(
waitIndicator
);
Contract
.
ThrowIfNull
(
undoHistoryRegistry
);
Contract
.
ThrowIfNull
(
editorOperationsFactoryService
);
Contract
.
ThrowIfNull
(
completionService
);
_waitIndicator
=
waitIndicator
;
_undoHistoryRegistry
=
undoHistoryRegistry
;
_editorOperationsFactoryService
=
editorOperationsFactoryService
;
_completionService
=
completionService
;
}
protected
abstract
string
ExteriorTriviaText
{
get
;
}
...
...
@@ -518,14 +514,6 @@ public void ExecuteCommand(ReturnKeyCommandArgs args, Action nextHandler)
return
;
}
// Finally, wait and see if completion is computing. If it is, we want to allow
// the list to pop up rather than insert a blank line in the buffer.
if
(
_completionService
.
WaitForComputation
(
args
.
TextView
,
args
.
SubjectBuffer
))
{
nextHandler
();
return
;
}
// According to JasonMal, the text undo history is associated with the surface buffer
// in projection buffer scenarios, so the following line's usage of the surface buffer
// is correct.
...
...
src/EditorFeatures/Core/Implementation/IntelliSense/Completion/AsyncCompletionService.cs
浏览文件 @
8b62f184
...
...
@@ -67,16 +67,6 @@ internal class AsyncCompletionService : ForegroundThreadAffinitizedObject, IAsyn
_autoBraceCompletionCharSet
=
new
Dictionary
<
IContentType
,
ImmutableHashSet
<
char
>>();
}
public
bool
WaitForComputation
(
ITextView
textView
,
ITextBuffer
subjectBuffer
)
{
if
(!
TryGetController
(
textView
,
subjectBuffer
,
out
var
controller
))
{
return
false
;
}
return
controller
.
WaitForComputation
();
}
public
bool
TryGetController
(
ITextView
textView
,
ITextBuffer
subjectBuffer
,
out
Controller
controller
)
{
AssertIsForeground
();
...
...
src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller.cs
浏览文件 @
8b62f184
...
...
@@ -90,18 +90,6 @@ internal partial class Controller :
isDebugger
,
isImmediateWindow
));
}
internal
bool
WaitForComputation
()
{
if
(
sessionOpt
==
null
)
{
return
false
;
}
var
model
=
sessionOpt
.
WaitForModel
();
return
model
!=
null
;
}
private
SnapshotPoint
GetCaretPointInViewBuffer
()
{
AssertIsForeground
();
...
...
@@ -125,8 +113,10 @@ internal override void OnModelUpdated(Model modelOpt)
{
var
selectedItem
=
modelOpt
.
SelectedItem
;
var
viewSpan
=
selectedItem
==
null
?
(
ViewTextSpan
?)
null
:
modelOpt
.
GetViewBufferSpan
(
selectedItem
.
Span
);
var
triggerSpan
=
viewSpan
==
null
?
null
:
modelOpt
.
GetCurrentSpanInSnapshot
(
viewSpan
.
Value
,
this
.
TextView
.
TextSnapshot
)
.
CreateTrackingSpan
(
SpanTrackingMode
.
EdgeInclusive
);
var
triggerSpan
=
viewSpan
==
null
?
null
:
modelOpt
.
GetCurrentSpanInSnapshot
(
viewSpan
.
Value
,
this
.
TextView
.
TextSnapshot
)
.
CreateTrackingSpan
(
SpanTrackingMode
.
EdgeInclusive
);
sessionOpt
.
PresenterSession
.
PresentItems
(
triggerSpan
,
modelOpt
.
FilteredItems
,
selectedItem
,
...
...
src/EditorFeatures/TestUtilities/DocumentationComments/AbstractDocumentationCommentTests.cs
浏览文件 @
8b62f184
...
...
@@ -9,7 +9,6 @@
using
Microsoft.CodeAnalysis.Editor.UnitTests.Utilities
;
using
Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces
;
using
Microsoft.CodeAnalysis.Formatting
;
using
Microsoft.CodeAnalysis.Options
;
using
Microsoft.VisualStudio.Text
;
using
Microsoft.VisualStudio.Text.Editor
;
using
Microsoft.VisualStudio.Text.Operations
;
...
...
@@ -22,7 +21,7 @@ public abstract class AbstractDocumentationCommentTests
{
protected
abstract
char
DocumentationCommentCharacter
{
get
;
}
internal
abstract
ICommandHandler
CreateCommandHandler
(
IWaitIndicator
waitIndicator
,
ITextUndoHistoryRegistry
undoHistoryRegistry
,
IEditorOperationsFactoryService
editorOperationsFactoryService
,
IAsyncCompletionService
completionService
);
internal
abstract
ICommandHandler
CreateCommandHandler
(
IWaitIndicator
waitIndicator
,
ITextUndoHistoryRegistry
undoHistoryRegistry
,
IEditorOperationsFactoryService
editorOperationsFactoryService
);
protected
abstract
Task
<
TestWorkspace
>
CreateTestWorkspaceAsync
(
string
code
);
protected
async
Task
VerifyTypingCharacterAsync
(
string
initialMarkup
,
string
expectedMarkup
,
bool
useTabs
=
false
,
bool
autoGenerateXmlDocComments
=
true
)
...
...
@@ -30,7 +29,7 @@ protected async Task VerifyTypingCharacterAsync(string initialMarkup, string exp
await
VerifyAsync
(
initialMarkup
,
expectedMarkup
,
useTabs
,
autoGenerateXmlDocComments
,
execute
:
(
view
,
undoHistoryRegistry
,
editorOperationsFactoryService
,
completionService
)
=>
{
var
commandHandler
=
CreateCommandHandler
(
TestWaitIndicator
.
Default
,
undoHistoryRegistry
,
editorOperationsFactoryService
,
completionService
)
as
ICommandHandler
<
TypeCharCommandArgs
>;
var
commandHandler
=
CreateCommandHandler
(
TestWaitIndicator
.
Default
,
undoHistoryRegistry
,
editorOperationsFactoryService
)
as
ICommandHandler
<
TypeCharCommandArgs
>;
var
commandArgs
=
new
TypeCharCommandArgs
(
view
,
view
.
TextBuffer
,
DocumentationCommentCharacter
);
var
nextHandler
=
CreateInsertTextHandler
(
view
,
DocumentationCommentCharacter
.
ToString
());
...
...
@@ -44,7 +43,7 @@ protected async Task VerifyPressingEnterAsync(string initialMarkup, string expec
await
VerifyAsync
(
initialMarkup
,
expectedMarkup
,
useTabs
,
autoGenerateXmlDocComments
,
execute
:
(
view
,
undoHistoryRegistry
,
editorOperationsFactoryService
,
completionService
)
=>
{
var
commandHandler
=
CreateCommandHandler
(
TestWaitIndicator
.
Default
,
undoHistoryRegistry
,
editorOperationsFactoryService
,
completionService
)
as
ICommandHandler
<
ReturnKeyCommandArgs
>;
var
commandHandler
=
CreateCommandHandler
(
TestWaitIndicator
.
Default
,
undoHistoryRegistry
,
editorOperationsFactoryService
)
as
ICommandHandler
<
ReturnKeyCommandArgs
>;
var
commandArgs
=
new
ReturnKeyCommandArgs
(
view
,
view
.
TextBuffer
);
var
nextHandler
=
CreateInsertTextHandler
(
view
,
"\r\n"
);
...
...
@@ -58,7 +57,7 @@ protected async Task VerifyInsertCommentCommandAsync(string initialMarkup, strin
await
VerifyAsync
(
initialMarkup
,
expectedMarkup
,
useTabs
,
autoGenerateXmlDocComments
,
execute
:
(
view
,
undoHistoryRegistry
,
editorOperationsFactoryService
,
completionService
)
=>
{
var
commandHandler
=
CreateCommandHandler
(
TestWaitIndicator
.
Default
,
undoHistoryRegistry
,
editorOperationsFactoryService
,
completionService
)
as
ICommandHandler
<
InsertCommentCommandArgs
>;
var
commandHandler
=
CreateCommandHandler
(
TestWaitIndicator
.
Default
,
undoHistoryRegistry
,
editorOperationsFactoryService
)
as
ICommandHandler
<
InsertCommentCommandArgs
>;
var
commandArgs
=
new
InsertCommentCommandArgs
(
view
,
view
.
TextBuffer
);
Action
nextHandler
=
delegate
{
};
...
...
@@ -72,7 +71,7 @@ protected async Task VerifyOpenLineAboveAsync(string initialMarkup, string expec
await
VerifyAsync
(
initialMarkup
,
expectedMarkup
,
useTabs
,
autoGenerateXmlDocComments
,
execute
:
(
view
,
undoHistoryRegistry
,
editorOperationsFactoryService
,
completionService
)
=>
{
var
commandHandler
=
CreateCommandHandler
(
TestWaitIndicator
.
Default
,
undoHistoryRegistry
,
editorOperationsFactoryService
,
completionService
)
as
ICommandHandler
<
OpenLineAboveCommandArgs
>;
var
commandHandler
=
CreateCommandHandler
(
TestWaitIndicator
.
Default
,
undoHistoryRegistry
,
editorOperationsFactoryService
)
as
ICommandHandler
<
OpenLineAboveCommandArgs
>;
var
commandArgs
=
new
OpenLineAboveCommandArgs
(
view
,
view
.
TextBuffer
);
Action
nextHandler
=
()
=>
...
...
@@ -90,7 +89,7 @@ protected async Task VerifyOpenLineBelowAsync(string initialMarkup, string expec
await
VerifyAsync
(
initialMarkup
,
expectedMarkup
,
useTabs
,
autoGenerateXmlDocComments
,
execute
:
(
view
,
undoHistoryRegistry
,
editorOperationsFactoryService
,
completionService
)
=>
{
var
commandHandler
=
CreateCommandHandler
(
TestWaitIndicator
.
Default
,
undoHistoryRegistry
,
editorOperationsFactoryService
,
completionService
)
as
ICommandHandler
<
OpenLineBelowCommandArgs
>;
var
commandHandler
=
CreateCommandHandler
(
TestWaitIndicator
.
Default
,
undoHistoryRegistry
,
editorOperationsFactoryService
)
as
ICommandHandler
<
OpenLineBelowCommandArgs
>;
var
commandArgs
=
new
OpenLineBelowCommandArgs
(
view
,
view
.
TextBuffer
);
Action
nextHandler
=
()
=>
...
...
src/EditorFeatures/VisualBasic/DocumentationComments/DocumentationCommentCommandHandler.vb
浏览文件 @
8b62f184
...
...
@@ -11,6 +11,7 @@ Imports Microsoft.VisualStudio.Utilities
Namespace
Microsoft.CodeAnalysis.Editor.VisualBasic.DocumentationComments
<
ExportCommandHandler
(
PredefinedCommandHandlerNames
.
DocumentationComments
,
ContentTypeNames
.
VisualBasicContentType
)
>
<
Order
(
Before
:
=
PredefinedCommandHandlerNames
.
Commit
,
After
:
=
PredefinedCommandHandlerNames
.
Rename
)
>
<
Order
(
After
:
=
PredefinedCommandHandlerNames
.
Completion
)
>
Friend
Class
DocumentationCommentCommandHandler
Inherits
AbstractDocumentationCommentCommandHandler
(
Of
DocumentationCommentTriviaSyntax
,
DeclarationStatementSyntax
)
...
...
@@ -18,10 +19,9 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.DocumentationComments
Public
Sub
New
(
waitIndicator
As
IWaitIndicator
,
undoHistoryRegistry
As
ITextUndoHistoryRegistry
,
editorOperationsFactoryService
As
IEditorOperationsFactoryService
,
completionService
As
IAsyncCompletionService
)
editorOperationsFactoryService
As
IEditorOperationsFactoryService
)
MyBase
.
New
(
waitIndicator
,
undoHistoryRegistry
,
editorOperationsFactoryService
,
completionService
)
MyBase
.
New
(
waitIndicator
,
undoHistoryRegistry
,
editorOperationsFactoryService
)
End
Sub
Protected
Overrides
ReadOnly
Property
ExteriorTriviaText
As
String
...
...
src/EditorFeatures/VisualBasicTest/DocumentationComments/DocumentationCommentTests.vb
浏览文件 @
8b62f184
...
...
@@ -1197,10 +1197,9 @@ End Class
Friend
Overrides
Function
CreateCommandHandler
(
waitIndicator
As
IWaitIndicator
,
undoHistoryRegistry
As
ITextUndoHistoryRegistry
,
editorOperationsFactoryService
As
IEditorOperationsFactoryService
,
completionService
As
IAsyncCompletionService
)
As
ICommandHandler
editorOperationsFactoryService
As
IEditorOperationsFactoryService
)
As
ICommandHandler
Return
New
DocumentationCommentCommandHandler
(
waitIndicator
,
undoHistoryRegistry
,
editorOperationsFactoryService
,
completionService
)
Return
New
DocumentationCommentCommandHandler
(
waitIndicator
,
undoHistoryRegistry
,
editorOperationsFactoryService
)
End
Function
Protected
Overrides
Function
CreateTestWorkspaceAsync
(
code
As
String
)
As
Task
(
Of
TestWorkspace
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录