Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
ed1b58c7
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,发现更多精彩内容 >>
未验证
提交
ed1b58c7
编写于
9月 18, 2020
作者:
D
David Wengier
提交者:
GitHub
9月 18, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Don't map completion items to function (#47412)
上级
7e65d92e
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
28 addition
and
4 deletion
+28
-4
src/Features/LanguageServer/Protocol/Extensions/ProtocolConversions.cs
...LanguageServer/Protocol/Extensions/ProtocolConversions.cs
+4
-4
src/Features/LanguageServer/ProtocolUnitTests/ProtocolConversionsTests.cs
...guageServer/ProtocolUnitTests/ProtocolConversionsTests.cs
+24
-0
未找到文件。
src/Features/LanguageServer/Protocol/Extensions/ProtocolConversions.cs
浏览文件 @
ed1b58c7
...
...
@@ -24,6 +24,8 @@ namespace Microsoft.CodeAnalysis.LanguageServer
{
internal
static
class
ProtocolConversions
{
// NOTE: While the spec allows it, don't use Function and Method, as both VS and VS Code display them the same way
// which can confuse users
public
static
readonly
Dictionary
<
string
,
LSP
.
CompletionItemKind
>
RoslynTagToCompletionItemKind
=
new
Dictionary
<
string
,
LSP
.
CompletionItemKind
>()
{
{
WellKnownTags
.
Public
,
LSP
.
CompletionItemKind
.
Keyword
},
...
...
@@ -36,7 +38,7 @@ internal static class ProtocolConversions
{
WellKnownTags
.
Assembly
,
LSP
.
CompletionItemKind
.
File
},
{
WellKnownTags
.
Class
,
LSP
.
CompletionItemKind
.
Class
},
{
WellKnownTags
.
Constant
,
LSP
.
CompletionItemKind
.
Constant
},
{
WellKnownTags
.
Delegate
,
LSP
.
CompletionItemKind
.
Function
},
{
WellKnownTags
.
Delegate
,
LSP
.
CompletionItemKind
.
Method
},
{
WellKnownTags
.
Enum
,
LSP
.
CompletionItemKind
.
Enum
},
{
WellKnownTags
.
EnumMember
,
LSP
.
CompletionItemKind
.
EnumMember
},
{
WellKnownTags
.
Event
,
LSP
.
CompletionItemKind
.
Event
},
...
...
@@ -326,7 +328,6 @@ public static LSP.SymbolKind GlyphToSymbolKind(Glyph glyph)
case
Glyph
.
DelegateProtected
:
case
Glyph
.
DelegatePrivate
:
case
Glyph
.
DelegateInternal
:
return
LSP
.
SymbolKind
.
Function
;
case
Glyph
.
ExtensionMethodPublic
:
case
Glyph
.
ExtensionMethodProtected
:
case
Glyph
.
ExtensionMethodPrivate
:
...
...
@@ -355,9 +356,8 @@ public static Glyph CompletionItemKindToGlyph(LSP.CompletionItemKind kind)
return
Glyph
.
None
;
case
LSP
.
CompletionItemKind
.
Method
:
case
LSP
.
CompletionItemKind
.
Constructor
:
case
LSP
.
CompletionItemKind
.
Function
:
// We don't use Function, but map it just in case. It has the same icon as Method in VS and VS Code
return
Glyph
.
MethodPublic
;
case
LSP
.
CompletionItemKind
.
Function
:
return
Glyph
.
DelegatePublic
;
case
LSP
.
CompletionItemKind
.
Field
:
return
Glyph
.
FieldPublic
;
case
LSP
.
CompletionItemKind
.
Variable
:
...
...
src/Features/LanguageServer/ProtocolUnitTests/ProtocolConversionsTests.cs
0 → 100644
浏览文件 @
ed1b58c7
// 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.
using
System.Linq
;
using
Microsoft.VisualStudio.LanguageServer.Protocol
;
using
Xunit
;
namespace
Microsoft.CodeAnalysis.LanguageServer.UnitTests
{
public
class
ProtocolConversionsTests
{
[
Fact
]
public
void
CompletionItemKind_DontUseMethodAndFunction
()
{
var
map
=
ProtocolConversions
.
RoslynTagToCompletionItemKind
;
var
containsMethod
=
map
.
Values
.
Any
(
c
=>
c
==
CompletionItemKind
.
Method
);
var
containsFunction
=
map
.
Values
.
Any
(
c
=>
c
==
CompletionItemKind
.
Function
);
Assert
.
False
(
containsFunction
&&
containsMethod
,
"Don't use Method and Function completion item kinds as it causes user confusion."
);
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录