Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion org.eclipse.lsp4e.test/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Tests for language server bundle (Incubation)
Bundle-SymbolicName: org.eclipse.lsp4e.test;singleton:=true
Bundle-Version: 0.16.7.qualifier
Bundle-Version: 0.16.8.qualifier
Fragment-Host: org.eclipse.lsp4e
Bundle-Vendor: Eclipse LSP4E
Bundle-RequiredExecutionEnvironment: JavaSE-21
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.lsp4e.test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</parent>
<artifactId>org.eclipse.lsp4e.test</artifactId>
<packaging>eclipse-test-plugin</packaging>
<version>0.16.7-SNAPSHOT</version>
<version>0.16.8-SNAPSHOT</version>

<properties>
<os-jvm-flags /> <!-- for the default case -->
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/*******************************************************************************
* Copyright (c) 2024 Advantest GmbH and others.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Dietrich Travkin (Solunar GmbH) - initial implementation
*******************************************************************************/
package org.eclipse.lsp4e.test.symbols;

import static org.junit.jupiter.api.Assertions.*;

import java.util.Arrays;
import java.util.List;

import org.eclipse.lsp4e.operations.symbols.SymbolsUtil;
import org.eclipse.lsp4j.DocumentSymbol;
import org.eclipse.lsp4j.SymbolInformation;
import org.eclipse.lsp4j.SymbolTag;
import org.eclipse.lsp4j.WorkspaceSymbol;
import org.junit.jupiter.api.Test;

public class SymbolsUtilTest {

private static final List<SymbolTag> symbolTagsWithDeprecated = Arrays.asList(
SymbolTag.Package, SymbolTag.Deprecated, SymbolTag.ReadOnly);
private static final List<SymbolTag> symbolTagsWithoutDeprecated = Arrays.asList(
SymbolTag.Public, SymbolTag.Declaration, SymbolTag.Static);

@Test
public void testDeprecatedCheckForSymbolInformation() {
var symbolInformation = new SymbolInformation();

assertFalse(SymbolsUtil.isDeprecated(symbolInformation));

symbolInformation.setDeprecated(true);

assertTrue(SymbolsUtil.isDeprecated(symbolInformation));

symbolInformation = new SymbolInformation();
symbolInformation.setTags(symbolTagsWithDeprecated);

assertTrue(SymbolsUtil.isDeprecated(symbolInformation));

symbolInformation.setTags(symbolTagsWithoutDeprecated);

assertFalse(SymbolsUtil.isDeprecated(symbolInformation));
}

@Test
public void testDeprecatedCheckForWorkspaceSymbol() {
var workspaceSymbol = new WorkspaceSymbol();

assertFalse(SymbolsUtil.isDeprecated(workspaceSymbol));

workspaceSymbol.setTags(symbolTagsWithDeprecated);

assertTrue(SymbolsUtil.isDeprecated(workspaceSymbol));

workspaceSymbol.setTags(symbolTagsWithoutDeprecated);

assertFalse(SymbolsUtil.isDeprecated(workspaceSymbol));
}

@Test
public void testDeprecatedCheckForDocumentSymbol() {
var documentSymbol = new DocumentSymbol();

assertFalse(SymbolsUtil.isDeprecated(documentSymbol));

documentSymbol.setDeprecated(true);

assertTrue(SymbolsUtil.isDeprecated(documentSymbol));

documentSymbol = new DocumentSymbol();
documentSymbol.setTags(symbolTagsWithDeprecated);

assertTrue(SymbolsUtil.isDeprecated(documentSymbol));

documentSymbol.setTags(symbolTagsWithoutDeprecated);

assertFalse(SymbolsUtil.isDeprecated(documentSymbol));
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*******************************************************************************
* Copyright (c) 2024 Advantest GmbH and others.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Dietrich Travkin (Solunar GmbH) - initial implementation
*******************************************************************************/
package org.eclipse.lsp4e.test.utils;

import static org.junit.jupiter.api.Assertions.assertNotNull;

import java.util.List;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.lsp4e.ui.LSPImages;
import org.eclipse.lsp4e.ui.SymbolIconProvider;
import org.eclipse.lsp4j.CompletionItem;
import org.eclipse.lsp4j.CompletionItemKind;
import org.eclipse.lsp4j.SymbolKind;
import org.eclipse.lsp4j.SymbolTag;
import org.eclipse.swt.graphics.Image;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.EnumSource;
import org.junit.jupiter.params.provider.EnumSource.Mode;

public class LSPImagesTest {

@ParameterizedTest
@EnumSource(SymbolKind.class)
public void testAllImagesForSymbolKindAvailable(SymbolKind kind) {
Image img = LSPImages.imageFromSymbolKind(kind);

assertNotNull(img);
}

@ParameterizedTest
@EnumSource(SymbolTag.class)
public void testAllOverlayImagesForSymbolTagAvailable(SymbolTag tag) {
ImageDescriptor descriptor = LSPImages.imageDescriptorOverlayFromSymbolTag(tag);
Image img = LSPImages.imageOverlayFromSymbolTag(tag);

assertNotNull(descriptor);
assertNotNull(img);
}

// Deprecated is used to test the case where no visibility tag is available, that should default to the standard symbol icon
@ParameterizedTest
@EnumSource(value=SymbolTag.class, mode=Mode.INCLUDE, names= { "Private", "Package", "Protected", "Public",
"Internal", "File", "Deprecated"})
public void testVisibilityOverlayImagesForFieldsAndMethodsAvailable(SymbolTag tag) {
var symbolTags = List.of(tag);
SymbolIconProvider labelProvider = new SymbolIconProvider();

Image fieldImage = labelProvider.getImageFor(SymbolKind.Field, symbolTags);
Image methodImage = labelProvider.getImageFor(SymbolKind.Method, symbolTags);

assertNotNull(fieldImage);
assertNotNull(methodImage);
}

@ParameterizedTest
@EnumSource(value=CompletionItemKind.class, mode=Mode.EXCLUDE, names= { "Color", "Event", "Operator" })
public void testAllImagesForCompletionItemKindAvailable(CompletionItemKind kind) {
CompletionItem item = new CompletionItem();
item.setKind(kind);

Image img = LSPImages.imageFromCompletionItem(item);

assertNotNull(img);
}

}
2 changes: 1 addition & 1 deletion org.eclipse.lsp4e/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Language Server Protocol client for Eclipse IDE (Incubation)
Bundle-SymbolicName: org.eclipse.lsp4e;singleton:=true
Bundle-Version: 0.19.7.qualifier
Bundle-Version: 0.19.8.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-21
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.12.0",
org.eclipse.equinox.common;bundle-version="3.8.0",
Expand Down
Binary file modified org.eclipse.lsp4e/icons/full/obj16/constructor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
101 changes: 68 additions & 33 deletions org.eclipse.lsp4e/icons/full/obj16/constructor.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified org.eclipse.lsp4e/icons/full/obj16/constructor@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading