Community
    • Login

    Incorporating Prettier and/or js-beautify

    Scheduled Pinned Locked Moved General Discussion
    3 Posts 3 Posters 1.2k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • minig0dM
      minig0d
      last edited by

      Is anyone using Prettier or js-beautify with N++? I’m sure they could be incorporated with a custom plugin or possibly with the “pork2sausage” plugin, but doing so appears to be above my skill level. I’m actually pretty shocked that I haven’t seen numerous requests posted specifically for either of these tools since they seem to be very prevalent in terms of integration with most of the other popular editors out there. Both appear to be fairly flexible in existing generic integration capabilities so I’m hoping there is a really easy existing config to do so. (Or if not, I’m sure it would become a highly utilized plugin given people’s affection for HTMLTidy and TextFx solutions which seem far more primitive.)

      Ideally would love to have both whole file and selection formatting ability like I can in VSCode.

      ShobanskyS 1 Reply Last reply Reply Quote 0
      • ShobanskyS
        Shobansky @minig0d
        last edited by

        @minig0d I totally agree. I miss the capability to include prettier in Notepad++. This editor has been created to highlight source code from many languages. Offers many advantages compared to a classic notepad. That was the reason for the name of this editor, I think. So I don’t understand why it doesn’t have some formatting capability like other editors… Notepad++ is a really great lightweight editor, but the mentioned option is missing for many of us.

        PeterJonesP 1 Reply Last reply Reply Quote 0
        • PeterJonesP
          PeterJones @Shobansky
          last edited by

          @Shobansky ,

          A few months after the original post was made, this FAQ was created, which explains how to use pork2sausage plugin (or the run menu, or the NppExec plugin) to transform text. And since things like Prettier or js-beautify exist, it makes more sense to pass formatting to an external utility that’s customized for a specific programming language, to make users of that programming language happy – rather than relying on limiting the formatting to whatever rules that one developer adds to the editor. (Given the arguments people have over the auto-indentation, and how the developer hasn’t been able to keep everyone happy even on that “simple” aspect of formatting, trying to get a generic formatter to the point that everyone is happy is virtually impossible.)

          I don’t understand why it doesn’t have some formatting capability like other editors…

          Every editor has strengths that it focuses its feature development on. Notepad++'s strengths are in the ease and availablilty of plugins and running external applications… so plugins specific to the language (like HTML Tidy) or plugins that launch external programs (like pork2sausage) are the way that Notepad++ made it easy to get formatting customized the way you want it, rather than restricting you to the ability of the N++ developer to support and implement.

          And the developer’s philosophy is that, unless it’s something that he wants to put his own stamp on, if it’s already been implemented well in a plugin or can be easily run through the run-menu/pork2sausage/nppexec, then he doesn’t want to waste his effort on doing something mediocre built-in when something good-to-great already exists. As someone with a full time job completely unrelated to Notepad++, he wants to focus his limited development time to things that he likes, he wants, or that he can add value to.

          Moreover, in the modern realm, things are moving toward LSP-based solutions – so if the languages you program in have LSP servers available, then (as was mentioned in this very similar question a few days ago) you can use one of the LSP plugins (the plugin by Kered or @Ekopalypse’s LSP client plugin) – so if your language’s LSP server has the code formatting feature, the LSP plugin you choose should be able to activate that.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors