Search Unity

Syntax Highlighting for Text Editors

Discussion in 'Immediate Mode GUI (IMGUI)' started by joshcamas, Jan 6, 2019.

  1. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    638
    Hello friends :)
    I'm wanting to make a python code editor in unity, and thus I'm looking to build a syntax highlighter ^_^

    My current solution is to essentially build it from scratch, without using the text editor as a base. This makes some things easier, however it means all functionality (undo/redo,selection,copy/pasting,etc) needs to be reimplemented, which isn't the funnest. So... I'm wondering if I can use the text editor as a base and then build features on top of that. (Mainly syntax highlighting)

    I know there's a way to do markup with text editors, but I also know that the markup editor is sort of not meant for that, since the user can edit the markup content.

    Any thoughts?

    Josh
     
  2. MrMatthias

    MrMatthias

    Joined:
    Sep 18, 2012
    Posts:
    147
    Maybe using a Webview is an option (private API)? You could use existing syntax highlighters for that and most of the work is reduced to the integration into unity.
    This project uses a webview for displaying markdown files:
    https://github.com/Sirithang/UnityMarkdeepViewer
     
    joshcamas likes this.
  3. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    638
    Oooo that's an awesome idea!!!!!