Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the highlight() function is not working as expect for nodes including ":" symbol #172

Open
liijunwei opened this issue Jun 26, 2024 · 1 comment · May be fixed by #173
Open

the highlight() function is not working as expect for nodes including ":" symbol #172

liijunwei opened this issue Jun 26, 2024 · 1 comment · May be fixed by #173

Comments

@liijunwei
Copy link

liijunwei commented Jun 26, 2024

hi @tintinweb , really appreciated that you shared this plugin on vscode, it's been quite helpful for my daily work
especially the "bidirectional highlight" feature, makes upstreams and downstreams quite clear instantly

while using I found some unexpected behavior though, and I'd like to report and propose an quick fix to optimize the user experience 🙏

Minimal, Reproducible Example

digraph G {
  rankdir = LR;
  node [shape = note;];
  
  // bidirectional highlight works well
  z -> a;
  y -> a;
  a -> b -> d;
  b -> c -> e;
  a -> e;
  
  // bidirectional highlight works unexpected
  // e.g. click "c:d:e", "e:f:g" and "d:e:f" are not highlighted
  "a:b:c" -> "b:c:d";
  "b:c:d" -> "c:d:e";
  "c:d:e" -> "d:e:f";
  "c:d:e" -> "e:f:g";
  "g:h:i" -> "h:i:j";
  "h:i:j" -> "d:e:f";
  "h:i:j" -> "e:f:g";
  "c:d:e" -> "foo";
}

image

rough cause

it's using connection[0].split(":")[0]; and connection[1].split(":")[0]; in jquery.graphviz.svg.js

which implicitly depends on the format of node identifier

quick fix

removing .split(":")[0] from GraphvizSvg.prototype.linkedTo and GraphvizSvg.prototype.linkedFrom

later I checked out jquery.graphviz.svg.js source code and found the copy in source code is a bit outdated, if I copy the code here, everything works fine

@liijunwei
Copy link
Author

one more question to the author and contributors: I found I'm not able to make console.log or breakpoint to work in vscode-interactive-graphviz/content/highlighting.js (within Extension Development Host), it makes reasoning and debugging very very hard for me, could you share how did you debug while developing the extension?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant