From f9983b3a05d962d0975c57d75e09d02df38bd4ed Mon Sep 17 00:00:00 2001
From: Frode Flaten <3436158+fflaten@users.noreply.github.com>
Date: Sat, 13 Aug 2022 22:08:09 +0000
Subject: [PATCH] remove Interface symbol
---
.../Services/Symbols/SymbolType.cs | 5 -----
.../Services/Symbols/Vistors/FindSymbolsVisitor.cs | 11 ++++-------
.../TextDocument/Handlers/DocumentSymbolHandler.cs | 2 --
.../Workspace/Handlers/WorkspaceSymbolsHandler.cs | 2 --
4 files changed, 4 insertions(+), 16 deletions(-)
diff --git a/src/PowerShellEditorServices/Services/Symbols/SymbolType.cs b/src/PowerShellEditorServices/Services/Symbols/SymbolType.cs
index d9e9544f90..207038107a 100644
--- a/src/PowerShellEditorServices/Services/Symbols/SymbolType.cs
+++ b/src/PowerShellEditorServices/Services/Symbols/SymbolType.cs
@@ -48,11 +48,6 @@ internal enum SymbolType
///
Class,
- ///
- /// The symbol is a interface
- ///
- Interface,
-
///
/// The symbol is a enum
///
diff --git a/src/PowerShellEditorServices/Services/Symbols/Vistors/FindSymbolsVisitor.cs b/src/PowerShellEditorServices/Services/Symbols/Vistors/FindSymbolsVisitor.cs
index 5a4ae77cb2..4d2d3a0765 100644
--- a/src/PowerShellEditorServices/Services/Symbols/Vistors/FindSymbolsVisitor.cs
+++ b/src/PowerShellEditorServices/Services/Symbols/Vistors/FindSymbolsVisitor.cs
@@ -85,7 +85,7 @@ private static bool IsAssignedAtScriptScope(VariableExpressionAst variableExpres
}
///
- /// Adds class, enum and interface AST to symbol reference list
+ /// Adds class and AST to symbol reference list
///
public override AstVisitAction VisitTypeDefinition(TypeDefinitionAst typeDefinitionAst)
{
@@ -99,12 +99,9 @@ public override AstVisitAction VisitTypeDefinition(TypeDefinitionAst typeDefinit
File = typeDefinitionAst.Extent.File
};
- SymbolType symbolType = typeDefinitionAst switch
- {
- { IsEnum: true } => SymbolType.Enum,
- { IsInterface: true } => SymbolType.Interface,
- _ => SymbolType.Class,
- };
+ SymbolType symbolType =
+ typeDefinitionAst.IsEnum ?
+ SymbolType.Enum : SymbolType.Class;
SymbolReferences.Add(
new SymbolReference(
diff --git a/src/PowerShellEditorServices/Services/TextDocument/Handlers/DocumentSymbolHandler.cs b/src/PowerShellEditorServices/Services/TextDocument/Handlers/DocumentSymbolHandler.cs
index daef76b6b0..0f05d1a6b6 100644
--- a/src/PowerShellEditorServices/Services/TextDocument/Handlers/DocumentSymbolHandler.cs
+++ b/src/PowerShellEditorServices/Services/TextDocument/Handlers/DocumentSymbolHandler.cs
@@ -130,7 +130,6 @@ private static SymbolKind GetSymbolKind(SymbolType symbolType)
{
SymbolType.Configuration or SymbolType.Function or SymbolType.Workflow => SymbolKind.Function,
SymbolType.Enum => SymbolKind.Enum,
- SymbolType.Interface => SymbolKind.Interface,
SymbolType.Class => SymbolKind.Class,
SymbolType.Constructor => SymbolKind.Constructor,
SymbolType.Method => SymbolKind.Method,
@@ -150,7 +149,6 @@ SymbolType.Configuration or
SymbolType.Function or
SymbolType.Workflow or
SymbolType.Enum or
- SymbolType.Interface or
SymbolType.Class)
{
name += " { }";
diff --git a/src/PowerShellEditorServices/Services/Workspace/Handlers/WorkspaceSymbolsHandler.cs b/src/PowerShellEditorServices/Services/Workspace/Handlers/WorkspaceSymbolsHandler.cs
index 7441ef3b15..8d0e090c52 100644
--- a/src/PowerShellEditorServices/Services/Workspace/Handlers/WorkspaceSymbolsHandler.cs
+++ b/src/PowerShellEditorServices/Services/Workspace/Handlers/WorkspaceSymbolsHandler.cs
@@ -107,7 +107,6 @@ SymbolType.Configuration or
SymbolType.Function or
SymbolType.Workflow or
SymbolType.Enum or
- SymbolType.Interface or
SymbolType.Class)
{
name += " { }";
@@ -122,7 +121,6 @@ private static SymbolKind GetSymbolKind(SymbolType symbolType)
{
SymbolType.Configuration or SymbolType.Function or SymbolType.Workflow => SymbolKind.Function,
SymbolType.Enum => SymbolKind.Enum,
- SymbolType.Interface => SymbolKind.Interface,
SymbolType.Class => SymbolKind.Class,
SymbolType.Constructor => SymbolKind.Constructor,
SymbolType.Method => SymbolKind.Method,