Menu

#126 sidekick: completion for modes different to the buffer's

open
nobody
None
5
2014-07-19
2009-04-02
No

At the moment, sidekick looks at the mode of the buffer to choose which parser it uses (the getParserForBuffer method).
But some buffers have more than one mode, take jsp with some java in as an exemple. it would be quite useful to be able to use java completions within a jsp buffer, completion of beanshell within an actions.xml file, ...

Discussion

  • Anonymous

    Anonymous - 2009-04-02

    You're mentioning completion, but what about the actual parsing? If a different parser is used for an inner block in the buffer, that belongs to a different mode, then how is the sidekick tree part created for that block? It should be the same wrt completion I think.

     
  • Romain Francois

    Romain Francois - 2009-04-02

    Yes, that is tricky.
    Maybe we could treat the chunk of code that is inside as another buffer, parse this "buffer", and add the nodes to the main tree.

    completion is easier, because for many languages, you have all the information on the line where the caret is, so you can just pretend that the buffer is of the inner mode to get completion. That is what I have done here to get R completion inside sweave (latex-like) document :
    http://romainfrancois.blog.free.fr/index.php?post/2009/01/12/R-code-completion-in-sweave-chunks

     
  • Dale Anson

    Dale Anson - 2009-04-02

    Sidekick already has some framework for parsing different modes within the same file. See sidekick.enhanced.PartialParser, and see the HTML sidekick (in XML sidekick) for an example of how it delegates to the javascript and css sidekicks for <script> and <style> sections within the html document.

     
  • Romain Francois

    Romain Francois - 2009-04-02

    Nice ! Did not know about that. Thank you.
    Why is this not using positions instead of lines ? (just curious)

    Could this be used to delegate the completion as well, does not seem to work for me.

     

Log in to post a comment.