Skip to content

Add javascript mode to the editor #612

Closed

Description

@processing-bugs

Original author: Chris.Lonnen (March 11, 2011 21:53:55)

Because of the design of Processing.js (p.js) there is a lot of overlap with good ol' Java mode that I can extend and re-use. Below are features I've thought of to include, but please post anything(s) I've missed.

Specific features of the JavaScript mode should include:

  • exporter
  • added highlighting for p.js specific methods
  • examples
  • new color scheme

possibilities for inclusion:

  • removal of unimplemented methods from highlighting
  • export choices -- compiled JS or concatenated.pde

Original issue: http://code.google.com/p/processing/issues/detail?id=573

Activity

  1. processing-bugs commented on Feb 10, 2013

    @processing-bugs
    Author

    From r...@processing.org on March 12, 2011 04:17:34
    I think "yes" for the first five points for sure. I'll take care of the new color scheme, we're designing these in relation to each other. I'm not certain of the export options, I'll defer.

  2. processing-bugs commented on Feb 10, 2013

    @processing-bugs
    Author

    From Chris.Lonnen on March 13, 2011 16:48:57
    P.js needs JavaScript and Canvas, so I see two was to implement a runner:

    1. Embed Rhino with Canvas (http://rhino-canvas.sourceforge.net/). This would allow a javamode-like runner, but add to the size of project. This may not even really be a solution, as Rhino Canvas hasn't been updated since 2009 and wouldn't have changes to the spec or WebGL.
    2. Create the page as if we were doing an export and launch a browser with the local file. Errors won't be communicated back the PDE but the runner could track the browser process, be notified of exit codes, and send the shutdown message.

    I'm favoring #2 and that's what I'll implement unless someone suggests a better way.

  3. processing-bugs commented on Feb 10, 2013

    @processing-bugs
    Author

    From Chris.Lonnen on March 27, 2011 02:20:07
    r7818 contains the initial commit of JS mode.

    Reas, the theme resources in processing/javascript are ready for a proper coloring. Same with the template inside the applet_js folder. I made some color alterations for debugging, so it will look particularly strange right now.

    Email with Fry pointed out that we may as well strip the runner entirely and just have an exporter, so it is essentially an integrated and slightly updated version of fjenett's tool. There are some TODOs to clean up, but this will work for now.

  4. processing-bugs commented on Feb 10, 2013

    @processing-bugs
    Author

    From fjen...@gmail.com on June 03, 2011 20:13:44
    Just commited some changes to JavaScript mode, ready for testing.

    r7988

    Server:
    runs on 127.0.0.1:

    toolbar buttons:
    [Run] export and start server if not running (+open default browser with url)
    [Stop] stop server

    cmd-s ("save") has will also export behind the scenes when server is running.
    this allows for fast: write, save, reload browser workflow.

    Templates:
    custom templates are supported: Menu > Sketch > "Copy template to sketch" (wording?)
    copies the default template to sketchfolder

    you can edit template.html, add files, ...
    anything in sketchfolder/template_js will be copied to applet_js on export.
    this allows for adding more files, etc.

    Directives:
    Menu > Sketch > Directives

    the "Directives Editor" will read all settings from the .pde's.
    it allows to scan the data folder for fonts and images.
    "OK" will write directives to top of main sketch .pde

    Types:
    added ".js" file type / tabs
    allows to add custom js code (DOM, ...) to the sketch

    (Taking over ownership from Chris, hope that's OK.)

    That's it for now. Have fun, lemme know how it goes. Tested Mac/Win, i'm curious about Linux.

    Open for 2.0:
    – improve default template
    – examples
    – wiki entry on how to use

    F

  5. processing-bugs commented on Feb 10, 2013

    @processing-bugs
    Author

    From fjen...@gmail.com on June 06, 2011 05:26:06
    Just because i don't know where else to collect these thoughts …

    For 2.+ / later / never:
    – minification / obfuscation (by means of reducing size)
    – logger based on WebSockets (send println() back to PDE)
    – application export? Wrapper app similar to PhoneGap? Would allow for (some) hardware access
    – base64 encoder for fonts / images
    – plain js export (run code though the p.js parser, eval(), then save)
    – js syntax checker, jslint

  6. processing-bugs commented on Feb 10, 2013

    @processing-bugs
    Author

    From fjen...@gmail.com on June 08, 2011 10:31:51
    I started a wiki page for JS mode:
    http://wiki.processing.org/w/JavaScript

  7. processing-bugs commented on Feb 10, 2013

    @processing-bugs
    Author

    From fjen...@gmail.com on June 12, 2011 16:11:15
    Processing.js uses Google Closure in their build chain:
    http://code.google.com/closure/

    It's Java-based (~3mb), so it could be very useful to js mode as well, for syntax-checking, joining, optimizing, ..

  8. processing-bugs commented on Feb 10, 2013

    @processing-bugs
    Author

    From f...@processing.org on March 26, 2012 22:37:43
    Is it time to close this one?

  9. processing-bugs commented on Feb 10, 2013

    @processing-bugs
    Author

    From fjen...@gmail.com on March 27, 2012 05:35:22
    Jup. Just left it sitting here to collect thoughts ...

  10. github-actions commented on Jun 18, 2021

    @github-actions

    This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  11. locked as resolved and limited conversation to collaborators on Jun 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions