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:
    1,277
    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:
    191
    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:
    1,277
    Oooo that's an awesome idea!!!!!
     
  4. Plimpton

    Plimpton

    Joined:
    Jan 31, 2019
    Posts:
    6
    Hi, did you find how to do it? I'm also trying to create a syntax highlighter
     
  5. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    1,277
    I did not sadly