Search code examples
ace-editor

How to get a method outline with ace


Does anyone know if it is possible to get an outline or a list of tags for an opened document with ace, like you could get for example with ctags?


Solution

  • I think i've found a solution: You can call editor.session.getTokens(0) to get all tokens of the tokeniser for the current session.

    For each token, you get the following information:

    index: 2
    start: 9
    type: "entity.name.function"
    value: "foo"
    

    With this, you can easily create an outline