Skip to content

Commit 818180c

Browse files
committed
Doc URI changes for Win to revisit. All tests pass
1 parent 726c2be commit 818180c

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

headless-services/commons/language-server-test-harness/src/main/java/org/springframework/ide/vscode/languageserver/testharness/LanguageServerHarness.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ public String createTempUri(String extension) throws Exception {
766766
if (extension == null) {
767767
extension = getFileExtension();
768768
}
769-
return File.createTempFile("workingcopy", extension).toURI().toASCIIString();
769+
return File.createTempFile("workingcopy", extension).toPath().toUri().toASCIIString();
770770
}
771771

772772
public void assertCompletion(String textBefore, String expectTextAfter) throws Exception {

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
import java.net.URI;
1414
import java.net.URL;
15+
import java.nio.file.Paths;
1516
import java.util.Optional;
1617
import java.util.concurrent.atomic.AtomicReference;
1718

@@ -59,7 +60,8 @@ public Location findLocation(IJavaProject project, IMember member) {
5960
String memberBindingKey = member.getBindingKey();
6061

6162
try {
62-
URI uri = url.get().toURI();
63+
URL sourceUrl = url.get();
64+
URI uri = sourceUrl.getProtocol().equals("file") ? Paths.get(sourceUrl.toURI()).toFile().toPath().toUri() : sourceUrl.toURI();
6365
Range r = cuCache.withCompilationUnit(project, uri, (cu) -> {
6466
AtomicReference<Range> range = new AtomicReference<>(null);
6567
if (cu == null) {

headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/test/DefinitionLinkAsserts.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
import java.net.URI;
1414
import java.net.URL;
15+
import java.nio.file.Paths;
1516
import java.util.ArrayList;
1617
import java.util.Arrays;
1718
import java.util.List;
@@ -266,7 +267,8 @@ public Location getLocation(CompilationUnitCache cuCache, JavaDocumentUriProvide
266267
loc.setUri(docUri.toASCIIString());
267268

268269
String typeName = fqName.substring(fqName.lastIndexOf('.') + 1);
269-
URI sourceUri = sourceUrl.get().toURI();
270+
URL url = sourceUrl.get();
271+
URI sourceUri = url.getProtocol().equals("file") ? Paths.get(sourceUrl.get().toURI()).toFile().toPath().toUri() : url.toURI();
270272
Range r = cuCache.withCompilationUnit(project, sourceUri, (cu) -> {
271273
try {
272274
TextDocument doc = new TextDocument(sourceUrl.get().toString(), LanguageId.JAVA);

0 commit comments

Comments
 (0)