casteng / i-pascal

A free Object Pascal language plugin for IntelliJ IDEA
112 stars 33 forks source link

Unit scopes #45

Open Sorien opened 5 years ago

Sorien commented 5 years ago

pls could you add support for unit scopes http://docwiki.embarcadero.com/RADStudio/Rio/en/Unit_Scope_Names

uses
 Vcl.Forms; // undeclared identifier

in delphi you can specify default unit scopes like Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;WinAPI.Foundation;System.Win;FMX

in JB Idea project settings you have something named Unit namespaces but when I try System;Vcl or System,Vcl it seems to not be working

uses
 Forms; // undeclared identifier

Idea 2019.2 I-Pascal 2.40

casteng commented 5 years ago

The "Unit namespaces" setting in SDK settings is exactly the feature you are talking about. It's not included in autotests yet but I just tested manually and it seems to work. What version of Delphi and for what architecture you are using? What RTL directories did you set in Delphi SDK? One with sources or with .dcu?

Sorien commented 5 years ago

ok I didn't have all required directories included

I have in unit namespaces Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;System.Win

image

but still not all of them are working, it looks like the order is important

e.g.

uses
  Windows, Messages, Generics.Defaults, DB;

when I use Winapi;Data;System; Generics.Defaults can't be found when I change it to Winapi;System;Data; Generics.Defaults & DB can't be found

casteng commented 4 years ago

Fixed in v2.50

Sorien commented 4 years ago

it's better but still not ok

unit Test;

interface

uses
  Windows, Messages, Classes, SysUtils, Graphics, Controls, StdCtrls, Forms, U_ParentEdit, DBCtrls, DB, Mask, Buttons,
  JvComponentBase, JvComCtrls, JvExMask, JvDBControls, TB2Item, PrnDbgeh, DPControls, DPDBEdits, DPEdits,
  JvToolEdit, ExtCtrls;

image

unit Windows (WinApi.Windows) is in C:\Program Files (x86)\Embarcadero\Studio\20.0\source\rtl\win

image

unit namespaces Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;WinAPI.Foundation;System.Win;FMX

fireundubh commented 4 years ago

when I try System;Vcl or System,Vcl it seems to not be working

It was working for me in 2.10 but no longer in 2.50.