Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#115 Beauty Plugin: Generic code reformatter

open
nobody
None
8
2009-02-14
2009-01-29
oxk4r
No

Because jEdit supports a lot of languages, and actually the beautifier plugins availlable only work with Java or C. I, for example, work with ActionScript and a code beautifier is a must specially for larger files.
Thanks in advance.

Discussion

  • Dale Anson
    Dale Anson
    2009-01-30

    Arg. I realized after reading your request that this feature has been in the Beauty plugin for about a year and a half, but apparently, I never got around to completing the feature or documenting it. Would you see if this fits your needs:

    Install the Beauty plugin from Plugin Manager.

    Go to Utilities - BeanShell - Evaluate BeanShell Expression, then enter this in the dialog:

    jEdit.setBooleanProperty("beauty.useBuiltInIndenter", true)

    Then open one of your ActionScript file, and then Plugins - Beauty - Beautify Buffer.

    The "built in indenter" uses the mode of the current buffer and uses the indenting defined in the buffer to indent the buffer, so if the mode file is good, your indenting should come out pretty well too. The not completed part is I never added a checkbox to the plugin options to let the user turn this feature on.

     
  • oxk4r
    oxk4r
    2009-01-30

    Hi, deleanson, I have that plugins installed (and the AStyle Beautifier plugin too) but, it doesn't format the ActionScript code correctly. I have uploaded three captures to explain it. The first capture is the code correctly fomatted, the second is a capture after perform a format with Beauty (I highlighted the errors), and the third is the result for the second format: the lines become separated, and if more formats are performed this separation becomes greater every time. Moreover, if I choose java:beauty or javacc:beauty in the plugin options, then i get an error (see capture "Beauty Error").

     
  • oxk4r
    oxk4r
    2009-01-30

    • priority: 5 --> 8
     
  • oxk4r
    oxk4r
    2009-01-30

     
    Attachments
  • oxk4r
    oxk4r
    2009-01-30

  • oxk4r
    oxk4r
    2009-01-30

     
    Attachments
  • oxk4r
    oxk4r
    2009-01-30

  • admirau
    admirau
    2009-01-30

    And what about formatting PHP code?
    A style does not format PHPDoc comments correctly, PHP5…

    (Now I do that by running PEAR’s PHP Beautifier from the console).

     
  • Shouldn't this be in the Plugin Feature Requests tracker? As far as I know, the core does not have a definition of coding style, this task is therefore left for plugins. If the request is to add such beautifiers for the Beautify plugin, this request should move the Plugin Feature Requests tracker.
    If the request is to have a reformatting capability in the core, a good reason for that should be specified and then this request should be left here. Here's one such possible reason, but I'm not sure it's worth the effort:
    While a "beautify buffer" action is definitely helpful, an "on the fly" beautifier is also helpful - one that beautifies the buffer as I type, so I can type a long line without caring about indentation and lines breaks (to some extent) and have the beautifier take care of that for me as I type. The functionality of an "on the fly" beautifier can be defined as running the beautifier on each change in the buffer (e.g. character insertion, line removal, and so on), while maintaining the caret location correctly.

     
  • Alan Ezust
    Alan Ezust
    2009-02-14

    moving to plugin feature requests, and adding Beauty Plugin in the subject line.

     
  • Alan Ezust
    Alan Ezust
    2009-02-14

    • labels: 871559 -->
    • summary: Generic code reformatter --> Beauty Plugin: Generic code reformatter