Skip to content

Commit 34b7588

Browse files
authored
fix: fix local dev when using local build of LSP4IJ (#1440)
* fix: fix local dev when using local build of LSP4IJ Signed-off-by: Stephane Bouchet <sbouchet@redhat.com> * fix: fix unit test Signed-off-by: Stephane Bouchet <sbouchet@redhat.com> --------- Signed-off-by: Stephane Bouchet <sbouchet@redhat.com>
1 parent da65675 commit 34b7588

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

build.gradle.kts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ dependencies {
8888
if (localLsp4ij.isDirectory) {
8989
// In case Gradle fails to build because it can't find some missing jar, try deleting
9090
// ~/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/unzipped.com.jetbrains.plugins/com.redhat.devtools.lsp4ij*
91-
platformPlugins.add(localLsp4ij.toString())
91+
println("use local build of LSP4IJ")
92+
localPlugin(localLsp4ij.toString())
9293
} else {
9394
// When running on CI or when there's no local lsp4ij
9495
val latestLsp4ijNightlyVersion = fetchLatestLsp4ijNightlyVersion()
@@ -97,8 +98,6 @@ dependencies {
9798
//Uses `platformPlugins` property from the gradle.properties file.
9899
platformPlugins.addAll(properties("platformPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) }.get())
99100
plugins(platformPlugins)
100-
// for local plugin -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin-faq.html#how-to-add-a-dependency-on-a-plugin-available-in-the-file-system
101-
//plugins.set(listOf(file("/path/to/plugin/")))
102101
// Print plugins
103102
println("bundledPlugins: $platformBundledPlugins")
104103
println("marketplacePlugins: $platformPlugins")

src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/psi/internal/jaxrs/java/JaxRsWorkspaceSymbolParticipant.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,9 @@
2828
import org.eclipse.lsp4j.SymbolKind;
2929

3030
import java.net.MalformedURLException;
31-
import java.net.URI;
32-
import java.net.URISyntaxException;
3331
import java.net.URL;
3432
import java.util.ArrayList;
33+
import java.util.Collections;
3534
import java.util.HashSet;
3635
import java.util.List;
3736
import java.util.Set;
@@ -53,7 +52,7 @@ public void collectSymbols(Module project, IPsiUtils utils, List<SymbolInformati
5352

5453
JaxRsContext jaxrsContext = new JaxRsContext(project);
5554
Set<PsiClass> jaxrsTypes = getAllJaxRsTypes(project, utils, monitor);
56-
if (jaxrsTypes == null || monitor.isCanceled()) {
55+
if (monitor.isCanceled()) {
5756
return;
5857
}
5958
List<JaxRsMethodInfo> methodsInfo = new ArrayList<>();
@@ -102,20 +101,19 @@ private static Set<PsiClass> getAllJaxRsTypes(Module javaProject, IPsiUtils util
102101
for (IJaxRsInfoProvider provider : JaxRsInfoProviderRegistry.getInstance().getProviders()) {
103102
jaxrsTypes.addAll(provider.getAllJaxRsClasses(javaProject, utils,monitor));
104103
if (monitor.isCanceled()) {
105-
return null;
104+
return Collections.emptySet();
106105
}
107106
}
108107
return jaxrsTypes;
109108
}
110109

111-
private static SymbolInformation createSymbol(JaxRsMethodInfo methodInfo, IPsiUtils utils) throws MalformedURLException, URISyntaxException {
110+
private static SymbolInformation createSymbol(JaxRsMethodInfo methodInfo, IPsiUtils utils) throws MalformedURLException {
112111
TextRange sourceRange = methodInfo.getJavaMethod().getNameIdentifier().getTextRange();
113112
Range r = utils.toRange(methodInfo.getJavaMethod(), sourceRange.getStartOffset(), sourceRange.getLength());
114113
Location location = new Location(methodInfo.getDocumentUri(), r);
115114

116115
StringBuilder nameBuilder = new StringBuilder("@");
117-
URL url = new URI(methodInfo.getUrl()).toURL();
118-
String path = url.getPath();
116+
String path = new URL(methodInfo.getUrl()).getPath();
119117
nameBuilder.append(path);
120118
nameBuilder.append(": ");
121119
nameBuilder.append(methodInfo.getHttpMethod());

src/test/java/com/redhat/devtools/intellij/quarkus/completion/MavenApplicationPropertiesCompletionTest.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import com.redhat.devtools.intellij.MavenEditorTest;
2020
import com.redhat.devtools.intellij.lsp4mp4ij.psi.core.MicroProfileMavenProjectName;
2121
import com.redhat.devtools.intellij.quarkus.QuarkusDeploymentSupport;
22+
import com.redhat.devtools.lsp4ij.client.indexing.ProjectIndexingManager;
2223
import org.junit.Test;
2324

2425
import java.io.File;
@@ -38,16 +39,18 @@ public void testBooleanCompletion() throws Exception {
3839
codeInsightTestFixture.performEditorAction(IdeActions.ACTION_EDITOR_MOVE_LINE_END);
3940
codeInsightTestFixture.performEditorAction(IdeActions.ACTION_EDITOR_START_NEW_LINE);
4041
insertLine("quarkus.arc.auto-inject-fields=");
41-
LookupElement[] elements = codeInsightTestFixture.completeBasic();
42-
assertNotNull(elements);
43-
assertEquals(2, elements.length);
42+
ProjectIndexingManager.waitForIndexingAll().thenRunAsync(() -> {
43+
LookupElement[] elements = codeInsightTestFixture.completeBasic();
44+
assertNotNull(elements);
45+
assertEquals(2, elements.length);
46+
});
4447
}
4548

4649
private void insertLine(String s) throws InterruptedException {
4750
for (int i = 0; i < s.length(); ++i) {
4851
codeInsightTestFixture.type(s.charAt(i));
4952
}
50-
Thread.sleep(1000);
53+
Thread.sleep(100);
5154
}
5255

5356
protected Module loadMavenProject(String projectName) throws Exception {

src/test/java/com/redhat/microprofile/psi/quarkus/renarde/RenardeJaxRsTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,13 @@ public void testWorkspaceSymbols() throws Exception {
8585
si("@/about: GET", r(25, 28, 33)), //
8686
si("@/play/id: GET", r(9, 18, 26)), //
8787
si("@/play/start: GET", r(13, 18, 23)), //
88-
// From Renarde JAR
89-
si("@/_renarde/security/login-{provider}: GET", r(24, 16, 30)),
90-
si("@/_renarde/security/logout: GET", r(27, 37, 43)),
91-
si("@/_renarde/security/github-success: GET", r(31, 16, 29)),
92-
si("@/_renarde/security/twitter-success: GET", r(35, 16, 30)),
93-
si("@/_renarde/security/oidc-success: GET", r(39, 16, 30)),
94-
si("@/_renarde/security/oidc-success: POST", r(44, 16, 31)));
88+
// From Renarde JAR (RenardeSecurityController)
89+
si("@/_renarde/security/login-{provider}: GET", r(41, 16, 30)),
90+
si("@/_renarde/security/logout: GET", r(52, 20, 26)),
91+
si("@/_renarde/security/github-success: GET", r(58, 16, 29)),
92+
si("@/_renarde/security/twitter-success: GET", r(65, 16, 30)),
93+
si("@/_renarde/security/oidc-success: GET", r(72, 16, 30)),
94+
si("@/_renarde/security/oidc-success: POST", r(79, 16, 31)));
9595
}
9696

9797
}

0 commit comments

Comments
 (0)