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

Robot tests need porting to JupyterLab 4.0 (or replacing with galata) #961

Closed
krassowski opened this issue Aug 26, 2023 · 4 comments · Fixed by #966 or #978
Closed

Robot tests need porting to JupyterLab 4.0 (or replacing with galata) #961

krassowski opened this issue Aug 26, 2023 · 4 comments · Fixed by #966 or #978
Labels
help wanted Extra attention is needed
Milestone

Comments

@krassowski
Copy link
Member

Since porting this extension to JupyterLab 4 with CodeMirror 6 (#949) the acceptance tests are no longer passing. A few things will require more work to get them to work, largely due to CM6.

  • Diagnostics no longer have title, a property we were extensively exploiting in the tests; instead the title is stored in instance bound to the element, accessible by semi-private cmView attribute (element.cmView.mark.spec.diagnostic.message).
  • Hovering over specific tokens is much harder as CM no longer wraps everything into individual <span> elements - instead multiple variables can be in the same DOM text node, which prevents the use of selectors

One approach to solve these would be instrumenting CodeMirror to produce title and replacing its tokenizer for tests, but then we are not testing the real thing. Maybe we could use aria-label instead of title to also improve accessibility? Related CM discussions:

@krassowski
Copy link
Member Author

Whops, this should not get closed. While #966 does solve a lot of the failures, the problem with hovering over tokens remains.

@krassowski krassowski reopened this Aug 29, 2023
@bollwyvl
Copy link
Collaborator

As the other thing got merged, will hoist my comment here:

Yep, as I've found over on the relatively-simple jupyterlab_robotmode, CM6 is a lot harder to reason about from outside the system. And trying to get DOM nodes back out across a JSON pipe is... not going to work so well. If one could get access to a node, it would be relatively simple to apply some junk to it (i kinda like the dataset stuff, as it's unlikely to conflict with anything visual), but the cmView(.editor)(.state) do not make it very easy to get a 1:1 mapping of tokens back to dom nodes. And then there's the bespoke css-in-js: i get why all this subterfuge, but it's definitely not very cool for getting predictable outputs, <prefix><integer> just isn't going to be stable over time.

If we could get back some lookup tables for the CSS classes, this could... sorta work.

I've seen some references to syntaxTree(state), but that's not available from the editor/view/state/document instances, and I'm not sure it will give back a pithy location, so might need an icky extension to mount it globally or soemthing...

As we develop solutions to some of these problems, I'd love to integrate them into robotframework-jupyterlibrary, so we don't have to rebuild this stuff on every project...

@krassowski
Copy link
Member Author

For hover we could also traverse the cursor along the line waiting for the hover indicator to show up. Then query for a span. We could use a heuristic of moving cursor 10px at a time left to right while in the middle of the line. We would need the same for jump to definition and rename.

@krassowski
Copy link
Member Author

#978 fixes most of it, except for completer and ironically a test for Robot itself (pending MarketSquare/jupyterlab_robotmode#14)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
2 participants