Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
bccf2a17
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,发现更多精彩内容 >>
未验证
提交
bccf2a17
编写于
7月 29, 2020
作者:
D
David
提交者:
GitHub
7月 29, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #45305 from dibarbet/disable_local_completion
Add workspace service for determining if in cloud context
上级
399fa00e
30a659c5
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
69 addition
and
5 deletion
+69
-5
src/EditorFeatures/Core/GoToDefinition/GoToDefinitionCommandHandler.cs
...tures/Core/GoToDefinition/GoToDefinitionCommandHandler.cs
+3
-1
src/EditorFeatures/Core/Implementation/IntelliSense/AsyncCompletion/ItemManagerProvider.cs
...ation/IntelliSense/AsyncCompletion/ItemManagerProvider.cs
+18
-1
src/EditorFeatures/Core/Shared/Utilities/IWorkspaceContextService.cs
...eatures/Core/Shared/Utilities/IWorkspaceContextService.cs
+45
-0
src/Features/Core/Portable/Diagnostics/DiagnosticAnalyzerService_IncrementalAnalyzer.cs
...gnostics/DiagnosticAnalyzerService_IncrementalAnalyzer.cs
+1
-1
src/VisualStudio/LiveShare/Impl/Client/RemoteLanguageServiceWorkspace.cs
...o/LiveShare/Impl/Client/RemoteLanguageServiceWorkspace.cs
+1
-1
src/Workspaces/Core/Portable/Workspace/WorkspaceKind.cs
src/Workspaces/Core/Portable/Workspace/WorkspaceKind.cs
+1
-1
未找到文件。
src/EditorFeatures/Core/GoToDefinition/GoToDefinitionCommandHandler.cs
浏览文件 @
bccf2a17
...
...
@@ -5,6 +5,7 @@
using
System.ComponentModel.Composition
;
using
System.Diagnostics.CodeAnalysis
;
using
Microsoft.CodeAnalysis.Editor.Shared.Extensions
;
using
Microsoft.CodeAnalysis.Editor.Shared.Utilities
;
using
Microsoft.CodeAnalysis.Notification
;
using
Microsoft.CodeAnalysis.Shared.Extensions
;
using
Microsoft.CodeAnalysis.Text
;
...
...
@@ -51,7 +52,8 @@ public bool ExecuteCommand(GoToDefinitionCommandArgs args, CommandExecutionConte
// In Live Share, typescript exports a gotodefinition service that returns no results and prevents the LSP client
// from handling the request. So prevent the local service from handling goto def commands in the remote workspace.
// This can be removed once typescript implements LSP support for goto def.
if
(
service
!=
null
&&
document
.
Project
.
Solution
.
Workspace
.
Kind
!=
WorkspaceKind
.
AnyCodeRoslynWorkspace
)
var
workspaceContextService
=
document
.
Project
.
Solution
.
Workspace
.
Services
.
GetRequiredService
<
IWorkspaceContextService
>();
if
(
service
!=
null
&&
!
workspaceContextService
.
IsCloudEnvironmentClient
())
{
var
caretPos
=
args
.
TextView
.
GetCaretPoint
(
subjectBuffer
);
if
(
caretPos
.
HasValue
&&
TryExecuteCommand
(
document
,
caretPos
.
Value
,
service
,
context
))
...
...
src/EditorFeatures/Core/Implementation/IntelliSense/AsyncCompletion/ItemManagerProvider.cs
浏览文件 @
bccf2a17
...
...
@@ -4,6 +4,8 @@
using
System
;
using
System.ComponentModel.Composition
;
using
Microsoft.CodeAnalysis.Editor.Shared.Extensions
;
using
Microsoft.CodeAnalysis.Editor.Shared.Utilities
;
using
Microsoft.CodeAnalysis.Host.Mef
;
using
Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion
;
using
Microsoft.VisualStudio.Text.Editor
;
...
...
@@ -23,6 +25,21 @@ internal class ItemManagerProvider : IAsyncCompletionItemManagerProvider
public
ItemManagerProvider
(
RecentItemsManager
recentItemsManager
)
=>
_instance
=
new
ItemManager
(
recentItemsManager
);
public
IAsyncCompletionItemManager
GetOrCreate
(
ITextView
textView
)
=>
_instance
;
public
IAsyncCompletionItemManager
GetOrCreate
(
ITextView
textView
)
{
if
(
textView
.
TextBuffer
.
TryGetWorkspace
(
out
var
workspace
))
{
var
workspaceContextService
=
workspace
.
Services
.
GetRequiredService
<
IWorkspaceContextService
>();
// If we're in a cloud environment context, we want to avoid returning a completion item manager.
// Otherwise, we'll interfere with the LSP client manager and disrupt filtering.
if
(
workspaceContextService
.
IsCloudEnvironmentClient
())
{
return
null
;
}
}
return
_instance
;
}
}
}
src/EditorFeatures/Core/Shared/Utilities/IWorkspaceContextService.cs
0 → 100644
浏览文件 @
bccf2a17
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#
nullable
enable
using
System
;
using
System.Composition
;
using
Microsoft.CodeAnalysis.Host
;
using
Microsoft.CodeAnalysis.Host.Mef
;
namespace
Microsoft.CodeAnalysis.Editor.Shared.Utilities
{
internal
interface
IWorkspaceContextService
:
IWorkspaceService
{
/// <summary>
/// Used to determine if running as a client in a cloud connected environment.
/// </summary>
bool
IsCloudEnvironmentClient
();
}
[
ExportWorkspaceService
(
typeof
(
IWorkspaceContextService
),
ServiceLayer
.
Default
),
Shared
]
internal
sealed
class
DefaultWorkspaceContextService
:
IWorkspaceContextService
{
[
ImportingConstructor
]
[
Obsolete
(
MefConstruction
.
ImportingConstructorMessage
,
error
:
true
)]
public
DefaultWorkspaceContextService
()
{
}
public
bool
IsCloudEnvironmentClient
()
=>
false
;
}
[
ExportWorkspaceService
(
typeof
(
IWorkspaceContextService
),
WorkspaceKind
.
CloudEnvironmentClientWorkspace
),
Shared
]
internal
sealed
class
CloudEnvironmentWorkspaceContextService
:
IWorkspaceContextService
{
[
ImportingConstructor
]
[
Obsolete
(
MefConstruction
.
ImportingConstructorMessage
,
error
:
true
)]
public
CloudEnvironmentWorkspaceContextService
()
{
}
public
bool
IsCloudEnvironmentClient
()
=>
true
;
}
}
src/Features/Core/Portable/Diagnostics/DiagnosticAnalyzerService_IncrementalAnalyzer.cs
浏览文件 @
bccf2a17
...
...
@@ -12,7 +12,7 @@ namespace Microsoft.CodeAnalysis.Diagnostics
{
[
ExportIncrementalAnalyzerProvider
(
highPriorityForActiveFile
:
true
,
name
:
WellKnownSolutionCrawlerAnalyzers
.
Diagnostic
,
workspaceKinds
:
new
string
[]
{
WorkspaceKind
.
Host
,
WorkspaceKind
.
Interactive
,
WorkspaceKind
.
AnyCodeRoslyn
Workspace
})]
workspaceKinds
:
new
string
[]
{
WorkspaceKind
.
Host
,
WorkspaceKind
.
Interactive
,
WorkspaceKind
.
CloudEnvironmentClient
Workspace
})]
internal
partial
class
DiagnosticAnalyzerService
:
IIncrementalAnalyzerProvider
{
public
IIncrementalAnalyzer
CreateIncrementalAnalyzer
(
Workspace
workspace
)
...
...
src/VisualStudio/LiveShare/Impl/Client/RemoteLanguageServiceWorkspace.cs
浏览文件 @
bccf2a17
...
...
@@ -85,7 +85,7 @@ internal sealed class RemoteLanguageServiceWorkspace : CodeAnalysis.Workspace, I
IDiagnosticService
diagnosticService
,
ITableManagerProvider
tableManagerProvider
,
IThreadingContext
threadingContext
)
:
base
(
VisualStudioMefHostServices
.
Create
(
exportProvider
),
WorkspaceKind
.
AnyCodeRoslyn
Workspace
)
:
base
(
VisualStudioMefHostServices
.
Create
(
exportProvider
),
WorkspaceKind
.
CloudEnvironmentClient
Workspace
)
{
_serviceProvider
=
serviceProvider
;
...
...
src/Workspaces/Core/Portable/Workspace/WorkspaceKind.cs
浏览文件 @
bccf2a17
...
...
@@ -23,7 +23,7 @@ public static class WorkspaceKind
internal
const
string
Custom
=
"Custom"
;
internal
const
string
Test
=
nameof
(
Test
);
internal
const
string
AnyCodeRoslynWorkspace
=
nameof
(
AnyCodeRoslyn
Workspace
);
internal
const
string
CloudEnvironmentClientWorkspace
=
nameof
(
CloudEnvironmentClient
Workspace
);
internal
const
string
RemoteWorkspace
=
nameof
(
RemoteWorkspace
);
internal
const
string
RemoteTemporaryWorkspace
=
nameof
(
RemoteTemporaryWorkspace
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录