Skip to content

Commit

Permalink
fix: Path matching in TextSelectionToIVariable does not work on Windo…
Browse files Browse the repository at this point in the history
…ws (#1175)

+ Convert sourceElement to URI before comparing paths
+ Bump point version of org.eclipse.lsp4e.debug
  • Loading branch information
FlorianKroiss authored Jan 13, 2025
1 parent 308d167 commit bbb919d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion org.eclipse.lsp4e.debug/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: Debug Adapter client for Eclipse IDE (Incubation)
Bundle-SymbolicName: org.eclipse.lsp4e.debug;singleton:=true
Bundle-Vendor: Eclipse LSP4E
Bundle-Version: 0.15.13.qualifier
Bundle-Version: 0.15.14.qualifier
Bundle-Activator: org.eclipse.lsp4e.debug.DSPPlugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URI;
import java.nio.file.InvalidPathException;
import java.nio.file.Paths;
import java.util.Objects;
import java.util.concurrent.ExecutionException;
import java.util.function.Predicate;
Expand Down Expand Up @@ -125,7 +128,17 @@ private boolean match(IDocument document, DSPStackFrame frame) {
final var uri = LSPEclipseUtils.toUri(document);
if (uri == null)
return false;
return Objects.equals(uri.getPath(), sourceElement);

// Convert sourceElement to a URI to normalize potential backslashes in the
// path. This can be necessary on Windows.
final URI sourceUri;
try {
sourceUri = Paths.get(sourceElement).toUri();
} catch (InvalidPathException invalidPath) {
return false;
}

return Objects.equals(uri.getPath(), sourceUri.getPath());
}
return false;
}
Expand Down

0 comments on commit bbb919d

Please sign in to comment.