Skip to content
Draft
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
8 changes: 4 additions & 4 deletions org.eclipse.lsp4e.debug/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ Bundle-ManifestVersion: 2
Bundle-Name: Debug Adapter client for Eclipse IDE (Incubation)
Bundle-SymbolicName: org.eclipse.lsp4e.debug;singleton:=true
Bundle-Vendor: Eclipse LSP4E
Bundle-Version: 0.16.1.qualifier
Bundle-Version: 0.16.2.qualifier
Bundle-Activator: org.eclipse.lsp4e.debug.DSPPlugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.debug.core,
org.eclipse.debug.ui,
org.eclipse.jface,
org.eclipse.lsp4j.jsonrpc;bundle-version="[0.24.0,0.25.0)",
org.eclipse.lsp4j.jsonrpc.debug;bundle-version="[0.24.0,0.25.0)",
org.eclipse.lsp4j.debug;bundle-version="[0.24.0,0.25.0)",
org.eclipse.lsp4j.jsonrpc;bundle-version="[1.0.0,2.0.0)",
org.eclipse.lsp4j.jsonrpc.debug;bundle-version="[1.0.0,2.0.0)",
org.eclipse.lsp4j.debug;bundle-version="[1.0.0,2.0.0)",
org.eclipse.ui.editors,
org.eclipse.core.filesystem,
org.eclipse.ui.ide;bundle-version="[3.16.0,4.0.0)",
Expand Down
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.4.qualifier
Bundle-Version: 0.16.5.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.4-SNAPSHOT</version>
<version>0.16.5-SNAPSHOT</version>

<properties>
<os-jvm-flags /> <!-- for the default case -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@
*******************************************************************************/
package org.eclipse.lsp4e.test.diagnostics;

import static org.eclipse.lsp4e.test.utils.TestUtils.waitForAndAssertCondition;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.eclipse.lsp4e.test.utils.TestUtils.*;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.MatcherAssert.*;
import static org.junit.jupiter.api.Assertions.*;

