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

Add API to syntax-highlight code #386

Open
rock3r opened this issue May 16, 2024 · 0 comments
Open

Add API to syntax-highlight code #386

rock3r opened this issue May 16, 2024 · 0 comments
Labels
feature New feature or request

Comments

@rock3r
Copy link
Collaborator

rock3r commented May 16, 2024

Users may want to display code, and having syntax highlighting is important for readability.

We need an API that can be used to turn a string of code into a highlighted AnnotatedString. On the bridge side, the styling must come from the EditorScheme, and on the standalone side, we should use the defaults for Light and Dark themes. On the bridge side, we expect fully semantic highlighting where supported by the current IDE, and on the standalone side, we expect basic syntax-based highlighting. On the bridge side, all the languages supported by the current IDE must be supported, and on the standalone side we must support at a minimum Kotlin, Java, XML, JSON, JS, TS, HTML, CSS, Python. Other languages support is nice to have but not required.

Thoughts:

  1. Highlighting depends on the EditorScheme in bridge, and theme in standalone. If it is possible to avoid re-computing the highlighing info (e.g., determining code semantics) but limit ourselves to creating a new AnnotatedString with updated spans, this would be preferable for perf reasons.
  2. The styling scheme should be stored in a composition local, and accessible via a theme-level getter, such as JewelTheme.codeStyling
  3. Styling should follow the usual pattern of "definition in foundation, implementations in standalone and bridge"
@rock3r rock3r added the feature New feature or request label May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant