Back to Home

Perl5 plugin for IntelliJ IDEA

Perl · Perl5 · intellij idea · ide

Perl5 plugin for IntelliJ IDEA

Today came the first version of the plugin for IntelliJ IDEA - Camelcade. The plugin adds Perl5 support to this marvelous IDE. The plugin is free and open source. Currently works at IntelliJ IDEA and JetBrains specialized IDEs.

image

For more information about the plugin, see the cat.


Background


I am a programmer with a long experience and diverse experience. I have been writing in Perl5 for a very long time and until recently I wrote in NP ++ (it's hard to believe). At some point, I wanted more, but nothing was suitable. Samples of what is showed that everything is bad:
  • Sublime is just NP ++ with an autocomplete.
  • Eclipse + EPIC - persistent bugs with launch, or installation. I personally got more problems than benefits.
  • Padre is a great undertaking, but abandoned and just as unstable. Departures, freezes associated with the UI part of wxWidgets.
  • Komodo is the best of all. But, the feeling that the Perl5 direction is not developing and what is, pretty quickly ceased to satisfy. Appetite came with eating.
  • Vim - sorry, not mine. Windows child and all that.

In addition to good support for Perl5, I wanted to be able to expand the functionality, because you have to work with projects running on custom engines with custom template engines (and yes, you can probably do this in Vim).

For some time I worked on tasks in Python and, accordingly, in PyCharm. It was just perfect. The best IDE I've seen. Hence the decision to try to write a plugin to support Perl5. I didn’t know Java at all ...

... there may be a detailed essay on the subject - “How it was”, which I could state if it would be interesting ...

Total


The first version of the plugin provides the following features:
  • Creating a Perl5 Module and Choosing a Perl5 Interpreter
  • Parsing Perl5 (without source filters), POD, Mojolicious templates and Embedded Perl (It's like php with only Perl5 inside)
  • Syntax highlighting
  • Highlighting and padding brackets, quotes, delimiters for regular expressions.
  • Interpolation of strings, here-docs and regular expressions
  • Auto-complete for functions, methods, packages, constants and variables
  • Transition for functions, variables, classes and constants (Go to symbol / class)
  • View file structure and class hierarchy (Structure view / Hierarchy view)
  • Inheritance support with DFS / C3
  • Support for importing functions and variables
  • Navigation and refactoring for functions, constants, globes, packages, namespaces, lexical and global variables
  • Allow AUTOLOADed Methods
  • File templates for scripts, packages, and Mojolicious templates
  • Templates (Live templates) for compound constructions (eat extra brackets, Komodo)
  • Support for declaring global variables through use vars
  • Token refactoring for here-doc
  • IntelliLang support for here-doc and automatic injection of another language depending on marker text
  • Annotations for functions: # @ deprecated, # @ method, # @ returns (the latter is necessary for the correct resolution of the return value type)
  • Abstract for namespace: # @ deprecated
  • Declaring variable typing support
  • Intentions: string conversion to here-doc
  • Inspections:
    • Packages: missing package file, unknown namespace, multiple namespace declaration, intersection with core namespace, missing strict / warnings.
    • Functions: deprecated, unknown function, multiple definitions, fashion call (new Foo :: Bar), unused functions / constants / globs.
    • Variables: unused variables, undefined variables, variable shading, declaration of an embedded variable as lexical or global.
  • Extension point for implementing package processors. Allows you to describe the functionality of custom modules. For example, Mojo :: Base, which is both strict, and warnings, and base, and feature.

Everything is not perfect and will most likely be finished. The minimum necessary for work has been made. More details can be found on the project wiki: github.com/hurricup/Perl5-IDEA/wiki

Acknowledgments


  • JetBrains for a wonderful IDE and no less wonderful development platform. It was a very interesting adventure.
  • JetBrains employees and especially Peter Gromov for help and tips on the forum, which are so necessary at the start.
  • Habra-user VISTALL for valuable advice and code review.
  • To the creator of Erlang plugin, which was often used as a sample.
  • To everyone who sent their feedbacks and feature requests.

Plans


Here you can write a lot of things, because for each realized feature two new ideas were born. All moves are recorded, but the future fate of the plugin will depend on a lot of different factors. Conceptually planned:

  • Improving the parser (especially error-recovery).
  • Improvement of already implemented functionality.
  • Performance optimization
  • Writing tests.
  • Integration with well-known Perl5 frameworks and template engines.
  • Integration with PerlBrew.
  • Integration with libraries like PerlTidy, PerlCritic, CPAN.
  • Debugger.
  • Perl6. I was going to start with him in connection with the presence of formalized grammar. But there were arguments against: I do not know the language at all, it has not yet come out (albeit just about), its performance at the moment leaves much to be desired. But why not?

References


Read Next