import java.io.File;
import java.io.FileOutputStream;
Expand Down Expand Up @@ -106,7 +104,7 @@ public void testDiagnostics() throws CoreException {
assertEquals(markerCharStart, MarkerUtilities.getCharStart(marker.get()));
assertEquals(markerCharEnd, MarkerUtilities.getCharEnd(marker.get()));
assertEquals(markerLineIndex + 1, MarkerUtilities.getLineNumber(marker.get()));
assertEquals(diagnostic.getMessage() + " [" + diagnostic.getCode().get() + "]",
assertEquals(diagnostic.getMessage().getLeft() + " [" + diagnostic.getCode().get() + "]",
MarkerUtilities.getMessage(marker.get()));
}

Expand Down Expand Up @@ -232,7 +230,7 @@ public void testDiagnosticsRangeAfterDocument() throws CoreException {
Diagnostic diagnostic = diagnostics.get(i);
IMarker marker = markers[i];

assertEquals(diagnostic.getMessage() + " [" + diagnostic.getCode().get() + "]",
assertEquals(diagnostic.getMessage().getLeft() + " [" + diagnostic.getCode().get() + "]",
MarkerUtilities.getMessage(marker));
assertEquals(content.length(), MarkerUtilities.getCharStart(marker));
assertEquals(content.length(), MarkerUtilities.getCharEnd(marker));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,8 @@
*******************************************************************************/
package org.eclipse.lsp4e.test.edit;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assumptions.*;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
Expand Down Expand Up @@ -138,8 +134,9 @@ public void testWorkspaceEdit_CreateAndPopulateFile() throws Exception {
String uri = file.getLocation().toFile().toURI().toString();
edits.add(Either.forRight(new CreateFile(uri)));
edits.add(Either.forLeft(
new TextDocumentEdit(new VersionedTextDocumentIdentifier(uri, null), List.of(
new TextEdit(new Range(new Position(0, 0), new Position(0, 0)), "abcHere\nabcHere2")))));
new TextDocumentEdit(new VersionedTextDocumentIdentifier(uri, null),
List.of(Either.forLeft(
new TextEdit(new Range(new Position(0, 0), new Position(0, 0)), "abcHere\nabcHere2"))))));
final var workspaceEdit = new WorkspaceEdit(edits);
// they should be applied from bottom to top
LSPEclipseUtils.applyWorkspaceEdit(workspaceEdit);
Expand Down Expand Up @@ -358,8 +355,8 @@ public void testResourceOperations() throws Exception {
assertTrue(targetFile.exists());
LSPEclipseUtils.applyWorkspaceEdit(new WorkspaceEdit(List.of(Either.forLeft(
new TextDocumentEdit(new VersionedTextDocumentIdentifier(targetFile.getLocationURI().toString(), 1),
List.of(
new TextEdit(new Range(new Position(0, 0), new Position(0, 0)), "hello")))))));
List.of(Either.forLeft(
new TextEdit(new Range(new Position(0, 0), new Position(0, 0)), "hello"))))))));
assertEquals("hello", readContent(targetFile));
IFile otherFile = project.getFile("another/folder/file.lol");
LSPEclipseUtils.applyWorkspaceEdit(new WorkspaceEdit(List.of(Either.forRight(
Expand Down Expand Up @@ -388,7 +385,7 @@ public void editExternalFile() throws Exception {
te.setNewText("abc\ndef");
final var docEdit = new TextDocumentEdit(
new VersionedTextDocumentIdentifier(file.toURI().toString(), null),
List.of(te));
List.of(Either.forLeft(te)));
final var we = new WorkspaceEdit(List.of(Either.forLeft(docEdit)));
LSPEclipseUtils.applyWorkspaceEdit(we);
assertTrue(file.isFile());
Expand Down Expand Up @@ -428,7 +425,7 @@ public void testTextEditDoesntAutomaticallySaveOpenResourceFiles() throws Except
te.setNewText("abc\ndef");
final var docEdit = new TextDocumentEdit(
new VersionedTextDocumentIdentifier(LSPEclipseUtils.toUri(targetFile).toString(), null),
List.of(te));
List.of(Either.forLeft(te)));
final var we = new WorkspaceEdit(List.of(Either.forLeft(docEdit)));
LSPEclipseUtils.applyWorkspaceEdit(we);
assertEquals("abc\ndef", ((StyledText) ((AbstractTextEditor) editor).getAdapter(Control.class)).getText());
Expand All @@ -444,7 +441,7 @@ public void testTextEditDoesntAutomaticallySaveOpenExternalFiles() throws Except
te.setNewText("abc\ndef");
final var docEdit = new TextDocumentEdit(
new VersionedTextDocumentIdentifier(file.toURI().toString(), null),
List.of(te));
List.of(Either.forLeft(te)));
final var we = new WorkspaceEdit(List.of(Either.forLeft(docEdit)));
LSPEclipseUtils.applyWorkspaceEdit(we);
assertEquals("abc\ndef", ((StyledText) ((AbstractTextEditor) editor).getAdapter(Control.class)).getText());
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,58 @@
/*******************************************************************************
* 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.*;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.lsp4e.ui.LSPImages;
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);
}

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

}
4 changes: 2 additions & 2 deletions org.eclipse.lsp4e/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.12.0",
org.eclipse.tm4e.ui;resolution:=optional,
org.eclipse.ui.editors,
org.eclipse.ui.navigator;bundle-version="3.6.100",
org.eclipse.lsp4j;bundle-version="[0.24.0,0.25.0)",
org.eclipse.lsp4j.jsonrpc;bundle-version="[0.24.0,0.25.0)",
org.eclipse.lsp4j;bundle-version="[1.0.0,2.0.0)",
org.eclipse.lsp4j.jsonrpc;bundle-version="[1.0.0,2.0.0)",
org.eclipse.ui.console,
org.eclipse.ltk.core.refactoring,
org.eclipse.core.expressions;bundle-version="3.5.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.
Loading