Skip to content

Commit dce6b10

Browse files
committed
'jdt' scheme URI links turned into 'command' scheme URIs
1 parent 0f1a0d4 commit dce6b10

File tree

2 files changed

+12
-2
lines changed
  • vscode-extensions/vscode-spring-boot/lib

2 files changed

+12
-2
lines changed

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/links/JavaServerSourceLinks.java

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2018, 2019 Pivotal, Inc.
2+
* Copyright (c) 2018, 2023 Pivotal, Inc.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v1.0
55
* which accompanies this distribution, and is available at
@@ -10,6 +10,8 @@
1010
*******************************************************************************/
1111
package org.springframework.ide.vscode.boot.java.links;
1212

13+
import java.net.URLEncoder;
14+
import java.nio.charset.StandardCharsets;
1315
import java.nio.file.Path;
1416
import java.util.Optional;
1517
import java.util.concurrent.CompletableFuture;
@@ -42,7 +44,12 @@ public Optional<String> sourceLinkUrlForFQName(IJavaProject project, String fqNa
4244
CompletableFuture<Optional<String>> link = server.getClient().javadocHoverLink(new JavaDataParams(projectUri, bindingKey.toString(), true))
4345
.thenApply(l -> Optional.ofNullable(l));
4446
try {
45-
return link.get(10, TimeUnit.SECONDS);
47+
return link.get(10, TimeUnit.SECONDS).map(s -> {
48+
if (s.startsWith("jdt:/")) {
49+
return "command:java.open.file?" + URLEncoder.encode("[\"" + URLEncoder.encode(s, StandardCharsets.UTF_8) + "\"]", StandardCharsets.UTF_8);
50+
}
51+
return s;
52+
});
4653
} catch (InterruptedException | ExecutionException | TimeoutException e) {
4754
log.error("", e);
4855
}

vscode-extensions/vscode-spring-boot/lib/Main.ts

+3
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ export function activate(context: VSCode.ExtensionContext): Thenable<ExtensionAP
6363
},
6464
workspaceOptions: VSCode.workspace.getConfiguration("spring-boot.ls"),
6565
clientOptions: {
66+
markdown: {
67+
isTrusted: true
68+
},
6669
uriConverters: {
6770
code2Protocol: (uri) => {
6871
/*

0 commit comments

Comments
 (0)