i-pascal icon indicating copy to clipboard operation
i-pascal copied to clipboard

Includes through $I

Open megahertz opened this issue 7 years ago • 4 comments

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

megahertz avatar May 30 '17 04:05 megahertz

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.

casteng avatar May 30 '17 15:05 casteng

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.

megahertz avatar May 30 '17 17:05 megahertz

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

casteng avatar May 31 '17 09:05 casteng

It sounds promising.

megahertz avatar May 31 '17 10:05 megahertz