Re: Creating Perl5 plugin for Intellij IDEA (criterias ?)
by LanX (Saint) on Apr 19, 2015 at 19:10 UTC
|
> From my own experience, the most powerful and convenient IDEs are Microsoft VS and Intellij IDEA
Could you please elaborate why? I'd be curious to learn more.
See also What are the criterias of a "good" Perl IDE?
From my experience do both Komodo-IDE and Emacs excel on each point listed.
Emacs has far more flexibility, but it's harder to customize. (it's more an IDE construction set)
BTW: Komodo-Edit used to be free.
| [reply] |
|
|
Well i could elaborate in details, but need some inspiration.
For short, in Komodo 8 autocompletion for defined variables doesn't work, jump to definistion by click works from time to time.
| [reply] |
|
|
> but need some inspiration.
The thread I linked was meant as such. :)
> Komodo 8 autocompletion for defined variables doesn't work, jump to definistion by click works from time to time.
That's surprising but possible. Unfortunately I can't test ATM, my Komodo installation is supposed to be ready in a week.¹
Anyway I hope you are aware about the limitations to parse Perl statically.
If "autocompletion for defined variables" means completing a global variable from a used module, that ain't easy to tell (i.e. which module is used somewhere). Even more for "jump to definistion by click".
At least I can tell from the corresponding features in Emacs.
So please don't expect just adding highlighting will make Perl as easy to analyze as static languages are.
¹) My emacs was up and running my working environment after a day, even without internet access ;)
| [reply] |
Re: Creating Perl5 plugin for Intellij IDEA
by Anonymous Monk on Apr 20, 2015 at 00:14 UTC
|
| [reply] |
|
|
Thank you very much! I heard about it but never seen :)
Will check sources for some ideas
| [reply] |
Re: Creating Perl5 plugin for Intellij IDEA
by SimonPratt (Friar) on Apr 20, 2015 at 10:03 UTC
|
A few of us here are using Sublime Text 2. With the ModernPerl plugin, it is excellent (though it doesn't have quite the same level of code completion or error highlighting as VS). | [reply] |
|
|
| [reply] |
|
|
Actually, having another look around the 'net, ran into Padre, a Perl IDE written in Perl. Screenshots look alright, but haven't tried it out yet.
| [reply] |
Re: Creating Perl5 plugin for Intellij IDEA
by Laurent_R (Canon) on Apr 20, 2015 at 06:35 UTC
|
Hm, Notepad ++, Ultra-edit and Crimson, just to name a few editors under Windows, have good Perl syntax support.
Otherwise, for a full IDE, you might want to take a look at Eclipse (with the Perl plug-in).
| [reply] |
|
|
| [reply] |
|
|
I am currently using the EPIC (version 0.7) plug-in with Eclipse Luna CDT. Regarding functionality, my only issue (so far) with it is that "our" variables are not included in the "Outline view". Also, there are some places, especially the debugger, where EPIC's integration with Eclipse is "klugy". Otherwise, it's been working decently for me.
| [reply] |
Re: Creating Perl5 plugin for Intellij IDEA
by MidLifeXis (Monsignor) on Apr 20, 2015 at 14:06 UTC
|
If you aren't afraid of lisp, you could check out Emacs' cperl-mode and perl-mode modules. Also see flymake as a way to use perl to do the heavy lifting for you.
Since "only perl can parse Perl", best attempts and using perl as a back-end for your parser somehow are probably as close as you are going to get.
| [reply] [d/l] [select] |
Re: Creating Perl5 plugin for Intellij IDEA
by mr_mischief (Monsignor) on Apr 20, 2015 at 20:11 UTC
|
I think there's an issue with your statement about there being no vim for Windows. Namely, that it is available right on vim.org for anyone to download and install. There's an alternate source at https://bitbucket.org/Haroogan/vim-for-windows too. See also http://gvim.en.softonic.com/, portable gvim, and the download page for Cream which is vim plus some bonus niceties.
There are also several ways to run Emacs on Windows.
Elvis is another vi clone available on the Mac, Windows, DOS, and OS/2 as well. jVi runs anywhere you have a JVM and NetBeans. vile has a Windows version.
I imagine Zee (simple editor), Zemacs (an Emacs), and Zi (a vi) would run on Windows if you squared away your Lua installation on that platform to support Zile.
As for other non-vi, non-emacs free (libre and gratis) text editors and IDEs, the granddaddy of them all appears to be Eclipse. There are lots of things out there, though, that run on Windows as well as other platforms.:
-
jEdit runs on Java on Windows as well as it does on Java on other platforms.
- Atom is neat and appears to be gaining popularity. It can import TextMate grammars and themes in case you have any investment in TM.
- Bluefish runs on Windows and several other OSes.
- Komodo Edit is the libre and gratis editor component of the fuller-featured Komodo IDE.
- The KDE on Windows folks will let you install Kate and its prerequisites (or more of the KDE tools, too if you want) on Windows.
- fte runs on multiple platforms, including Windows.
- MinEd has a pre-packaged Windows version, too.
- JED comes ready to be configured for a number of popular key binding sets from other editors. Happily, it's reported to run on Windows without Cygwin. Sadly, I don't seem to be able to find a prebuilt package.
If you have Msys Git, MSys (another page on how install MSYS tools) or GNU tools for Windows there's a decent chance of getting your Linux/Unix console text editor of choice to run fine. With Cygwin there's a very good chance most Linux/Unix console text editors would work fine without much work.
There are non-free (not libre, not gratis) options like UltraEdit and TextPad.
| [reply] |
|
|
| [reply] |
|
|
| [reply] |
|
|
|
|
Re: Creating Perl5 plugin for Intellij IDEA
by RonW (Parson) on Apr 20, 2015 at 18:23 UTC
|
The Scintilla editing widget has decent syntax highlighting for Perl and is used by several editors and IDEs. It is open source, so you could try "mining" it for Perl parsing logic. | [reply] |
Re: Creating Perl5 plugin for Intellij IDEA (Camelcade)
by hurricup (Pilgrim) on May 21, 2015 at 14:45 UTC
|
Those, who interested, may try first beta version. Jar plugin may be found in repo: https://github.com/hurricup/Perl5-IDEA.
Feedbacks, suggestions and bugreports are welcome.
And now I'm even more sure that IDEA is real piece of art.
| [reply] |
Camelcade 0.30 beta release
by hurricup (Pilgrim) on Jul 13, 2015 at 19:18 UTC
|
Beta 0.30 released:
- Re-wrote lexer and heavily refactored parser
- Fixed bug with hanging on Embedded perl files
- Added support for archaic package name delimiters, Foo'Bar is now valid (NB: refactoring/find usages not working on them yet)
- Added perl script file detection by shebang line
- Added variables attributes parsing
- Added formats parsing
- Added wiki pages in the repo
Want to say BIG THANKS to all Monks who answered my sometimes stupid questions. I couldn't do it without you!
| [reply] |
Re: Creating Perl5 plugin for Intellij IDEA
by hurricup (Pilgrim) on Apr 25, 2015 at 14:39 UTC
|
A little update:
- I've created basic lexer with JFlex
- I've created basic bnf-like file which allows to generate parser with Grammar-Kit. It allows different injections, so i think it would be enough to handle perl.
- I've implemented few built-ins tree building: package, sub, use and require
- I've created annotator, which allows to show a error message with proper syntax hint.
- Here is a screenshot.
- Also, i've created basic lexer and parser for POD format and it looks like this.
- I've named the project: Camelcade :)
| [reply] |
Perl nuances: unnamed variable
by hurricup (Pilgrim) on May 24, 2015 at 11:04 UTC
|
Hello. Got an interesting question: what is $:: variable?
According to perldata there is no such special variable. According to perl variable syntax it's unnamed variable from main package. But if I dump %main:: - it's not there. But it's somewhere, because i can store and retrive data from it.
Read wonderful article about symbol tables but it didn't helped.
So, what is this thing?
And one more question: how several double-colon in a row being treated? Like $::::somevar ?
| [reply] |
|
|
Special variables reserve all slots for their stash symbol i.e. all sigils are globally usable even if only %main:: is meaningful. ( %:: is only the abbreviation)
Compare @a (better @| ) or %0 ¹
(yes its a design flaw)
Btw please start a new thread instead of just changing the title.
edit (7 min)
oops seems like they fixed it for @a
use warnings;
use strict;
%0 = (a=>1);
@| = (1..3);
# @a =(1..3); # 'requires explicit package name' if uncommented
update
see also Scalar followed by parenthetical... and Why did @$ variable bite me in the ass?
And here the reason why @a works as expected
from perlvar:
Perl identifiers that begin with digits, control characters, or punctu
+ation characters are exempt from the effects of the package declarati
+on and are always forced to be in package main ; they are also exempt
+ from strict 'vars' errors. A few other names are also exempt in thes
+e ways:
ENV STDIN
INC STDOUT
ARGV STDERR
ARGVOUT
SIG
| [reply] [d/l] [select] |
Perl power: where to draw the line?
by hurricup (Pilgrim) on Apr 25, 2015 at 15:35 UTC
|
Perl allows us to do crazy things. And i'm not sure that they all should be implemented in IDE, well, at least most people don't use them. For example, quote-like operations:
use 5.10.0;
say q#7asdf#;
say q{6asdf};
say q/5asdf/;
say q(4asdf);
say q<3asdf>;
say q?2asdf?;
say q _aasdfa_;
#say q aasdfa;
say q basdfb;
say q casdfc;
#say q dasdfd;
say q easdfe;
#say q fasdff;
say q g1asdfg;
say q hasdfh;
say q iasdfi;
say q jasdfj;
say q kasdfk;
say q lasdfl;
say q masdfm;
say q nasdfn;
say q oasdfo;
say q pasdfp;
say q qasdfq;
say q rasdfr;
#say q sasdfs;
say q tasdft;
say q uasdfu;
say q vasdfv;
say q wasdfw;
say q xasdfx;
say q yasdfy;
say q zasdfz;
my $a = q ksadfk;
$a =~ m leasdfl;
$a =~ s lasdflfdasl;
All uncommented lines are valid. Of course, they are interesting to write some unreadable code, but you don't need IDE for that.
Where is the line of required minimum? And i'm not talking only about this example.
And by the way, if anyone knows, why 'a', 'd', 'f' and 's' are so special? | [reply] [d/l] |
|
|
c:\@Work\Perl\monks>perl -wMstrict -lE
"say q abcda;
say q defgd;
say q fghif;
say q stuvs;
"
bcd
efg
ghi
tuv
Give a man a fish: <%-(-(-(-<
| [reply] [d/l] [select] |
|
|
oh. Don't post in evening. Obvious. Thanks :)
| [reply] |
Learning perl, after years...
by hurricup (Pilgrim) on May 03, 2015 at 16:42 UTC
|
It's really awesome that perl still has a lot to teach after years of programming experience :)
Encountered a code, which i can't interpret (so as my parser). This is a part of PPI::Lexer. We've got an array:
@CURLY_LOOKAHEAD_CLASSES = (
{}, # not used
{
';' => 'PPI::Structure::Block', # per perlref
'}' => 'PPI::Structure::Constructor',
},
{
'=>' => 'PPI::Structure::Constructor',
},
);
And somewhere else we have such code:
elsif ( my $class = $CURLY_LOOKAHEAD_CLASSES[$position]
{$Next->content} )
How does it work? We are assigning list element to the class and what is $Next block?
Thanks in advance
| [reply] [d/l] [select] |
|
|
You seem to be paying way too much attention to the line break.
$position is either 1 or 2. $Next->content() is expected to return ';' or '}' when $position is 1 and to return '=>' when $position is 2.
The code is a rather simple array look-up followed by a hash look-up:
my $class = $CURLY_LOOKAHEAD_CLASSES[$position]->{ $Next->content() };
| [reply] [d/l] [select] |
|
|
| [reply] [d/l] [select] |
Recursive inclusions parsing
by hurricup (Pilgrim) on May 13, 2015 at 12:29 UTC
|
Perl's parsing depends on previously parsed data. Like bareword may be a function if it was declared or defined before with prototype
But, how it works if we are parsing file, that uses package A, which requires package C, which requires package A?
In such situation, we need to parse one of the packages without definistions/declarations data from another package.
Does anyone knows how it really works?
| [reply] |
|
|
But, how it works if we are parsing file, that uses package A, which requires package C, which requires package A? Does anyone knows how it really works? Most of the time it doesn't work and the poor programmer asks for help :) at which point hes told to stop that :)
See Exporter behavior / Re: Exporter behavior
| [reply] |
Re: Creating Perl5 plugin for Intellij IDEA (Camelcade)
by hurricup (Pilgrim) on Aug 14, 2015 at 08:08 UTC
|
It's so sweet to read this now... 4 months after... | [reply] |