Skip to content

Commit 85bb863

Browse files
committed
- Fix incorrect result of symbol qualified name
1 parent 6c307a0 commit 85bb863

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

Codist/Controls/CSharpSymbolContextMenu.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public void AddCopyAndSearchSymbolCommands() {
6161
var symbol = _commandFactory.Symbol;
6262
AddCommand(CommandId.CopySymbolName);
6363

64-
if (symbol.CanBeReferencedByName) {
64+
if (symbol.HasReferenceableName()) {
6565
var cmd = CreateWebSearchCommand();
6666
if (cmd != null) {
6767
AddCommand(cmd);

Codist/Controls/SymbolFilterBox.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -402,11 +402,7 @@ public override void UpdateNumbers(IEnumerable<SymbolItem> symbols) {
402402
int pu = 0, pro = 0, i = 0, p = 0;
403403
foreach (var item in symbols) {
404404
var symbol = item.Symbol;
405-
if (symbol == null || symbol.IsImplicitlyDeclared) {
406-
continue;
407-
}
408-
if (symbol.CanBeReferencedByName == false
409-
&& (symbol.Kind != SymbolKind.Method || ((IMethodSymbol)symbol).MethodKind != MethodKind.Constructor)) {
405+
if (symbol == null || symbol.IsImplicitlyDeclared || !symbol.HasReferenceableName()) {
410406
continue;
411407
}
412408
switch (symbol.DeclaredAccessibility) {

Codist/Semantics/CodeAnalysisHelper.Symbol.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ public static string GetDeclarationId(this ISymbol symbol) {
203203
}
204204

205205
public static string GetQualifiedName(this ISymbol symbol) {
206-
if (symbol.Name.Contains('.')) {
206+
if (symbol.GetExplicitInterfaceImplementations().Count != 0) {
207207
// explicit interface implementation name
208208
return symbol.Name;
209209
}
@@ -230,6 +230,11 @@ public static string GetQualifiedName(this ISymbol symbol) {
230230
return String.Join(".", chain);
231231
}
232232

233+
public static bool HasReferenceableName(this ISymbol symbol) {
234+
return symbol.CanBeReferencedByName
235+
|| (symbol.Kind == SymbolKind.Method && ((IMethodSymbol)symbol).MethodKind == MethodKind.Constructor);
236+
}
237+
233238
public static string GetOriginalName(this ISymbol symbol) {
234239
switch (symbol.Kind) {
235240
case SymbolKind.Method:

0 commit comments

Comments
 (0)