Forum > Editor

[Solved] How can automatic library addition be done?

(1/3) > >>

loaded:
Hi All,
I've fixed a lot of issues with the editor that I didn't know and did wrong until now. Another problem that has become very important to me now is the case of adding libraries.

As follows;
In android studio this can be handled easily. While working on the project, libraries that are not in the project can be added automatically with Alt+Enter.

But so far;
I waited a long time for this feature to come, but unfortunately I couldn't see it in 2.2. I don't know though!!!

Is there a work around this in new versions?
If there is no such study , how should we go about doing it ourselves ?

Because ;
While trying to run the codes I found in research, I am having a lot of trouble in this regard.


I would be glad if you share your thoughts and ideas. Respects.

Martin_fr:
When you refer to "libraries" (in the context of android studio?), do you mean "packages"?
Or do you mean libraries as in .dll or .so? Which would mean some "procedure ... external ... 'foo.dll'" kind of declaration?

As for packages, try the "unit and identifier dictionary" (you need to install the package "cody" / then look in the "Source" menu). Though it starts out empty, it is self learning, and over time collects all the data you need.

An overview of tools can be found here https://wiki.lazarus.freepascal.org/Lazarus_IDE_Tools
A list of cool stuff https://wiki.lazarus.freepascal.org/New_IDE_features_since

loaded:
Martin_fr thank you very much for replying.
Sorry I said library, but I should have said classroom. Its counterpart in Lazarus is unit.
What I want is that the code to be written should automatically add it in whichever unit it is in.

Martin_fr:
Ok, it is probably still "View unit and identifier dictionary" from the cody package. (At least that is what I use, and I don't know if there is an other way).

Menu Package > Install Package
Add "Cody" and rebuild the IDE.

Menu Tools > Options > Editor > Keymap
Find "View unit and identifier dictionary" => add whatever key you want to use for it.

As I said, it starts empty. But for me it did "learn" quite quick. I just restarted and created a new project...

Type "TMap" in your code, and press the key for "View unit and identifier dictionary" => It should give you some options. Choose one, and it will add the unit.

Well, it's not the same as in your example, it does not scan an its own for "unknown" identifiers. You have to invoke it yourself. But then it should work. As I said, it may take a bit before it has build it's data. But it will get there.

https://wiki.lazarus.freepascal.org/Cody#Unit_.2F_Identifier_Dictionary

loaded:
Yes, this is the closest solution to what I want!
If we could modify it a bit and redesign it to auto-scan sources and use a Postgresql database, it would be number 10.
Thank you very much Martin_fr for keeping us informed of this study.

Navigation

[0] Message Index

[#] Next page

Go to full version