Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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.9.qualifier
Bundle-Version: 0.16.10.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.9-SNAPSHOT</version>
<version>0.16.10-SNAPSHOT</version>

<properties>
<os-jvm-flags /> <!-- for the default case -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@
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);
}
Expand All @@ -54,22 +54,23 @@ public void testAllOverlayImagesForSymbolTagAvailable(SymbolTag tag) {
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);


// we do not need a symbol for this test, so the last argument is null
Image fieldImage = labelProvider.getImageFor(SymbolKind.Field, symbolTags, null);
Image methodImage = labelProvider.getImageFor(SymbolKind.Method, symbolTags, null);

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);
}

Expand Down
1 change: 1 addition & 0 deletions org.eclipse.lsp4e/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<?eclipse version="3.4"?>
<plugin>
<extension-point id="languageServer" name="Language Server" schema="schema/languageServer.exsd" />
<extension-point id="symbolIconsProvider" name="Symbol Icons Provider" schema="schema/symbolIconsProvider.exsd"/>

<!-- ===================================== -->
<!-- Setup Text Doc To LS Connection -->
Expand Down
140 changes: 140 additions & 0 deletions org.eclipse.lsp4e/schema/symbolIconsProvider.exsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.eclipse.lsp4e" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
<meta.schema plugin="org.eclipse.lsp4e" id="symbolIconsProvider" name="Symbol Icons Provider"/>
</appinfo>
<documentation>
This extension point allows for customizing the (document) symbol icons with their overlays, their placing and filtering for certain language servers. This way, clients can use other images, adapt overlay icon placing and decide wich symbol details to show or hide in the outline view, call hierarchy, or type hierarchy.
</documentation>
</annotation>

<element name="extension">
<annotation>
<appinfo>
<meta.element />
</appinfo>
</annotation>
<complexType>
<sequence minOccurs="1" maxOccurs="unbounded">
<element ref="iconProvider"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you provide some documentation instead of the empty one?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this applies to the other items as well

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've extended the documentation. Is that what you had in mind?

</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>

</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>

</documentation>
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>

<element name="iconProvider">
<complexType>
<sequence minOccurs="1" maxOccurs="unbounded">
<element ref="contentType"/>
</sequence>
<attribute name="id" type="string" use="required">
<annotation>
<documentation>
A string uniquely identifying this symbol icon provider extension.
</documentation>
</annotation>
</attribute>
<attribute name="class" type="string" use="required">
<annotation>
<documentation>

</documentation>
<appinfo>
<meta.attribute kind="java" basedOn="org.eclipse.lsp4e.ui.SymbolIconProvider:"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>

<element name="contentType">
<complexType>
<attribute name="contentTypeId" type="string" use="required">
<annotation>
<documentation>

</documentation>
<appinfo>
<meta.attribute kind="identifier" basedOn="org.eclipse.core.contenttype.contentTypes/content-type/@id"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>

<annotation>
<appinfo>
<meta.section type="since"/>
</appinfo>
<documentation>
[Enter the first release in which this extension point appears.]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if we need all of these annotations documenting the extension point. If you can provide them, they are nice, but then we need meaningful tags.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by meaningful tags?

</documentation>
</annotation>

<annotation>
<appinfo>
<meta.section type="examples"/>
</appinfo>
<documentation>
[Enter extension point usage example here.]
</documentation>
</annotation>

<annotation>
<appinfo>
<meta.section type="apiinfo"/>
</appinfo>
<documentation>
[Enter API information here.]
</documentation>
</annotation>
Comment thread
FlorianKroiss marked this conversation as resolved.
Outdated

<annotation>
<appinfo>
<meta.section type="implementation"/>
</appinfo>
<documentation>
[Enter information about supplied implementation of this extension point.]
</documentation>
</annotation>

<annotation>
<appinfo>
<meta.section type="copyright"/>
</appinfo>
<documentation>
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
</documentation>
</annotation>

</schema>
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.StyledString;
import org.eclipse.lsp4e.operations.symbols.internal.SymbolIconProviderRegistry;
import org.eclipse.lsp4e.ui.SymbolIconProvider;
import org.eclipse.lsp4j.CallHierarchyItem;
import org.eclipse.swt.graphics.Image;
Expand All @@ -25,21 +26,12 @@
*/
public class CallHierarchyLabelProvider extends LabelProvider implements IStyledLabelProvider {

private final SymbolIconProvider symbolIconProvider;

public CallHierarchyLabelProvider() {
this(new SymbolIconProvider());
}

public CallHierarchyLabelProvider(SymbolIconProvider symbolIconProvider) {
this.symbolIconProvider = symbolIconProvider;
}

@Override
public @Nullable Image getImage(final @Nullable Object element) {
if (element instanceof CallHierarchyViewTreeNode treeNode) {
CallHierarchyItem callContainer = treeNode.getCallContainer();
Image res = symbolIconProvider.getImageFor(callContainer.getKind(), callContainer.getTags());
SymbolIconProvider symbolIconProvider = SymbolIconProviderRegistry.getSymbolIconProviderFor(callContainer);
Image res = symbolIconProvider.getImageFor(callContainer.getKind(), callContainer.getTags(), callContainer);
if (res != null) {
return res;
}
Expand Down
Loading
Loading