Loading ...
Sorry, an error occurred while loading the content.

Re: searchpair() problem

Expand Messages
  • Mikolaj Machowski
    ... No, unfortunately in JavaScript embedding of functions is possible and function arguments are accessible from inside of internal functions. Recursive
    Message 1 of 5 , Jan 30, 2006
    • 0 Attachment
      Dnia poniedziaƂek, 30 stycznia 2006 15:51, hermitte@... napisaƂ:
      > Luc Hermitte <hermitte@...> wrote:
      > > IIRC, I proceed in several steps, which are:
      > > 1- search for pairs of brackets (I search for the opening bracket =>
      > > backward search)
      > > 2- check the scope associated to the bracket found (class, struct,
      > > function, ...) -- there, getline() was my friend
      > > 3- if this matches, then I do a forward searchpair on brackets (only),
      > > Otherwise, I proceed recursively to step 1-
      >
      > Just another though on this issue.
      > As your functions seems to always contain the "function" keyword, you
      > can just: - First, do a backward searchpair using the pattern you tried
      > to use in a forward search (don't forget to check whether the cursor was
      > within a function scope)
      > - Then do a forward search on brackets (only) to find the matching
      > closing curly bracket.
      >
      > It is a little bit longer, but still easier than doing recursive searchs
      > -- my aim was to determine the complete scope of classes and functions,
      > hence the recursive search.

      No, unfortunately in JavaScript embedding of functions is possible and
      function arguments are accessible from inside of internal functions.
      Recursive should be done. At the moment I decided not to do that.

      BTW - during the weekend I wrote JavaScript completion plugin and today
      sent it to Bram. Should be included in next snapshot of Vim7.

      JAVA SCRIPT
      *ft-javascript-omni*

      Completion of most elements of JavaScript language and HTML DOM.

      Complete:

      - variables
      - function name
      - function arguments
      - properties of variables trying to detect type of variable
      - complete HTML DOM objects and properties depending on context
      - keywords of language

      Completion works in separate JavaScript files (&ft==javascript) and inside
      of
      <script> tag of (X)HTML. Note: scanning will be only in scope of current
      tag.
      At the moment separate files are not taken into account.

      DOM compatibility

      At the moment (beginning of 2006) there are two main browsers - MS Internet
      Explorer and Mozilla Firefox. These two applications are covering over 90%
      of
      market. Theoretically standards are created by W3C organisation
      (http://www.w3c.org) but they are not always followed/implemented.

      IE FF W3C Omni completion ~
      +/- +/- + + ~
      + + - + ~
      + - - - ~
      - + - - ~

      Regardless from state of implementation in browsers but if element is
      defined
      in standards, completion plugin will place element in suggestion list. When
      both major engines implemented element, even if this is not in standards it
      will be suggested. All other elements are not placed in suggestion list.
    Your message has been successfully submitted and would be delivered to recipients shortly.