casteng / i-pascal

A free Object Pascal language plugin for IntelliJ IDEA
111 stars 34 forks source link

Includes through $I #10

Open megahertz opened 7 years ago

megahertz commented 7 years ago

Hi George.

What are your plans about includes? I'm working on legacy project which uses a lot of includes to prevent circular references. And it's only one reason why I need to use Lazarus instead of IDEA with your plugin.

PS I take my hat off, you did a great job alone. It seems that it's only one solution which helps to concentrate on code, not on GUI.

PPS It's not possible to make a donation, "The payment you initiated has been blocked because PayPal can only facilitate payments between Russian residents when they transact in Russian Ruble. Please go back to the merchant website and choose to pay in Russian Ruble, or alternatively choose another payment method."

Best Regards, Alexey

casteng commented 7 years ago

Alexey,

IDEA doesn't directly support including part of code from one file to another. So I haven't figured out yet a general solution for includes which will not hit performance. Therefore it's likely that there will be some partial solution. For example, threat includes as some kind of "units". In that case the includes should have some reasonable syntax. E.g. balanced begin/end blocks, full declarations etc. If you can provide some examples of your include files it will help to decide what restrictions is suitable. Thanks for pointing out the problem with Paypal.

megahertz commented 7 years ago

Thank you for the response. It's sad news.

In my case, it's something like

type
  TClass1 = class;
  ...
  TClass10 = class;

{$I Class1Header.inc}
 ...
{$I Class10Header.inc}

implementation

{$I Class1Body.inc}
...
{$I Class10Body.inc}

where Class1Header.inc is like:

TClass1 = class
public
...
end; 

and Class1Body.inc is like:

procedure Class1.Proc1;
begin
end;
...

Unfortunately, there are a lot of cycle references between classes both in interface and implementation and it's not possible to do refactoring in the near future.

casteng commented 7 years ago

I have similar code of my own. It seems possible to support such declarations in includes.

megahertz commented 7 years ago

It sounds promising.