- Perltidy
- Format perl files with perltidy
- 81 Installs
-
This extension is allowed to:
- Launch Subprocesses
Readme
Perltidy for Nova
This extension provides integration with the Perltidy formatter for the Nova text editor.
Requirements
The only requirement is Perltidy itself, which can be installed from the official website, CPAN, or Homebrew:
$ brew install perltidy
Configuration
To configure global preferences, open Extensions → Extension Library... then select perltidy's Preferences tab. Note that this extension relies on parsing STDOUT
and STDERR
from Perltidy. If you include options to suppress those it will not work as expected.
Usage
To run Perltidy:
- Open the command palette and type
perltidy
- Select
perltidy
from the Editor menu
Perltidy will then format and replace the text in your current editor with a "tidy" version based on your configuration. If a block of text is selected, it will only format the selected text.
Errors
This extension will not apply any changes if Perltidy returns an error code. Perltidy does provide specific error output when code is not valid Perl, but it is not a linter. This extension attempts to capture and parse the Perltidy error output and convert it into issues within Nova:
This approach may yield mixed results; for example, a missing closing quote on line 30 might not manifest as a Perltidy error until the next quote appears on line 200. Depending on the problem, the errors may seem random and unrelated to the initial cause.
Changelog
Version 1.7
Bugfix: Configuration changes weren't applied immediately in some cases
Version 1.6
Add support for per workspace settings
Version 1.5
Remove command-palette option in favor of the single Editor menu option which also shows up in the command palette.
Version 1.4
Return a promise when running perltidy to better integrate with onWillSave
Version 1.3
Support multiple perl syntax in Nova
Version 1.2
Bugfix: use onDidAddTextEditor
Version 1.1
Bugfix: format on save option not always being read on startup
Version 1.0
Initial release
License
MIT License
Copyright (c) 2023 isla w
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.