Matching Brackets and Prototyping

2003-07-25
2003-08-25
  • Holger Plankermann

    Hello!

    I am working on a JavaScript Project and I noticed your plugin.
    It's very nice indeed, but I have a few questions:

    Would it be possible to implement a matching brackets feature (similar to the one in the Java Editor).
    Or is there any other way to activate it (i am quite new to Eclipse).

    Is the outlining of prototyped functions planned to be added (of the like "test :function(param){ ..."
    That would be great.

    Bye

    Holger Plankermann

     
    • Alex Fitzpatrick

      I'm actually on vacation for a couple of weeks, and I just moved (and my internet connection is down until the cable company connects my new neighborhood...) so I'm not going to be working on the editor until the middle of August at the earliest. I hope to spend some hobby time on it in the fall especially since it gives me a chance to work in Java.

      I'm hoping to add bracket matching soon, as well as better automatic indenting (which may lead to code formatting, we'll see). (September?)

      I had never seen that prototyping syntax until after I started working on the plug-in when I started testing and researching feature completeness. (A good test is to to edit the JavaScript code distributed with Mozilla which uses that syntax heavily.) It shouldn't be too hard to add so it may appear before bracket matching etc.

      Don't hesitate to add feature requests to the database, feedback and requests are what will drive the editor forward.

      --
      Alex

       
    • Charles Fulnecky

      Hi Alex,

      I too very much like your plug-in!  Strangely enough I actually went to the forum to request that you add prototyped functions to the outline view as well.  It would be nice to see the inner class prototypes (as methods) along with the attributes currently displayed.

      code snippet included:
      function xbXMLHttpRequest()
      {
        _classes.defineClass('xbXMLHttpRequest', _prototype_func);
       
        this.init();
       
        function _prototype_func()
        {
          xbXMLHttpRequest.prototype.init = init;
          function init()
          {
            xbDEBUG.dump('xbXMLHttpRequest::init');
            var eError;
           
            this.parentMethod('init');
            this.parseError = new xbXMLDOMParseError(0, 0, 0, 0, '', '', '');

            this.progId = null;
            this.url = '';
            this.document = null;
           
            if (typeof(XMLHttpRequest) != 'undefined')
            {
              this.progId = 'Mozilla.XMLHTTP';
              this._native = new XMLHttpRequest();
            }
            else
            {
              try
              {
                this.progId = 'Msxml2.XMLHTTP.4.0';
                this._native = new ActiveXObject(this.progId);
              }
              catch (eError)
              {
                try
                {
                  this.progId = 'Msxml2.XMLHTTP';
                  this._native = new ActiveXObject(this.progId);
                }
                catch (eError)
                {
                }
              }
            }

            this._onload = this._onerror = null;
          }
         
          // ie and mozilla
          xbXMLHttpRequest.prototype.abort = abort;
          function abort()
          {
            xbDEBUG.dump('xbXMLHttpRequest::abort');
            this._native.abort();
          }
         
          // ie and mozilla
          xbXMLHttpRequest.prototype.getAllResponseHeaders = getAllResponseHeaders;
          function getAllResponseHeaders()
          {
            xbDEBUG.dump('xbXMLHttpRequest::getAllResponseHeaders');
            return this._native.getAllResponseHeaders();
          }
         
          // ie and mozilla
          xbXMLHttpRequest.prototype.getResponseHeader = getResponseHeader;
          function getResponseHeader(header)
          {
            xbDEBUG.dump('xbXMLHttpRequest::getResponseHeader("' + header + '")');
            return this._native.getReponseHeader(header);
          }
        .
        .
        .

        }
      }

       
      • Alex Fitzpatrick

        The style above is used in the xb api discussed at:
        http://devedge.netscape.com/viewsource/2001/oop-javascript/

        and implemented here:
        http://sg.ioslo.net/lib/js/

         
        • Charles Fulnecky

          Yes the above style is from the xb api.  We have an application that was designed using Java UML tools, the class structure was then "mimicked" in javascript per the syntax described at the dev site you listed above.  The ultimate goal is to generate the javascript "classes" programatically from the diagrams instead of generating Java.  Alternative suggestions are welcome :-)

           

Log in to post a comment.