|
1 | 1 | /*******************************************************************************
|
2 |
| - * Copyright (c) 2018, 2019 Pivotal, Inc. |
| 2 | + * Copyright (c) 2018, 2023 Pivotal, Inc. |
3 | 3 | * All rights reserved. This program and the accompanying materials
|
4 | 4 | * are made available under the terms of the Eclipse Public License v1.0
|
5 | 5 | * which accompanies this distribution, and is available at
|
|
10 | 10 | *******************************************************************************/
|
11 | 11 | package org.springframework.ide.vscode.boot.java.links;
|
12 | 12 |
|
| 13 | +import java.net.URLEncoder; |
| 14 | +import java.nio.charset.StandardCharsets; |
13 | 15 | import java.nio.file.Path;
|
14 | 16 | import java.util.Optional;
|
15 | 17 | import java.util.concurrent.CompletableFuture;
|
@@ -42,7 +44,12 @@ public Optional<String> sourceLinkUrlForFQName(IJavaProject project, String fqNa
|
42 | 44 | CompletableFuture<Optional<String>> link = server.getClient().javadocHoverLink(new JavaDataParams(projectUri, bindingKey.toString(), true))
|
43 | 45 | .thenApply(l -> Optional.ofNullable(l));
|
44 | 46 | 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 | + }); |
46 | 53 | } catch (InterruptedException | ExecutionException | TimeoutException e) {
|
47 | 54 | log.error("", e);
|
48 | 55 | }
|
|
0 commit comments