diff --git a/metals/src/main/scala/scala/meta/internal/tvp/ClasspathTreeView.scala b/metals/src/main/scala/scala/meta/internal/tvp/ClasspathTreeView.scala index eaea2c7ba9d..a7fee7bb82b 100644 --- a/metals/src/main/scala/scala/meta/internal/tvp/ClasspathTreeView.scala +++ b/metals/src/main/scala/scala/meta/internal/tvp/ClasspathTreeView.scala @@ -105,20 +105,19 @@ class ClasspathTreeView[Value, Key]( else MetalsCommand.goto(child.symbol) val icon = child.kind match { - case k.OBJECT | k.PACKAGE_OBJECT => "object" - case k.TRAIT => "trait" - case k.CLASS => "class" - case k.INTERFACE => "interface" - case k.CONSTRUCTOR => "method" - case k.METHOD | k.MACRO => - if (child.properties.isVal) "val" - else if (child.properties.isVar) "var" - else "method" - case k.FIELD => - if (child.properties.isEnum) "enum" - else "field" - case k.TYPE_PARAMETER => "type" - case k.TYPE => "type" + case k.OBJECT | k.PACKAGE_OBJECT => "symbol-object" + case k.TRAIT => "symbol-interface" + case k.CLASS if child.properties.isEnum => "symbol-enum" + case k.CLASS => "symbol-class" + case k.INTERFACE => "symbol-interface" + case k.CONSTRUCTOR => "symbol-method" + case k.METHOD | k.MACRO if (child.properties.isVal) => "symbol-field" + case k.METHOD | k.MACRO if (child.properties.isVar) => "symbol-variable" + case k.METHOD | k.MACRO => "symbol-method" + case k.FIELD if (child.properties.isEnum) => "symbol-enum-member" + case k.FIELD => "symbol-field" + case k.TYPE_PARAMETER => "symbol-type-parameter" + case k.TYPE => "symbol-type-parameter" case _ => null } diff --git a/tests/unit/src/test/scala/tests/TreeViewLspSuite.scala b/tests/unit/src/test/scala/tests/TreeViewLspSuite.scala index 6bdc0c91cdb..f14cf086389 100644 --- a/tests/unit/src/test/scala/tests/TreeViewLspSuite.scala +++ b/tests/unit/src/test/scala/tests/TreeViewLspSuite.scala @@ -126,33 +126,33 @@ class TreeViewLspSuite extends BaseLspSuite("tree-view") { ) _ = server.assertTreeViewChildren( s"projects-$folder:${server.buildTarget("a")}!/_empty_/", - """|Zero class + + """|Zero symbol-class + |""".stripMargin, ) _ = server.assertTreeViewChildren( s"projects-$folder:${server.buildTarget("a")}!/_empty_/Zero#", - """|a val + """|a symbol-field |""".stripMargin, ) _ = server.assertTreeViewChildren( s"projects-$folder:${server.buildTarget("a")}!/a/", - """|First class - - |First object - |Second class - - |Second object + """|First symbol-class - + |First symbol-object + |Second symbol-class - + |Second symbol-object |""".stripMargin, ) _ = server.assertTreeViewChildren( s"projects-$folder:${server.buildTarget("a")}!/a/First#", - """|b val - |a() method + """|b symbol-field + |a() symbol-method |""".stripMargin, ) _ = server.assertTreeViewChildren( s"projects-$folder:${server.buildTarget("a")}!/a/Second#", - """|c var - |b val - |a() method + """|c symbol-variable + |b symbol-field + |a() symbol-method |""".stripMargin, ) _ <- server.didSave("a/src/main/scala/a/Zero.scala") { text => @@ -164,8 +164,8 @@ class TreeViewLspSuite extends BaseLspSuite("tree-view") { ) _ = server.assertTreeViewChildren( s"projects-$folder:${server.buildTarget("a")}!/_empty_/Zero#", - """|a val - |b val + """|a symbol-field + |b symbol-field |""".stripMargin, ) _ <- server.treeViewNodeCollapseDidChange( @@ -210,19 +210,19 @@ class TreeViewLspSuite extends BaseLspSuite("tree-view") { ) server.assertTreeViewChildren( s"libraries-$folder:${server.jar("scala-library")}!/scala/Some#", - """|value val - |get() method + """|value symbol-field + |get() symbol-method |""".stripMargin, ) server.assertTreeViewChildren( s"libraries-$folder:${server.jar("lsp4j-")}!/org/eclipse/lsp4j/FileChangeType#", - """|getValue() method - |forValue() method - |() method - |Created enum - |Changed enum - |Deleted enum - |value field + """|getValue() symbol-method + |forValue() symbol-method + |() symbol-method + |Created symbol-enum-member + |Changed symbol-enum-member + |Deleted symbol-enum-member + |value symbol-field |""".stripMargin, ) server.assertTreeViewChildren( @@ -237,15 +237,15 @@ class TreeViewLspSuite extends BaseLspSuite("tree-view") { ) server.assertTreeViewChildren( s"libraries-$folder:${server.jar("cats-core")}!/cats/compat/", - """|FoldableCompat object - - |Seq object - - |SortedSet object - - |Vector object - + """|FoldableCompat symbol-object - + |Seq symbol-object - + |SortedSet symbol-object - + |Vector symbol-object - |""".stripMargin, ) server.assertTreeViewChildren( s"libraries-$folder:${server.jar("cats-core")}!/cats/instances/symbol/", - """|package object + """|package symbol-object |""".stripMargin, ) assertNoDiff( @@ -265,7 +265,7 @@ class TreeViewLspSuite extends BaseLspSuite("tree-view") { | java/ | nio/ | file/ - | Paths class + | Paths symbol-class |""".stripMargin, ) assertNoDiff( @@ -300,40 +300,40 @@ class TreeViewLspSuite extends BaseLspSuite("tree-view") { | sourcecode_2.13-0.1.7-sources.jar | sourcecode/ | sourcecode/ - | Args class - | Args object - | ArgsMacros trait - | Compat object - | Enclosing class - | Enclosing object - | EnclosingMachineMacros trait - | EnclosingMacros trait - | File class - | File object - | FileMacros trait - | FullName class - | FullName object - | FullNameMachineMacros trait - | FullNameMacros trait - | Line class - | Line object - | LineMacros trait - | Macros object - | Name class - | Name object - | NameMachineMacros trait - | NameMacros trait - | Pkg class - | Pkg object - | PkgMacros trait - | SourceCompanion class - | SourceValue class - | Text class - | Text object - | TextMacros trait - | Util object - | File class - | value val + | Args symbol-class + | Args symbol-object + | ArgsMacros symbol-interface + | Compat symbol-object + | Enclosing symbol-class + | Enclosing symbol-object + | EnclosingMachineMacros symbol-interface + | EnclosingMacros symbol-interface + | File symbol-class + | File symbol-object + | FileMacros symbol-interface + | FullName symbol-class + | FullName symbol-object + | FullNameMachineMacros symbol-interface + | FullNameMacros symbol-interface + | Line symbol-class + | Line symbol-object + | LineMacros symbol-interface + | Macros symbol-object + | Name symbol-class + | Name symbol-object + | NameMachineMacros symbol-interface + | NameMacros symbol-interface + | Pkg symbol-class + | Pkg symbol-object + | PkgMacros symbol-interface + | SourceCompanion symbol-class + | SourceValue symbol-class + | Text symbol-class + | Text symbol-object + | TextMacros symbol-interface + | Util symbol-object + | File symbol-class + | value symbol-field |""".stripMargin, ) assertNoDiff( @@ -362,188 +362,188 @@ class TreeViewLspSuite extends BaseLspSuite("tree-view") { | launch/ | services/ | util/ - | ApplyWorkspaceEditParams class - | ApplyWorkspaceEditResponse class - | ClientCapabilities class - | CodeAction class - | CodeActionCapabilities class - | CodeActionContext class - | CodeActionKind class - | CodeActionKindCapabilities class - | CodeActionLiteralSupportCapabilities class - | CodeActionParams class - | CodeLens class - | CodeLensCapabilities class - | CodeLensOptions class - | CodeLensParams class - | CodeLensRegistrationOptions class - | Color class - | ColorInformation class - | ColorPresentation class - | ColorPresentationParams class - | ColorProviderCapabilities class - | ColorProviderOptions class - | ColoringInformation class - | ColoringParams class - | ColoringStyle class - | Command class - | CompletionCapabilities class - | CompletionContext class - | CompletionItem class - | CompletionItemCapabilities class - | CompletionItemKind class - | CompletionItemKindCapabilities class - | CompletionList class - | CompletionOptions class - | CompletionParams class - | CompletionRegistrationOptions class - | CompletionTriggerKind class - | ConfigurationItem class - | ConfigurationParams class - | DefinitionCapabilities class - | Diagnostic class - | DiagnosticRelatedInformation class - | DiagnosticSeverity class - | DidChangeConfigurationCapabilities class - | DidChangeConfigurationParams class - | DidChangeTextDocumentParams class - | DidChangeWatchedFilesCapabilities class - | DidChangeWatchedFilesParams class - | DidChangeWatchedFilesRegistrationOptions class - | DidChangeWorkspaceFoldersParams class - | DidCloseTextDocumentParams class - | DidOpenTextDocumentParams class - | DidSaveTextDocumentParams class - | DocumentColorParams class - | DocumentFilter class - | DocumentFormattingParams class - | DocumentHighlight class - | DocumentHighlightCapabilities class - | DocumentHighlightKind class - | DocumentLink class - | DocumentLinkCapabilities class - | DocumentLinkOptions class - | DocumentLinkParams class - | DocumentLinkRegistrationOptions class - | DocumentOnTypeFormattingOptions class - | DocumentOnTypeFormattingParams class - | DocumentOnTypeFormattingRegistrationOptions class - | DocumentRangeFormattingParams class - | DocumentSymbol class - | DocumentSymbolCapabilities class - | DocumentSymbolParams class - | DynamicRegistrationCapabilities class - | ExecuteCommandCapabilities class - | ExecuteCommandOptions class - | ExecuteCommandParams class - | ExecuteCommandRegistrationOptions class - | FileChangeType class - | FileEvent class - | FileSystemWatcher class - | FoldingRange class - | FoldingRangeCapabilities class - | FoldingRangeKind class - | FoldingRangeProviderOptions class - | FoldingRangeRequestParams class - | FormattingCapabilities class - | FormattingOptions class - | Hover class - | HoverCapabilities class - | ImplementationCapabilities class - | InitializeError class - | InitializeErrorCode interface - | InitializeParams class - | InitializeResult class - | InitializedParams class - | InsertTextFormat class - | Location class - | MarkedString class - | MarkupContent class - | MarkupKind class - | MessageActionItem class - | MessageParams class - | MessageType class - | OnTypeFormattingCapabilities class - | ParameterInformation class - | Position class - | PublishDiagnosticsCapabilities class - | PublishDiagnosticsParams class - | Range class - | RangeFormattingCapabilities class - | ReferenceContext class - | ReferenceParams class - | ReferencesCapabilities class - | Registration class - | RegistrationParams class - | RenameCapabilities class - | RenameParams class - | ResourceChange class - | ResponseErrorCode class - | SaveOptions class - | SemanticHighlightingCapabilities class - | SemanticHighlightingInformation class - | SemanticHighlightingParams class - | SemanticHighlightingServerCapabilities class - | ServerCapabilities class - | ShowMessageRequestParams class - | SignatureHelp class - | SignatureHelpCapabilities class - | SignatureHelpOptions class - | SignatureHelpRegistrationOptions class - | SignatureInformation class - | SignatureInformationCapabilities class - | StaticRegistrationOptions class - | SymbolCapabilities class - | SymbolInformation class - | SymbolKind class - | SymbolKindCapabilities class - | SynchronizationCapabilities class - | TextDocumentChangeRegistrationOptions class - | TextDocumentClientCapabilities class - | TextDocumentContentChangeEvent class - | TextDocumentEdit class - | TextDocumentIdentifier class - | TextDocumentItem class - | TextDocumentPositionParams class - | TextDocumentRegistrationOptions class - | TextDocumentSaveReason class - | TextDocumentSaveRegistrationOptions class - | TextDocumentSyncKind class - | TextDocumentSyncOptions class - | TextEdit class - | TypeDefinitionCapabilities class - | Unregistration class - | UnregistrationParams class - | VersionedTextDocumentIdentifier class - | WatchKind class - | WillSaveTextDocumentParams class - | WorkspaceClientCapabilities class - | WorkspaceEdit class - | WorkspaceEditCapabilities class - | WorkspaceFolder class - | WorkspaceFoldersChangeEvent class - | WorkspaceFoldersOptions class - | WorkspaceServerCapabilities class - | WorkspaceSymbolParams class + | ApplyWorkspaceEditParams symbol-class + | ApplyWorkspaceEditResponse symbol-class + | ClientCapabilities symbol-class + | CodeAction symbol-class + | CodeActionCapabilities symbol-class + | CodeActionContext symbol-class + | CodeActionKind symbol-class + | CodeActionKindCapabilities symbol-class + | CodeActionLiteralSupportCapabilities symbol-class + | CodeActionParams symbol-class + | CodeLens symbol-class + | CodeLensCapabilities symbol-class + | CodeLensOptions symbol-class + | CodeLensParams symbol-class + | CodeLensRegistrationOptions symbol-class + | Color symbol-class + | ColorInformation symbol-class + | ColorPresentation symbol-class + | ColorPresentationParams symbol-class + | ColorProviderCapabilities symbol-class + | ColorProviderOptions symbol-class + | ColoringInformation symbol-class + | ColoringParams symbol-class + | ColoringStyle symbol-class + | Command symbol-class + | CompletionCapabilities symbol-class + | CompletionContext symbol-class + | CompletionItem symbol-class + | CompletionItemCapabilities symbol-class + | CompletionItemKind symbol-enum + | CompletionItemKindCapabilities symbol-class + | CompletionList symbol-class + | CompletionOptions symbol-class + | CompletionParams symbol-class + | CompletionRegistrationOptions symbol-class + | CompletionTriggerKind symbol-enum + | ConfigurationItem symbol-class + | ConfigurationParams symbol-class + | DefinitionCapabilities symbol-class + | Diagnostic symbol-class + | DiagnosticRelatedInformation symbol-class + | DiagnosticSeverity symbol-enum + | DidChangeConfigurationCapabilities symbol-class + | DidChangeConfigurationParams symbol-class + | DidChangeTextDocumentParams symbol-class + | DidChangeWatchedFilesCapabilities symbol-class + | DidChangeWatchedFilesParams symbol-class + | DidChangeWatchedFilesRegistrationOptions symbol-class + | DidChangeWorkspaceFoldersParams symbol-class + | DidCloseTextDocumentParams symbol-class + | DidOpenTextDocumentParams symbol-class + | DidSaveTextDocumentParams symbol-class + | DocumentColorParams symbol-class + | DocumentFilter symbol-class + | DocumentFormattingParams symbol-class + | DocumentHighlight symbol-class + | DocumentHighlightCapabilities symbol-class + | DocumentHighlightKind symbol-enum + | DocumentLink symbol-class + | DocumentLinkCapabilities symbol-class + | DocumentLinkOptions symbol-class + | DocumentLinkParams symbol-class + | DocumentLinkRegistrationOptions symbol-class + | DocumentOnTypeFormattingOptions symbol-class + | DocumentOnTypeFormattingParams symbol-class + | DocumentOnTypeFormattingRegistrationOptions symbol-class + | DocumentRangeFormattingParams symbol-class + | DocumentSymbol symbol-class + | DocumentSymbolCapabilities symbol-class + | DocumentSymbolParams symbol-class + | DynamicRegistrationCapabilities symbol-class + | ExecuteCommandCapabilities symbol-class + | ExecuteCommandOptions symbol-class + | ExecuteCommandParams symbol-class + | ExecuteCommandRegistrationOptions symbol-class + | FileChangeType symbol-enum + | FileEvent symbol-class + | FileSystemWatcher symbol-class + | FoldingRange symbol-class + | FoldingRangeCapabilities symbol-class + | FoldingRangeKind symbol-class + | FoldingRangeProviderOptions symbol-class + | FoldingRangeRequestParams symbol-class + | FormattingCapabilities symbol-class + | FormattingOptions symbol-class + | Hover symbol-class + | HoverCapabilities symbol-class + | ImplementationCapabilities symbol-class + | InitializeError symbol-class + | InitializeErrorCode symbol-interface + | InitializeParams symbol-class + | InitializeResult symbol-class + | InitializedParams symbol-class + | InsertTextFormat symbol-enum + | Location symbol-class + | MarkedString symbol-class + | MarkupContent symbol-class + | MarkupKind symbol-class + | MessageActionItem symbol-class + | MessageParams symbol-class + | MessageType symbol-enum + | OnTypeFormattingCapabilities symbol-class + | ParameterInformation symbol-class + | Position symbol-class + | PublishDiagnosticsCapabilities symbol-class + | PublishDiagnosticsParams symbol-class + | Range symbol-class + | RangeFormattingCapabilities symbol-class + | ReferenceContext symbol-class + | ReferenceParams symbol-class + | ReferencesCapabilities symbol-class + | Registration symbol-class + | RegistrationParams symbol-class + | RenameCapabilities symbol-class + | RenameParams symbol-class + | ResourceChange symbol-class + | ResponseErrorCode symbol-enum + | SaveOptions symbol-class + | SemanticHighlightingCapabilities symbol-class + | SemanticHighlightingInformation symbol-class + | SemanticHighlightingParams symbol-class + | SemanticHighlightingServerCapabilities symbol-class + | ServerCapabilities symbol-class + | ShowMessageRequestParams symbol-class + | SignatureHelp symbol-class + | SignatureHelpCapabilities symbol-class + | SignatureHelpOptions symbol-class + | SignatureHelpRegistrationOptions symbol-class + | SignatureInformation symbol-class + | SignatureInformationCapabilities symbol-class + | StaticRegistrationOptions symbol-class + | SymbolCapabilities symbol-class + | SymbolInformation symbol-class + | SymbolKind symbol-enum + | SymbolKindCapabilities symbol-class + | SynchronizationCapabilities symbol-class + | TextDocumentChangeRegistrationOptions symbol-class + | TextDocumentClientCapabilities symbol-class + | TextDocumentContentChangeEvent symbol-class + | TextDocumentEdit symbol-class + | TextDocumentIdentifier symbol-class + | TextDocumentItem symbol-class + | TextDocumentPositionParams symbol-class + | TextDocumentRegistrationOptions symbol-class + | TextDocumentSaveReason symbol-enum + | TextDocumentSaveRegistrationOptions symbol-class + | TextDocumentSyncKind symbol-enum + | TextDocumentSyncOptions symbol-class + | TextEdit symbol-class + | TypeDefinitionCapabilities symbol-class + | Unregistration symbol-class + | UnregistrationParams symbol-class + | VersionedTextDocumentIdentifier symbol-class + | WatchKind symbol-class + | WillSaveTextDocumentParams symbol-class + | WorkspaceClientCapabilities symbol-class + | WorkspaceEdit symbol-class + | WorkspaceEditCapabilities symbol-class + | WorkspaceFolder symbol-class + | WorkspaceFoldersChangeEvent symbol-class + | WorkspaceFoldersOptions symbol-class + | WorkspaceServerCapabilities symbol-class + | WorkspaceSymbolParams symbol-class | services/ - | LanguageClient interface - | LanguageClientAware interface - | LanguageClientExtensions interface - | LanguageServer interface - | TextDocumentService interface - | WorkspaceService interface - | LanguageClient interface - | applyEdit() method - | registerCapability() method - | unregisterCapability() method - | telemetryEvent() method - | publishDiagnostics() method - | showMessage() method - | showMessageRequest() method - | logMessage() method - | workspaceFolders() method - | configuration() method - | semanticHighlighting() method + | LanguageClient symbol-interface + | LanguageClientAware symbol-interface + | LanguageClientExtensions symbol-interface + | LanguageServer symbol-interface + | TextDocumentService symbol-interface + | WorkspaceService symbol-interface + | LanguageClient symbol-interface + | applyEdit() symbol-method + | registerCapability() symbol-method + | unregisterCapability() symbol-method + | telemetryEvent() symbol-method + | publishDiagnostics() symbol-method + | showMessage() symbol-method + | showMessageRequest() symbol-method + | logMessage() symbol-method + | workspaceFolders() symbol-method + | configuration() symbol-method + | semanticHighlighting() symbol-method |""".stripMargin, ) }