Lazarus

Announcements => Third party => Topic started by: argb32 on August 31, 2013, 09:18:52 pm

Title: IntelliJ IDEA + Pascal
Post by: argb32 on August 31, 2013, 09:18:52 pm
There is a brilliant IDE for Java - Intellij IDEA.
Actually it's a platform which can be used to develop IDE for any language.
PyCharm, RubyMine, WebStorm, PHPStorm and others are based on the platform.
Many languages are supported via plugins but Pascal. :o
So I decided to change this situatuion. :D

Site with description and screenshots:
http://www.siberika.com/pasidea.htm

The plugin requires Community Edition of IDEA 12.хх (and probably 13.xx) which is available for free download here:
http://www.jetbrains.com/idea/download/index.html

Currently implemented:

How to install
1. Choose in menu File->Settings, than Plugins
2. Click "Browse repositories"
3. Search for "Pascal IDEA plugin"
4. Right click on the plugin and choose "Download and Install"

Please note that external build option should be turned off here:
File->Settings->Compiler

Project creation and setup
In IDEA a project consists of modules. An IDEA module corresponding to a project in Lazarus or Delphi.
The plugin adds a new module type - Pascal module.

To use a Free Pascal compiler a so called SDK should be added to IDE. This can be done at a project creation time:
1. Choose in menu File->New project
2. Select "Pascal Module" to create a module
3. Click "New" to the right of "Project SDK"
4. Choose a directory where FPC installed

To get in Pascal SDK settings:
1. Choose in menu File->Project Structure
2. Select SDKs
3. Select desired SDK
Not much to setup yet.

For a module, a main file should be specified. This is the file which be compiled and runned:
1. Choose in menu File->Project Structure
2. Select Modules
3. Select desired module
4. Select main file on "Settings" tab
On "Sources" tab a library path can be specified.

Compile and run
To compile a file just select "Compile..." from a context menu (appears on right-click)
To run an application a Run configuration of type "FPC executable" should be created first (once):
1. Choose in menu Run->Run...
2. Select "Edit configurations..."
3. Click "+"
4. Select "FPC executable"
5. Click "Run" to run the application

Any feedback, suggestions questions are highly appreciated!
Title: Re: IntelliJ IDEA + Pascal
Post by: BigChimp on August 31, 2013, 10:37:19 pm
Wow - that must have been a lot of work! Thanks for posting this... though I think I'll stick with Lazarus for now ;) (I'm not using IDEA at the moment).
Title: Re: IntelliJ IDEA + Pascal
Post by: kodok.buncit on August 31, 2013, 10:48:49 pm
great work sir!
how about package mangement like *.lpk on lazarus?
Title: Re: IntelliJ IDEA + Pascal
Post by: Deepaak on September 01, 2013, 05:20:21 am
good news  :) but i will continue with lazarus.   O:-)
Title: Re: IntelliJ IDEA + Pascal
Post by: Leledumbo on September 01, 2013, 05:51:17 am
good work, but using Java based IDE will never be my option. No matter how lightweight people say, it will still be heavier than native application. Just tried this plugin with fresh IntelliJ IDEA, eats ~300 MB (just started, no files open). Lazarus eats 59 + 30 (for startlazarus) MB, with a bunch of packages installed including easy docking.
Title: Re: IntelliJ IDEA + Pascal
Post by: Deepaak on September 01, 2013, 06:54:52 am
good work, but using Java based IDE will never be my option. No matter how lightweight people say, it will still be heavier than native application.

