Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
c91055d2
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,发现更多精彩内容 >>
提交
c91055d2
编写于
3月 21, 2019
作者:
D
David Barbet
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename TryGetOwningWorkspace to TryGetWorkspace.
上级
8c6c0c1c
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
23 addition
and
24 deletion
+23
-24
src/EditorFeatures/Core.Wpf/InlineRename/CommandHandlers/RenameCommandHandler_RenameHandler.cs
...ame/CommandHandlers/RenameCommandHandler_RenameHandler.cs
+2
-2
src/EditorFeatures/Core/CommandHandlers/GoToAdjacentMemberCommandHandler.cs
.../Core/CommandHandlers/GoToAdjacentMemberCommandHandler.cs
+9
-10
src/EditorFeatures/Core/GoToImplementation/GoToImplementationCommandHandler.cs
...re/GoToImplementation/GoToImplementationCommandHandler.cs
+1
-1
src/EditorFeatures/Core/Implementation/ChangeSignature/AbstractChangeSignatureCommandHandler.cs
.../ChangeSignature/AbstractChangeSignatureCommandHandler.cs
+3
-3
src/EditorFeatures/Core/Implementation/ExtractInterface/AbstractExtractInterfaceCommandHandler.cs
...xtractInterface/AbstractExtractInterfaceCommandHandler.cs
+4
-4
src/EditorFeatures/Core/Implementation/ExtractMethod/AbstractExtractMethodCommandHandler.cs
...tion/ExtractMethod/AbstractExtractMethodCommandHandler.cs
+1
-1
src/EditorFeatures/Core/Implementation/Organizing/OrganizeDocumentCommandHandler.cs
...plementation/Organizing/OrganizeDocumentCommandHandler.cs
+1
-1
src/EditorFeatures/Core/Shared/Extensions/ITextBufferExtensions.cs
...rFeatures/Core/Shared/Extensions/ITextBufferExtensions.cs
+2
-2
未找到文件。
src/EditorFeatures/Core.Wpf/InlineRename/CommandHandlers/RenameCommandHandler_RenameHandler.cs
浏览文件 @
c91055d2
...
...
@@ -24,7 +24,7 @@ public VSCommanding.CommandState GetCommandState(RenameCommandArgs args)
return
VSCommanding
.
CommandState
.
Unspecified
;
}
if
(!
args
.
SubjectBuffer
.
TryGet
Owning
Workspace
(
out
var
workspace
)
||
if
(!
args
.
SubjectBuffer
.
TryGetWorkspace
(
out
var
workspace
)
||
!
workspace
.
CanApplyChange
(
ApplyChangesKind
.
ChangeDocument
)
||
!
args
.
SubjectBuffer
.
SupportsRename
())
{
...
...
@@ -46,7 +46,7 @@ public bool ExecuteCommand(RenameCommandArgs args, CommandExecutionContext conte
private
void
ExecuteRenameWorker
(
RenameCommandArgs
args
,
CommandExecutionContext
context
)
{
if
(!
args
.
SubjectBuffer
.
TryGet
Owning
Workspace
(
out
var
workspace
))
if
(!
args
.
SubjectBuffer
.
TryGetWorkspace
(
out
var
workspace
))
{
return
;
}
...
...
src/EditorFeatures/Core/CommandHandlers/GoToAdjacentMemberCommandHandler.cs
浏览文件 @
c91055d2
...
...
@@ -60,13 +60,14 @@ public bool ExecuteCommand(GoToPreviousMemberCommandArgs args, CommandExecutionC
private
VSCommanding
.
CommandState
GetCommandStateImpl
(
EditorCommandArgs
args
)
{
var
caretPoint
=
args
.
TextView
.
GetCaretPoint
(
args
.
SubjectBuffer
);
if
(!
IsAvailable
(
caretPoint
,
args
.
SubjectBuffer
))
var
subjectBuffer
=
args
.
SubjectBuffer
;
var
caretPoint
=
args
.
TextView
.
GetCaretPoint
(
subjectBuffer
);
if
(!
caretPoint
.
HasValue
||
!
subjectBuffer
.
SupportsNavigationToAnyPosition
())
{
return
VSCommanding
.
CommandState
.
Unspecified
;
}
var
document
=
args
.
S
ubjectBuffer
.
CurrentSnapshot
.
GetOpenDocumentInCurrentContextWithChanges
();
var
document
=
s
ubjectBuffer
.
CurrentSnapshot
.
GetOpenDocumentInCurrentContextWithChanges
();
if
(
document
?.
SupportsSyntaxTree
!=
true
)
{
return
VSCommanding
.
CommandState
.
Unspecified
;
...
...
@@ -75,19 +76,17 @@ private VSCommanding.CommandState GetCommandStateImpl(EditorCommandArgs args)
return
VSCommanding
.
CommandState
.
Available
;
}
private
static
bool
IsAvailable
(
SnapshotPoint
?
caretPoint
,
ITextBuffer
subjectBuffer
)
=>
caretPoint
.
HasValue
&&
subjectBuffer
.
SupportsNavigationToAnyPosition
();
private
bool
ExecuteCommandImpl
(
EditorCommandArgs
args
,
bool
gotoNextMember
,
CommandExecutionContext
context
)
{
var
caretPoint
=
args
.
TextView
.
GetCaretPoint
(
args
.
SubjectBuffer
);
if
(!
IsAvailable
(
caretPoint
,
args
.
SubjectBuffer
))
var
subjectBuffer
=
args
.
SubjectBuffer
;
var
caretPoint
=
args
.
TextView
.
GetCaretPoint
(
subjectBuffer
);
if
(!
caretPoint
.
HasValue
||
!
subjectBuffer
.
SupportsNavigationToAnyPosition
())
{
return
false
;
}
var
document
=
args
.
S
ubjectBuffer
.
CurrentSnapshot
.
GetOpenDocumentInCurrentContextWithChanges
();
var
document
=
s
ubjectBuffer
.
CurrentSnapshot
.
GetOpenDocumentInCurrentContextWithChanges
();
if
(
document
?.
SupportsSyntaxTree
!=
true
)
{
return
false
;
...
...
@@ -103,7 +102,7 @@ private bool ExecuteCommandImpl(EditorCommandArgs args, bool gotoNextMember, Com
if
(
targetPosition
!=
null
)
{
args
.
TextView
.
TryMoveCaretToAndEnsureVisible
(
new
SnapshotPoint
(
args
.
S
ubjectBuffer
.
CurrentSnapshot
,
targetPosition
.
Value
),
_outliningManagerService
);
args
.
TextView
.
TryMoveCaretToAndEnsureVisible
(
new
SnapshotPoint
(
s
ubjectBuffer
.
CurrentSnapshot
,
targetPosition
.
Value
),
_outliningManagerService
);
}
return
true
;
...
...
src/EditorFeatures/Core/GoToImplementation/GoToImplementationCommandHandler.cs
浏览文件 @
c91055d2
...
...
@@ -52,7 +52,7 @@ public bool ExecuteCommand(GoToImplementationCommandArgs args, CommandExecutionC
using
(
context
.
OperationContext
.
AddScope
(
allowCancellation
:
true
,
EditorFeaturesResources
.
Locating_implementations
))
{
var
subjectBuffer
=
args
.
SubjectBuffer
;
if
(!
subjectBuffer
.
TryGet
Owning
Workspace
(
out
var
workspace
))
if
(!
subjectBuffer
.
TryGetWorkspace
(
out
var
workspace
))
{
return
false
;
}
...
...
src/EditorFeatures/Core/Implementation/ChangeSignature/AbstractChangeSignatureCommandHandler.cs
浏览文件 @
c91055d2
...
...
@@ -38,9 +38,9 @@ public bool ExecuteCommand(ReorderParametersCommandArgs args, CommandExecutionCo
=>
ExecuteCommand
(
args
.
TextView
,
args
.
SubjectBuffer
,
context
);
private
static
bool
IsAvailable
(
ITextBuffer
subjectBuffer
,
out
Workspace
workspace
)
=>
subjectBuffer
.
TryGet
Owning
Workspace
(
out
workspace
)
&&
workspace
.
CanApplyChange
(
ApplyChangesKind
.
ChangeDocument
)
&&
subjectBuffer
.
SupportsRefactorings
();
=>
subjectBuffer
.
TryGetWorkspace
(
out
workspace
)
&&
workspace
.
CanApplyChange
(
ApplyChangesKind
.
ChangeDocument
)
&&
subjectBuffer
.
SupportsRefactorings
();
private
bool
ExecuteCommand
(
ITextView
textView
,
ITextBuffer
subjectBuffer
,
CommandExecutionContext
context
)
{
...
...
src/EditorFeatures/Core/Implementation/ExtractInterface/AbstractExtractInterfaceCommandHandler.cs
浏览文件 @
c91055d2
...
...
@@ -85,9 +85,9 @@ public bool ExecuteCommand(ExtractInterfaceCommandArgs args, CommandExecutionCon
}
private
static
bool
IsAvailable
(
ITextBuffer
subjectBuffer
,
out
Workspace
workspace
)
=>
subjectBuffer
.
TryGet
Owning
Workspace
(
out
workspace
)
&&
workspace
.
CanApplyChange
(
ApplyChangesKind
.
AddDocument
)
&&
workspace
.
CanApplyChange
(
ApplyChangesKind
.
ChangeDocument
)
&&
subjectBuffer
.
SupportsRefactorings
();
=>
subjectBuffer
.
TryGetWorkspace
(
out
workspace
)
&&
workspace
.
CanApplyChange
(
ApplyChangesKind
.
AddDocument
)
&&
workspace
.
CanApplyChange
(
ApplyChangesKind
.
ChangeDocument
)
&&
subjectBuffer
.
SupportsRefactorings
();
}
}
src/EditorFeatures/Core/Implementation/ExtractMethod/AbstractExtractMethodCommandHandler.cs
浏览文件 @
c91055d2
...
...
@@ -50,7 +50,7 @@ public VSCommanding.CommandState GetCommandState(ExtractMethodCommandArgs args)
return
VSCommanding
.
CommandState
.
Unspecified
;
}
if
(!
args
.
SubjectBuffer
.
TryGet
Owning
Workspace
(
out
var
workspace
)
||
if
(!
args
.
SubjectBuffer
.
TryGetWorkspace
(
out
var
workspace
)
||
!
workspace
.
CanApplyChange
(
ApplyChangesKind
.
ChangeDocument
)
||
!
args
.
SubjectBuffer
.
SupportsRefactorings
())
{
...
...
src/EditorFeatures/Core/Implementation/Organizing/OrganizeDocumentCommandHandler.cs
浏览文件 @
c91055d2
...
...
@@ -77,7 +77,7 @@ private VSCommanding.CommandState GetCommandState(EditorCommandArgs args, Func<I
private
bool
IsCommandSupported
(
EditorCommandArgs
args
,
out
Workspace
workspace
)
{
workspace
=
null
;
if
(
args
.
SubjectBuffer
.
TryGet
Owning
Workspace
(
out
var
retrievedWorkspace
))
if
(
args
.
SubjectBuffer
.
TryGetWorkspace
(
out
var
retrievedWorkspace
))
{
workspace
=
retrievedWorkspace
;
if
(!
workspace
.
CanApplyChange
(
ApplyChangesKind
.
ChangeDocument
))
...
...
src/EditorFeatures/Core/Shared/Extensions/ITextBufferExtensions.cs
浏览文件 @
c91055d2
...
...
@@ -44,7 +44,7 @@ internal static bool GetFeatureOnOffOption(this ITextBuffer buffer, PerLanguageO
}
}
internal
static
bool
TryGet
Owning
Workspace
(
this
ITextBuffer
buffer
,
out
Workspace
workspace
)
internal
static
bool
TryGetWorkspace
(
this
ITextBuffer
buffer
,
out
Workspace
workspace
)
=>
Workspace
.
TryGetWorkspace
(
buffer
.
AsTextContainer
(),
out
workspace
);
/// <summary>
...
...
@@ -74,7 +74,7 @@ internal static bool SupportsNavigationToAnyPosition(this ITextBuffer buffer)
private
static
bool
TryGetSupportsFeatureService
(
ITextBuffer
buffer
,
out
ITextBufferSupportsFeatureService
service
)
{
service
=
null
;
if
(
buffer
.
TryGet
Owning
Workspace
(
out
var
workspace
))
if
(
buffer
.
TryGetWorkspace
(
out
var
workspace
))
{
service
=
workspace
.
Services
.
GetService
<
ITextBufferSupportsFeatureService
>();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录