Skip to content

Commit

Permalink
Doc URI changes for Win to revisit. All tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
BoykoAlex committed Dec 8, 2024
1 parent 5301215 commit 053995f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ public String createTempUri(String extension) throws Exception {
if (extension == null) {
extension = getFileExtension();
}
return File.createTempFile("workingcopy", extension).toURI().toASCIIString();
return File.createTempFile("workingcopy", extension).toPath().toUri().toASCIIString();
}

public void assertCompletion(String textBefore, String expectTextAfter) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import java.net.URI;
import java.net.URL;
import java.nio.file.Paths;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicReference;

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

try {
URI uri = url.get().toURI();
URL sourceUrl = url.get();
URI uri = sourceUrl.getProtocol().equals("file") ? Paths.get(sourceUrl.toURI()).toFile().toPath().toUri() : sourceUrl.toURI();
Range r = cuCache.withCompilationUnit(project, uri, (cu) -> {
AtomicReference<Range> range = new AtomicReference<>(null);
if (cu == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import java.net.URI;
import java.net.URL;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
Expand Down Expand Up @@ -266,7 +267,8 @@ public Location getLocation(CompilationUnitCache cuCache, JavaDocumentUriProvide
loc.setUri(docUri.toASCIIString());

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

0 comments on commit 053995f

Please sign in to comment.