Agree with you.
Title: Re: IntelliJ IDEA + Pascal
Post by: avra on September 01, 2013, 10:47:07 am
Nice job. You really like the IDE since this has been a lot of work. If community edition includes Android GUI designer, and it comes as a download bundled with FPC JVM (http://wiki.freepascal.org/FPC_JVM) and ready to produce Java/Android code out of the box (even if it means to pack it all into a Linux VM), then that might be enough for many people to try something new. Otherwise, most will stick with Lazarus.
Title: Re: IntelliJ IDEA + Pascal
Post by: nsunny on September 01, 2013, 12:07:01 pm
Nice job. You really like the IDE since this has been a lot of work. If community edition includes Android GUI designer, and it comes as a download bundled with FPC JVM (http://wiki.freepascal.org/FPC_JVM) and ready to produce Java/Android code out of the box (even if it means to pack it all into a Linux VM), then that might be enough for many people to try something new. Otherwise, most will stick with Lazarus.
Agree. I would also like this. Java based IDE for FPC seems not a good idea. But if the plugin can be improved to use IDEA as a GUI designer for Android apps then it would be a cool thing!
Title: Re: IntelliJ IDEA + Pascal
Post by: argb32 on September 01, 2013, 01:21:29 pm
"stick with Lazarus" is not an option because the plugin is not intended to replace Lazarus.
The main goal is to create a modern IDE for creating, analyzing and refactoring Pascal code using many man-years already invested in IDEA.
There is no plans to add any kind of form designers. The one in Lazarus is good enough in think.

Concerning memory consumption - JVM takes memory from OS on start and than manages it by itself.
The actual amount of memory consumed by IDEA is displayed at the right bottom. For me it is about 150MB for Pascal plugin project which includes IDEA community edition code (huge amount of code!). I only turned off unused plugins. 2% of memory on my computer. Not so bad I think. I can live with it.;)

What the memory is used for?
You can view some videos about it.
http://www.youtube.com/watch?v=XM-wD2vKwtA
http://www.youtube.com/watch?v=ydimqmbS61I&list=SPA2323EDE3F4FFE21
Anyway, it's hard to understand how IDE can improve productivity without using it for some time.

The new official Android IDE from Google is also based on IDEA (previously it was based on Eclipse):
http://developer.android.com/sdk/installing/studio.html
Of course it offers fully-featured Android form designer.
I didn't test but the Pascal plugin should work with it too.
FPC for JVM support is in plans but main goal of the plugin is modern IDE for Pascal code.

kodok.buncit, I'm almost not familiar with Lazarus package system. What kind of support of it you'd like to see?
Title: Re: IntelliJ IDEA + Pascal
Post by: BigChimp on September 01, 2013, 01:41:26 pm
"stick with Lazarus" is not an option because the plugin is not intended to replace Lazarus.
Well, if you don't intend it as a replacement, I'm wondering what essential IntelliJ functionality you're missing in Lazarus. Perhaps it can be implemented in Lazarus ;)

There is no plans to add any kind of form designers. The one in Lazarus is good enough in think.
The new official Android IDE [...] offers fully-featured Android form designer.
I didn't test but the Pascal plugin should work with it too.
FPC for JVM support is in plans but main goal of the plugin is modern IDE for Pascal code.

Well.... I'd say that the Lazarus IDE itself is the natural IDE to use for Lazarus programs but to each his own. Together with other posters, I think that the possible benefits of IntelliJ FPC support would lie in Android development as you'd need interaction with Java code anyway, AFAIU.

Regardless, it's nice to see broader support for FPC development - thanks a lot!
Title: Re: IntelliJ IDEA + Pascal
Post by: argb32 on November 04, 2013, 01:55:46 pm
The plugin has been updated.
Latest additions:
Please note that external build option should be turned off here:
File->Settings->Compiler
Title: Re: IntelliJ IDEA + Pascal
Post by: esvignolo on November 04, 2013, 09:17:24 pm
thank you very much for your work, is very promising to me, and what is important in my opinion also, is to increase the number of developers using fpc in the world, intellij idea seems to be very good IDE, and programmers used to this ide in the world FPC will be able to enter the world in a simple way thanks to ARGB32.
Title: Re: IntelliJ IDEA + Pascal
Post by: argb32 on November 06, 2013, 08:16:58 pm
Thank you, esvignolo.
Now the plugin is in official Jetbrains plugin repository so any IDEA user can see that Pascal is supported.
And installation is simpler now.
Title: Re: IntelliJ IDEA + Pascal
Post by: Liquid on November 14, 2013, 09:27:55 pm
 :-\
except of me  :(

I'm not able to set up the SDK in IntelliJ 12 Ultimate. I'm on MAC OSX 10.7.5. I have fpc 2.6.2 installed.
By following the instructions I have to set the SDK, a finder open and now? I navigated to /usr/local/bin, /usr/local/lib and was looking in the Application Support Folder. But there is no folder or file I could choose.
What went wrong?

Greetings
Liquid   
Title: Re: IntelliJ IDEA + Pascal
Post by: Fred vS on November 15, 2013, 01:14:17 pm
Quote
By following the instructions I have to set the SDK, a finder open and now?

I have the same problem with Ubuntu... :-[
Title: Re: IntelliJ IDEA + Pascal
Post by: Graeme on November 20, 2013, 05:44:35 am
Fantastic contribution - well done!
Title: Re: IntelliJ IDEA + Pascal
Post by: argb32 on November 21, 2013, 03:27:32 pm
Liquid, Fred vS: You should choose the directory containing "bin" directory of FPC. As well as "units" directory where compiled RTL units are located.
Usally it's something like "/usr/share/fpc".
I have CodeTyphoon installed and the directory is "/usr/lib/codetyphon/fpc".
One of the directories above suggested by default during SDK setup. Depending on which one exists.
Title: Re: IntelliJ IDEA + Pascal
Post by: marcov on November 21, 2013, 04:02:24 pm
Any idea how you are going to tackle help?
Title: Re: IntelliJ IDEA + Pascal
Post by: argb32 on November 21, 2013, 04:27:55 pm
Any idea how you are going to tackle help?

Could you please restate? I'm not sure I understood this post correctly.
Title: Re: IntelliJ IDEA + Pascal
Post by: marcov on November 21, 2013, 04:44:51 pm
Any idea how you are going to tackle help?

Could you please restate? I'm not sure I understood this post correctly.

How do you think about providing Pascal context sensitive help in IntelliJ? Help on keywords, API functions etc? Can you reuse the CHMs that lazarus uses ?
Title: Re: IntelliJ IDEA + Pascal
Post by: argb32 on November 21, 2013, 06:16:09 pm
How do you think about providing Pascal context sensitive help in IntelliJ? Help on keywords, API functions etc? Can you reuse the CHMs that lazarus uses ?

I hadn't thought on this yet.
I definitely have no plans to convert any help to IDEA-compatible format.
From the other side, it's not a problem to bind a hotkey to some external call with any context from the editor.
For API functions a javadoc-style comments will be supported.
Title: Re: IntelliJ IDEA + Pascal
Post by: marcov on November 21, 2013, 08:03:53 pm
to bind a hotkey to some external call with any context from the editor.

Since LHelp is fairly self contained, that could work that way.

For API functions a javadoc-style comments will be supported.

That won't work with the main targets, the FPC/Lazarus codebases, since they practice out-of-source documentation principles
Title: Re: IntelliJ IDEA + Pascal
Post by: Fred vS on November 22, 2013, 01:16:37 pm
Quote
"You should choose the directory containing "bin" directory of FPC."

With classical install of Lazarus the "default" directory containing "binaries" of FPC (fpc, fpcmake, fpcres,...) is :
/usr/bin

Quote
"As well as "units" directory where compiled RTL units are located.
Usally it's something like "/usr/share/fpc""

With a clasical Lazarus install, RTL units are located in :

/usr/lib/fpc/$fpcversion/units/$fpctarget/

So i have created :

/usr/lib/fpc/$fpcversion/bin/

and copy into all fpc binaries from /usr/bin

Now i get that message :
Quote
"The selected directory is not a valid home for Free Pascal SDK"

 :-\
Title: Re: IntelliJ IDEA + Pascal
Post by: argb32 on November 22, 2013, 03:24:02 pm
With classical install of Lazarus the "default" directory containing "binaries" of FPC (fpc, fpcmake, fpcres,...) is :
/usr/bin

It looks like placing files in c:\windows\system32. :(
The better setup would be to place binaries in some directory, e.g. /usr/lib/fpc/$fpcversion/bin.
And create symlinks from /usr/bin if this is really needed.

/usr/lib/fpc/$fpcversion/units/$fpctarget/

So i have created :

/usr/lib/fpc/$fpcversion/bin/

and copy into all fpc binaries from /usr/bin

Now i get that message :
Quote
"The selected directory is not a valid home for Free Pascal SDK"

Did you selected the /usr/lib/fpc/$fpcversion directory? This one should work.
And even /usr should work.
Home directory validation only checks if $SDK_HOME/bin/fpc is an executable file.

May be there is a problem with file permissions. Is FPC executable permitted under user running IDEA?
Title: Re: IntelliJ IDEA + Pascal
Post by: marcov on November 22, 2013, 04:09:07 pm
Keep in mind that "fpc" is only a frontend binary. It will call the real ppc* ( ppc386,ppcx64 etc) compiler, after a search in the path.
Title: Re: IntelliJ IDEA + Pascal
Post by: Fred vS on November 22, 2013, 07:18:15 pm
Quote
It looks like placing files in c:\windows\system32. :(
The better setup would be to place binaries in some directory, e.g. /usr/lib/fpc/$fpcversion/bin.
And create symlinks from /usr/bin if this is really needed.

Hum, it is not me, chief, it is sudo dpkg -i fpc.deb and sudo dpkg -i fpc_src.deb who did all the work... :-X

Quote
Is FPC executable permitted under user running IDEA?

Did not understood, IDEA has his own  permitted users list ?  :-[
Title: Re: IntelliJ IDEA + Pascal
Post by: Fred vS on November 24, 2013, 12:35:28 am
Quote
I have CodeTyphoon installed and the directory is "/usr/lib/codetyphon/fpc".

OK, i have install last version of CodeTyphoon and everything is working now.

(But it could be great if we can use fpc 2.6.2 too, it seems that only fpc 2.7.1. is accepted... :-[ )

I gonna try to load one of my Lazarus project to test it...


PS : Could it be possible that you give a source-project-Idea-FPC example ( a simple one, like a Hello World ) ?

Many thanks for that super project..
Title: Re: IntelliJ IDEA + Pascal
Post by: argb32 on November 25, 2013, 03:01:15 pm
FPC 2.6.x should work and even earlier ones.
Quote
Could it be possible that you give a source-project-Idea-FPC example
There is no any specific project-like entities. Any .pas (.pp, .lpr) single file can be compiled and ran.
RTL library path is not saved in IDEA project file (.iml) as it's a SDK's setting.
If compiler can't find RTL units the path wasn't added automatically and should be added manually.
Menu File->Project structure->SDKs
Than select a FPC SDK and in source path tab add directory where FPC RTL is located (/usr/lib/codetyphon/fpc/units/<target>)
Title: Re: IntelliJ IDEA + Pascal
Post by: Fred vS on November 25, 2013, 03:22:31 pm
Quote
Than select a FPC SDK and in source path tab add directory where FPC RTL is located (/usr/lib/codetyphon/fpc/units/<target>)

Ok, thanks.

Hum, it seems that your pluggin is working only for fpc-console code.
So, if i want to compile a Lazarus app, i have to add the /lcl and /pluggin dir from Lazarus ?  :-[

If i do so, it works but, because it add also sub-directories, it take much more time to index all.

Is there a way to configure your pluggin to do it work for code using lcl (Lazarus) ?
Title: Re: IntelliJ IDEA + Pascal
Post by: argb32 on November 27, 2013, 01:25:49 pm
Quote
If i do so, it works but, because it add also sub-directories, it take much more time to index all.

Are you talking about directories with source code?
You can add directories containing compiled code (.ppu) which not indexed.
Is indexing problematic? It should process only once.
Title: Re: IntelliJ IDEA + Pascal
Post by: argb32 on December 22, 2013, 08:02:47 pm
New version released with .ppu files interface view ability.
The ppudump utility is used which comes with FPC.
ppudump should be version 2.7.1 or higher.
Title: Re: IntelliJ IDEA + Pascal
Post by: JD on December 30, 2013, 12:38:17 am
@argb32

Hats off to you. Looks like a lot of work. Great!
Title: Re: IntelliJ IDEA + Pascal
Post by: cit on September 23, 2014, 03:19:24 pm
I'm trying to make it work on IDEA 13 (Mac OS X). Unfortunately, it silently closes SDK selection dialog on any imaginable path suggested.

Title: Re: IntelliJ IDEA + Pascal
Post by: cit on September 23, 2014, 07:02:42 pm
I'm trying to make it work on IDEA 13 (Mac OS X). Unfortunately, it silently closes SDK selection dialog on any imaginable path suggested.

With some quirks (manually editing jdk.table.xml) I've managed plugin to recognize SDK, but compilation doesn't work in a strange way:


2014-09-23 20:37:47,382 [  29496]   INFO - ij.compiler.impl.CompileDriver - COMPILATION STARTED
2014-09-23 20:37:47,587 [  29701]  ERROR - i.compiler.TranslatingCompiler - Cannot run program "/usr/local/lib/fpc/2.6.4/bin": error=13, Permission denied
java.io.IOException: Cannot run program "/usr/local/lib/fpc/2.6.4/bin": error=13, Permission denied
   at java.lang.ProcessBuilder.processException(ProcessBuilder.java:478)
   at java.lang.ProcessBuilder.start(ProcessBuilder.java:457)
   at java.lang.Runtime.exec(Runtime.java:593)
   at java.lang.Runtime.exec(Runtime.java:466)
   at com.intellij.compiler.impl.javaCompiler.ExternalCompiler.launchProcess(ExternalCompiler.java:81)
   at com.siberika.idea.pascal.compiler.PasFPCCompiler.compileNative(PasFPCCompiler.java:107)
   at com.siberika.idea.pascal.compiler.PasFPCCompiler.compile(PasFPCCompiler.java:54)
   at com.intellij.compiler.impl.CompileDriver.compileSources(CompileDriver.java:2051)
   at com.intellij.compiler.impl.CompileDriver.translate(CompileDriver.java:1374)
   at com.intellij.compiler.impl.CompileDriver.doCompile(CompileDriver.java:1080)
   at com.intellij.compiler.impl.CompileDriver.doCompile(CompileDriver.java:806)
   at com.intellij.compiler.impl.CompileDriver.access$1100(CompileDriver.java:111)
   at com.intellij.compiler.impl.CompileDriver$9.run(CompileDriver.java:754)
   at com.intellij.compiler.progress.CompilerTask.run(CompilerTask.java:167)
   at com.intellij.openapi.progress.impl.ProgressManagerImpl$TaskRunnable.run(ProgressManagerImpl.java:495)
   at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:185)
   at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:226)
   at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:175)
   at com.intellij.openapi.progress.impl.ProgressManagerImpl$8.run(ProgressManagerImpl.java:400)
   at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:454)
   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
   at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
   at java.util.concurrent.FutureTask.run(FutureTask.java:138)
   at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
   at java.lang.Thread.run(Thread.java:695)
   at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:152)
Caused by: java.io.IOException: error=13, Permission denied
   at java.lang.UNIXProcess.forkAndExec(Native Method)
   at java.lang.UNIXProcess.<init>(UNIXProcess.java:53)
   at java.lang.ProcessImpl.start(ProcessImpl.java:91)
   at java.lang.ProcessBuilder.start(ProcessBuilder.java:452)
   ... 25 more


It seems that last part of the compiler path has been lost somehow ...

Please, help.
Title: Re: IntelliJ IDEA + Pascal
Post by: argb32 on October 05, 2014, 01:43:14 am
In 13th IDEA compiler API was completely changed so I had to rewrite this part.
Now it's working (though I didn't test on Mac ever) and SDK detection was improved too.
I hope to find the time and release new version soon.
Title: Re: IntelliJ IDEA + Pascal
Post by: allanregistos on October 15, 2014, 08:13:24 am
In 13th IDEA compiler API was completely changed so I had to rewrite this part.
Now it's working (though I didn't test on Mac ever) and SDK detection was improved too.
I hope to find the time and release new version soon.
Hi argb32,
It seems it still doesn't recognize the /usr/lib/fpc/$fpc_ver directory, and therefore not usable. While you are at it, do you have fix or workarounds? The IDE was run as the same user would run lazarus/fpc, so file permission should not be a suspect.
(Ubuntu 14.04 64-bit fpc 2.6.4)
See screenshot.

Title: Re: IntelliJ IDEA + Pascal
Post by: argb32 on October 16, 2014, 11:28:25 pm
It seems it still doesn't recognize the /usr/lib/fpc/$fpc_ver directory, and therefore not usable. While you are at it, do you have fix or workarounds? The IDE was run as the same user would run lazarus/fpc, so file permission should not be a suspect.
(Ubuntu 14.04 64-bit fpc 2.6.4)
See screenshot.

The only workaround with existing version I'm aware of is to use FPC coming with CodeTyphoon. It has compatible SDK layout.
The new version I'm finishing now is compatible with standard FPC layout.
Title: Re: IntelliJ IDEA + Pascal
Post by: argb32 on March 23, 2015, 11:41:33 pm
Didn't update the thread for a while.
The current version (http://www.siberika.com/download/IdeaPas.zip) of the plugin got the following:

FPC path layout on OSX is also supported and tested (thank to people concerned).
Title: Re: IntelliJ IDEA + Pascal
Post by: aradeonas on March 24, 2015, 01:13:39 am
Thanks!
@argb32 I want to ask what are the usages of this plugin?
I can imagine if it used for FPC Android development like Java AS it can be great,But what other usages?
Title: Re: IntelliJ IDEA + Pascal
Post by: cit on March 24, 2015, 10:06:10 pm
@argb32 Thanks a lot for your work!

Unfortunately, there are still some issues with Mac OS X and fpc 2.6.4:

- SDK dir is not recognized, until the fpc symlink created in /usr/local/lib/fpc/2.6.4 (freshly installed fpc contains only ppc* execs there) - easily fixed
- basic types (integer, char, ...) underlined as errors (attached)
- invoking compiler fails with EAccessViolation, though proposed command line pasted in terminal works fine:

Quote
Information:FPC: Map: /Users/cit/Projects/pascal-test/src/helloworld.pas => /Users/cit/Projects/pascal-test/out/production/pascal-test/helloworld.ppu
Information:FPC: Compiler command:  /usr/local/lib/fpc/2.6.4/fpc  -viewnb -FE/Users/cit/Projects/pascal-test/out/production/pascal-test -Fu/Users/cit/Projects/pascal-test/src -Fi/Users/cit/Projects/pascal-test/src -Fu/usr/local/lib/fpc/2.6.4/units/i386-darwin/pthreads -Fi/usr/local/lib/fpc/2.6.4/units/i386-darwin/pthreads -Fu/usr/local/lib/fpc/2.6.4/units/i386-darwin/regexpr -Fi/usr/local/lib/fpc/2.6.4/units/i386-darwin/regexpr -Fu/usr/local/lib/fpc/2.6.4/units/i386-darwin/x11 -Fi/usr/local/lib/fpc/2.6.4/units/i386-darwin/x11 -Fu/usr/local/lib/fpc/2.6.4/units/i386-darwin/rtl -Fi/usr/local/lib/fpc/2.6.4/units/i386-darwin/rtl /Users/cit/Projects/pascal-test/src/helloworld.pas (Module: pascal-test)
Information:FPC: Command line:
Information:FPC: /usr/local/lib/fpc/2.6.4/fpc
Information:FPC:
Information:FPC: -viewnb
Information:FPC: -FE/Users/cit/Projects/pascal-test/out/production/pascal-test
Information:FPC: -Fu/Users/cit/Projects/pascal-test/src
Information:FPC: -Fi/Users/cit/Projects/pascal-test/src
Information:FPC: -Fu/usr/local/lib/fpc/2.6.4/units/i386-darwin/pthreads
Information:FPC: -Fi/usr/local/lib/fpc/2.6.4/units/i386-darwin/pthreads
Information:FPC: -Fu/usr/local/lib/fpc/2.6.4/units/i386-darwin/regexpr
Information:FPC: -Fi/usr/local/lib/fpc/2.6.4/units/i386-darwin/regexpr
Information:FPC: -Fu/usr/local/lib/fpc/2.6.4/units/i386-darwin/x11
Information:FPC: -Fi/usr/local/lib/fpc/2.6.4/units/i386-darwin/x11
Information:FPC: -Fu/usr/local/lib/fpc/2.6.4/units/i386-darwin/rtl
Information:FPC: -Fi/usr/local/lib/fpc/2.6.4/units/i386-darwin/rtl
Information:FPC: /Users/cit/Projects/pascal-test/src/helloworld.pas
Information:FPC: An unhandled exception occurred at $000CA390 :
Information:FPC: EAccessViolation : Access violation
Information:FPC: $000CA390
Information:FPC: $000CB696
Information:FPC: $000329B3
Information:25.03.15 0:39 - Compilation completed with 2 errors and 0 warnings in 1s 845ms
Error:FPC: Compilation aborted
Error:FPC: Error. Compiler exit code: 217

In terminal:
Quote
cit@WinterPro:~/Projects/pascal-test$ /usr/local/lib/fpc/2.6.4/fpc  -viewnb -B -FE/Users/cit/Projects/pascal-test/out/production/pascal-test -Fu/Users/cit/Projects/pascal-test/src -Fi/Users/cit/Projects/pascal-test/src -Fu/usr/local/lib/fpc/2.6.4/units/i386-darwin/pthreads -Fi/usr/local/lib/fpc/2.6.4/units/i386-darwin/pthreads -Fu/usr/local/lib/fpc/2.6.4/units/i386-darwin/regexpr -Fi/usr/local/lib/fpc/2.6.4/units/i386-darwin/regexpr -Fu/usr/local/lib/fpc/2.6.4/units/i386-darwin/x11 -Fi/usr/local/lib/fpc/2.6.4/units/i386-darwin/x11 -Fu/usr/local/lib/fpc/2.6.4/units/i386-darwin/rtl -Fi/usr/local/lib/fpc/2.6.4/units/i386-darwin/rtl /Users/cit/Projects/pascal-test/src/helloworld.pas
Free Pascal Compiler version 2.6.4 [2014/02/26] for i386
Copyright (c) 1993-2014 by Florian Klaempfl and others
Target OS: Darwin for i386
Compiling /Users/cit/Projects/pascal-test/src/helloworld.pas
Assembling (pipe) /Users/cit/Projects/pascal-test/out/production/pascal-test/helloworld.s
Linking /Users/cit/Projects/pascal-test/out/production/pascal-test/helloworld
19 lines compiled, 0.1 sec

Title: Re: IntelliJ IDEA + Pascal
Post by: argb32 on March 24, 2015, 11:08:15 pm
cit:
The file /usr/local/bin/fpc should be used as compiler executable if it can't be found in $SDKHOME/bin. Does it exists? No symlink should be needed.

Most basic types are declared in system.ppu. FPC 2.6.4 doesn't has ppudump with XML output capability therefore system.ppu can't be parsed. The only way to fix this is to use newer FPC version.

As of EAccessViolation - I encountered it myself. Some version of FPC can't handle empty parameters. It's was fixed in newer FPC versions. As a workaround (besides switching to newer FPC version) you can set something in "additional compiler options" field in SDK settings. E.g. "-O3".

aradeonas:
The usage of the plugin is to effectively write and analyze code. It's ideal for cases when no GUI design needed - game development or server programming. But even for GUI applications the plugin can be used to write code.
After programming in such IDEs as Eclipse and especially IDEA I'm not satisfied with usability of existing Pascal IDE's in writing code anymore. It's hard to explain to someone who didn't try IDEA (I didn't believe it myself :) ). May be some video demos can explain better.
Title: Re: IntelliJ IDEA + Pascal
Post by: aradeonas on March 24, 2015, 11:10:52 pm
I can understand what you say.
Do have any plan to make it a Android development IDE?
Title: Re: IntelliJ IDEA + Pascal
Post by: cit on March 25, 2015, 08:58:05 pm
The file /usr/local/bin/fpc should be used as compiler executable if it can't be found in $SDKHOME/bin. Does it exists? No symlink should be needed.

cit@citusb:~/Projects/pascal-test$ file /usr/local/bin/fpc
/usr/local/bin/fpc: Mach-O i386 executable

Checked again - plugin refuses SDK path without fpc

Most basic types are declared in system.ppu. FPC 2.6.4 doesn't has ppudump with XML output capability therefore system.ppu can't be parsed. The only way to fix this is to use newer FPC version.

Ok, will try to build from sources.  :(

As of EAccessViolation - I encountered it myself. Some version of FPC can't handle empty parameters. It's was fixed in newer FPC versions. As a workaround (besides switching to newer FPC version) you can set something in "additional compiler options" field in SDK settings. E.g. "-O3".

Added "-g" - it works! Thank you!  :)
Title: Re: IntelliJ IDEA + Pascal
Post by: argb32 on March 26, 2015, 09:37:37 pm
Do have any plan to make it a Android development IDE?

I've plans on Android development and will use the plugin for it. Probably there will be some features specific to Android or iOS (e.g. support of specific build tools). But the general line is IDE for writing/analyzing/refactoring code. No matter for which platform.

Checked again - plugin refuses SDK path without fpc

Weird... The only thing I can think of is the file permissions.

Quote from: cit
Ok, will try to build from sources.  :(

FPCUp worked for me.
Title: Re: IntelliJ IDEA + Pascal
Post by: aradeonas on March 26, 2015, 09:45:44 pm
ok I get it but with attaching it to Android it can be serious product and not just a developer tools.Its not bad be a developer tools,its great but it can have a bigger future.
Thank you for making it.
Title: Re: IntelliJ IDEA + Pascal
Post by: argb32 on March 26, 2015, 09:49:20 pm
ok I get it but with attaching it to Android it can be serious product and not just a developer tools.

Can you please elaborate on it? How can it be attached to Android in your opinion?
Title: Re: IntelliJ IDEA + Pascal
Post by: aradeonas on March 26, 2015, 10:32:18 pm
Use it like AS but for FPC,As I saw before there are many works on making Andoid apps with Lazarus,you can move libraries that have futures to your IDE and also get together all Android development libraries in one place so it can be choice for Delphi an Pascal and also other developers who interst in Android to choose this new IDE.
Many pepole may disagree but Lazarus IDE seems old in compare of IntellJ and maybe developers like us that know pascal for years like this but new developers and also many others dont like a old school IDE.
So this can be field for this new one.
Title: Re: IntelliJ IDEA + Pascal
Post by: Kuci on April 19, 2015, 02:14:47 pm
I have problems with completion. It does not work, for example with TStringList, and I get 'Undeclared identifier' message.

I use Arch Linux, fpc 2.6.4 and IntelliJ Idea 14 Community Edition, both installed from official repositories.
Title: Re: IntelliJ IDEA + Pascal
Post by: argb32 on April 19, 2015, 06:50:27 pm
TStringList is from classes unit i guess?
It's RTL. To decompile RTL libraries FPC 2.7.1 or later is needed.
You can also try to add RTL sources to SDK's source path. (in File -> Project Structure -> SDKs).
Title: Re: IntelliJ IDEA + Pascal
Post by: Kuci on April 19, 2015, 07:02:23 pm
TStringList is from classes unit i guess?
It's RTL. To decompile RTL libraries FPC 2.7.1 or later is needed.
You can also try to add RTL sources to SDK's source path. (in File -> Project Structure -> SDKs).
Adding /usr/lib/fpc/src/rtl/inc and /usr/lib/fpc/src/rtl/x86_64 did not help.
Title: Re: IntelliJ IDEA + Pascal
Post by: argb32 on April 19, 2015, 10:48:18 pm
classes.pp is from /rtl/unix
But it's almost entirely in included classes.inc so adding it in source will not help much.
For FPC RTL the only way is to use a recent FPC version.
However I can see no point in using older versions.
Title: Re: IntelliJ IDEA + Pascal
Post by: Kuci on April 20, 2015, 06:40:29 pm
classes.pp is from /rtl/unix
But it's almost entirely in included classes.inc so adding it in source will not help much.
For FPC RTL the only way is to use a recent FPC version.
However I can see no point in using older versions.
Upgraded to 3.1.1 from svn, nothing changed. Please, could you tell, what exactly am I supposed to add to source path  ?
Title: Re: IntelliJ IDEA + Pascal
Post by: argb32 on April 20, 2015, 10:35:03 pm
After upgrading FPC you need to recreate SDK in File -> Project Structure -> SDKs.
After creating SDK with version 3.1.1, make sure that it is used as Module SDK in dependencies of your IDEA module.
It will take some time to reindex the new files.
If classes is still highlighted with red, use File => Invalidate caches / Restart to clear cache and restart the IDE.
Also I recommend to download latest version of the plugin from site.
Title: Re: IntelliJ IDEA + Pascal
Post by: Kuci on April 21, 2015, 07:57:02 am
After upgrading FPC you need to recreate SDK in File -> Project Structure -> SDKs.
After creating SDK with version 3.1.1, make sure that it is used as Module SDK in dependencies of your IDEA module.
It will take some time to reindex the new files.
If classes is still highlighted with red, use File => Invalidate caches / Restart to clear cache and restart the IDE.
Also I recommend to download latest version of the plugin from site.
Did so. Now, the classes and units are being recognized, but completion still does not work and it does not recognize constructors and destructors.
Title: Re: IntelliJ IDEA + Pascal
Post by: DonAlfredo on April 21, 2015, 10:35:11 am
I am a new user of your plugin.
Compiling a simple (Lazarus) project works 100%. Thanks !!

But how to include a source library ?
I have tried everything.
But the library does not show up in the compiler includes (under messagess when compiling)

Could you tell me how to include an external (pascal) library.
In my case : synaser ? Located in a separate directory somewhere ?

Thanks, Alfred.
Title: Re: IntelliJ IDEA + Pascal
Post by: argb32 on April 21, 2015, 11:18:22 pm
DonAlfredo, currently the plugin doesn't allow to create libraries with pascal sources.
You can create a module with content root pointing to library source root and with that source root directory marked as source in module settings.

You also need to update the plugin with latest version from the plugin's homepage (http://www.siberika.com/pasidea.htm) as previous ones can find units in .pas files only (not .pp).
Title: Re: IntelliJ IDEA + Pascal
Post by: DonAlfredo on April 22, 2015, 08:26:55 am
Thanks for the explanation ! I will try to get it to work this way.

But then I would like to extend my question to a feature request:

It would be (very) nice to be able to include source libraries (like synapse) into a FPC IntelliJ project as a normal (pascal source) library.

Thanks.
Title: Re: IntelliJ IDEA + Pascal
Post by: Kuci on April 22, 2015, 04:57:21 pm
argb32, could you react to my post, please ?
Title: Re: IntelliJ IDEA + Pascal
Post by: argb32 on April 22, 2015, 10:19:35 pm
Kuci, can you please elaborate what means completion doesn't work?
There is a problem with resolving methods of a class which is parent of a class from RTL (TStringList seems to be the case). This will be fixed.
Methods and fields from TStringList itself should be recognized and included in completion.
Title: Re: IntelliJ IDEA + Pascal
Post by: Kuci on April 23, 2015, 12:00:07 pm
Kuci, can you please elaborate what means completion doesn't work?
There is a problem with resolving methods of a class which is parent of a class from RTL (TStringList seems to be the case). This will be fixed.
Methods and fields from TStringList itself should be recognized and included in completion.
Methods and fields do not work as well.
Title: Re: IntelliJ IDEA + Pascal
Post by: argb32 on May 04, 2015, 11:17:38 pm
IDEA has several completion modes - basic, triggered by alt+space and extended, triggered by another alt+space.
The plugin was programmed to show in basic mode only completion variants from project, and not from libraries. Therefore to see completion variants from RTL a second alt+space was needed.
Now I've changed this and all variant are shown after first alt+space.
Will think how use extended completion. Most likely the only variants with correct visibility and type will be shown in basic mode and all in extended.

I've updated the plugin (http://www.siberika.com/siberika/download/IdeaPas.zip), site and added installation and setup instructions (http://www.siberika.com/siberika/install.htm) page.
Are the pictures useful?
Title: Re: IntelliJ IDEA + Pascal
Post by: vfclists on May 05, 2015, 12:03:58 am
IDEA has several completion modes - basic, triggered by alt+space and extended, triggered by another alt+space.
The plugin was programmed to show in basic mode only completion variants from project, and not from libraries. Therefore to see completion variants from RTL a second alt+space was needed.
Now I've changed this and all variant are shown after first alt+space.
Will think how use extended completion. Most likely the only variants with correct visibility and type will be shown in basic mode and all in extended.

I've updated the plugin (http://www.siberika.com/siberika/download/IdeaPas.zip), site and added installation and setup instructions (http://www.siberika.com/siberika/install.htm) page.
Are the pictures useful?

Hi argb32, This is my first enquiry about the IntelliJ plugin. Does it do background syntax checking, where it underlines words and has the marks in the gutter that indicate where syntax errors have been found?
Title: Re: IntelliJ IDEA + Pascal
Post by: argb32 on May 05, 2015, 01:48:16 am
Does it do background syntax checking, where it underlines words and has the marks in the gutter that indicate where syntax errors have been found?

Yes, it does syntax and some semantic (currently undeclared identifiers) checks and red marks in the gutter (at the right side) indicate errors found.
The gutter is customizable and also indicate warnings, usages of identifier under cursor, search results etc.
Title: Re: IntelliJ IDEA + Pascal
Post by: Silvio Clécio on August 04, 2015, 12:06:43 am
Hello,

Very nice contribution!

I use Intellij a lot for Android, NodeJS and AngularJS development, so this plugin will be a very good option for edit/compile many files in a single IDE.

Take a look at my test: http://pasteboard.co/2s6mvrWg.png. (or http://picpaste.com/pics/Capture-5dEuzJAo.1438639511.PNG)

Thank you very much!
Title: Re: IntelliJ IDEA + Pascal
Post by: argb32 on August 20, 2015, 12:46:11 am
A new version  (http://www.siberika.com/siberika/ipascal.htm) is out.
The changes include:
Title: Re: IntelliJ IDEA + Pascal
Post by: argb32 on December 02, 2015, 10:10:50 pm
Version 0.99 is here.
Most visible change is methods override generator available on Alt+Ins (see attachment).

Bug reports and feature request now can be posted into issue tracker (https://bitbucket.org/argb32/i-pascal/issues).
Title: Re: IntelliJ IDEA + Pascal
Post by: xlp on January 18, 2016, 04:09:20 am
Hi argb32,

Tried your plugins, it's quite nice. I've tried emailing you, but probably went to your spam folder.
I was wondering if you'd like some help on this. I've been fiddling around with lots of JetBrains products for years, really like all their AST/PSI stuff... Had a look at the AST produced by your parser using PsiViewer, seems quite ok to deal with.
I would be interesting in trying to implement more features, for example, renaming a method won't offer to rename it in the whole tree.

I've been asking JetBrains, without much success, to create a Delphi IDE. Like many here I used to think Java was too heavy and I'd always stick to native IDEs, but when I discovered IntelliJ platform, I just couldn't resist it. And having written some Delphi Expert in the past, writting plugins for IJ is so much easier...

So anyway, would you like some help? :)

Cheers
Title: Re: IntelliJ IDEA + Pascal
Post by: argb32 on January 22, 2016, 04:46:21 pm
Finally: I-Pascal 1.0 (http://www.siberika.com/siberika/ipascal.htm) stable release.
What's new:

Since 2012 the plugin installed 24854 times from official plugins store.

Feel free to add feature requests and bug reports here (https://bitbucket.org/argb32/i-pascal/issues).

xlp: Thank you for offering help but currently I don't need help in development of the plugin.
What can help much:
Bug reports, feature requests and spreading the word about I-Pascal.
Thanks again.
Title: Re: IntelliJ IDEA + Pascal
Post by: Graeme on January 22, 2016, 09:31:07 pm
Wow, that looks very impressive. I'll have to give IntelliJ IDE + Pascal a go.
Title: Re: IntelliJ IDEA + Pascal
Post by: argb32 on January 08, 2017, 11:58:43 pm
I-Pascal is at version 1.09 and it's open source now.
https://github.com/casteng/i-pascal
Title: Re: IntelliJ IDEA + Pascal
Post by: lainz on January 09, 2017, 12:14:48 am
What I like that is when you're typing the list with all variables pop ups really fast, you don't need to wait for it or press Ctrl + Space.
Title: Re: IntelliJ IDEA + Pascal
Post by: Blaazen on January 09, 2017, 04:52:45 am
The delay is configurable: Tools -> Options -> (node) Completion and Hints. It is the upper trackbar.
Title: Re: IntelliJ IDEA + Pascal
Post by: lainz on January 09, 2017, 02:36:58 pm
The delay is configurable: Tools -> Options -> (node) Completion and Hints. It is the upper trackbar.

Yes but that doesn't give the hint when you're typing existing variables. For example go to OnCreate and type Form1, when you're typing it there's no completion or hint window, except if you press ctrl + space, it comes only when you finished typing the whole word.
Title: Re: IntelliJ IDEA + Pascal
Post by: turrican on January 12, 2017, 09:25:33 pm
OMG... that's a great news... Works under Windows?
Title: Re: IntelliJ IDEA + Pascal
Post by: argb32 on January 13, 2017, 07:35:40 pm
Yes, it works well on Linux, OSX and Windows.
Title: Re: IntelliJ IDEA + Pascal
Post by: argb32 on April 03, 2017, 12:14:31 am
Released version 1.2 (http://www.siberika.com/siberika/whatsnew.htm) with basic debugging support.
Breakpoints, run to cursor, step over/into/out etc. As well as local variables view.
GDB is required and debug information need to be included in executable (-gw option).
Tested in Linux.
Title: Re: IntelliJ IDEA + Pascal
Post by: Thaddy on April 03, 2017, 10:47:56 am
Very nicely done, but IntelliJ seems not suitable to run on an averagely specified laptop so I uninstalled it from my laptop again (2 cores, 6 GB RAM). It is more than dead slow.
Strange, because other Java based editors - Eclipse(which is my default for Java)  and NetBeans - work at speed on the same laptop. No lagging.
I'll keep it on my desktop though, that one is over-specified. Note installation of your plugin worked like a breeze on both occasions.
What are the realistic hardware requirements for IntelliJ in your opinion? You don't really mean that you need i7, 8 virtual cores and 32 GB RAM - my desktop - for this to work?
Title: Re: IntelliJ IDEA + Pascal
Post by: Bostjan on April 03, 2017, 11:45:42 am
For me it works nice in a VM with 2vCPU and 6GB of RAM.

Host OS Windows 10, guest OS Windows 7 and vmware workstation 12.5 for virtualization.

Title: Re: IntelliJ IDEA + Pascal
Post by: argb32 on April 03, 2017, 09:00:07 pm
What are the realistic hardware requirements for IntelliJ in your opinion? You don't really mean that you need i7, 8 virtual cores and 32 GB RAM - my desktop - for this to work?

By default, IDEA limited to 750MB of heap (-Xmx option in idea64.vmoptions) for 64-bit mode. With JVM itself, off-heap buffers, stack etc it sums up to ~1.3GB on my machine. The same amount of memory is consumed by 3 most memory hungry tabs of Chrome. So 6GB is more than enough for IDEA.
A major slowdown may be caused by background indexing process which will start after creation of a new project. It's progress indicated on status bar below.
I-Pascal doesn't use some optimization facilities yet so it probably will consume more CPU than Java projects.
Title: Re: IntelliJ IDEA + Pascal
Post by: argb32 on May 01, 2017, 03:03:19 pm
Will it be useful for Pascal developers: Parameter Hints (https://www.youtube.com/watch?v=ZfYOddEmaRw).
What you think?
Title: Re: IntelliJ IDEA + Pascal
Post by: argb32 on May 25, 2017, 01:58:50 pm
Version 1.3 is available (http://www.siberika.com/siberika/whatsnew.htm) with Pascal code style settings support.
Title: Re: IntelliJ IDEA + Pascal
Post by: Thaddy on May 25, 2017, 03:09:40 pm
Remarkable job! On first glance: Well done!
(I still have speed issues on my laptop, though)
Title: Re: IntelliJ IDEA + Pascal
Post by: argb32 on May 25, 2017, 07:12:36 pm
Thanks.
Can't say anything on performance on laptop if JVM tuning didn't work.:(
Title: Re: IntelliJ IDEA + Pascal
Post by: Thaddy on May 26, 2017, 06:11:57 am
Thanks.
Can't say anything on performance on laptop if JVM tuning didn't work.:(
That's IntelliJ, not your plugin.

For anyone that uses IntelliJ already and also uses FreePascal I'd recommend to give your plugin a try. I like it very much.
Title: Re: IntelliJ IDEA + Pascal
Post by: argb32 on September 15, 2017, 12:54:29 am
Version 1.40 features LLDB debugger backend which is very useful for OSX users.
More detailed changelog is available here (http://www.siberika.com/siberika/whatsnew.htm).
Title: Re: IntelliJ IDEA + Pascal
Post by: sebjj on September 21, 2017, 12:38:54 pm
Nice work argb32.
I can't see the commits on https://github.com/casteng/i-pascal
Are you storing the source on another platform?
Title: Re: IntelliJ IDEA + Pascal
Post by: JD on September 21, 2017, 02:42:53 pm
Very nicely done, but IntelliJ seems not suitable to run on an averagely specified laptop so I uninstalled it from my laptop again (2 cores, 6 GB RAM). It is more than dead slow.
Strange, because other Java based editors - Eclipse(which is my default for Java)  and NetBeans - work at speed on the same laptop. No lagging.
I'll keep it on my desktop though, that one is over-specified. Note installation of your plugin worked like a breeze on both occasions.
What are the realistic hardware requirements for IntelliJ in your opinion? You don't really mean that you need i7, 8 virtual cores and 32 GB RAM - my desktop - for this to work?

I'm surprised. I have Eclipse Java EE Oxygen & Intellij IDEA Community on my DELL laptop (Centrino 2 + 4GB RAM). After using ZeroTrunAround's Optimizer for Eclipse, Eclipse and Intellij IDEA use approximately the same memory - 600MB. Intellij IDEA starts faster if it does not load projects by default and for me at least it is more responsive than Eclipse on my old limited laptop.

JD
Title: Re: IntelliJ IDEA + Pascal
Post by: argb32 on September 27, 2017, 01:51:08 pm
sebjj
No, all the code is on GitHub. Just pushed.
Title: Re: IntelliJ IDEA + Pascal
Post by: argb32 on October 02, 2018, 10:32:04 pm
v1.95 of the plugin is available.
Code analysis is now much (~100 times!) faster.
Documentation from comments can be extracted (View->Quick Documentation).
Within WITH blocks you immediately can see which identifier comes from which scope.
More details with animation:
http://siberika.com/whatsnew.htm
Title: Re: IntelliJ IDEA + Pascal
Post by: wrangler20 on September 04, 2020, 06:34:11 am
I am happy that I found this post. Finally a modern IDE available for Pascal that does not feel like 1990! Great job for developing the plugin!
Title: Re: IntelliJ IDEA + Pascal
Post by: Thaddy on September 04, 2020, 11:35:31 am
I am happy that I found this post. Finally a modern IDE available for Pascal that does not feel like 1990! Great job for developing the plugin!
Two points:
1. Yes, the plugin is excellent.
2. But it does not allow real two way design vs code like Lazarus and Delphi can.
The Delphi and Lazarus IDE's may look old fashioned but their power is missing: perfect synchronization between code and user interface design.
That "trick" is still missing in any other IDE for any other compiled language except C++ builder, which uses Delphi for that.
TinyPortal © 2005-2018