How to make extension work? lazarus / 9-Editor ---------------------------------------------------------------------- staratel20 · 2016-02-13 20:55 Here I found a very interesting and useful example of extending of IDE: http://lazarus.lazarus.freepascal.narkive.com/3foITF8v/extending-the- ide So, how make it works? I take a result code of topic, put it into lazarus-trunk\components\DuplicateLine just created directory as duplicateline.pas. Then I choose(in Lazarus) - Package-New package, and save new package as duplicateline.pkg, add the file duplicateline.pas to a package anf press Compile, Run, Rebuild IDE. When after this I go to Options-Key mapping  , - I even not see filtered command Duplicate line when type patch of word. what I'm doing wrong? ---------------------------------------------------------------------- JuhaManninen · 2016-02-13 21:16 I did not yet look at the code but did you install the package? You mentioned that you compiled it and the IDE, but that is not quite the same. About pressing Run, you can only run a project but not a package. ---------------------------------------------------------------------- Leledumbo · 2016-02-14 05:06 Did you register the unit which has Register procedure? ---------------------------------------------------------------------- staratel20 · 2016-02-14 08:49 Leledumbo: after my "wrong" installation(that I do 2 onces), I try with this checkbox - and my Lazarus give my the message "Stack overflow" (in attached screen). After this I do command "make clean bigide" and Lazarus are drop out with the same message. Then I try to run my previous version of Lazarus(in another dir) and it works fine. After that it's clean for me that's the problem in config. I do archive of "broken" config and after that - rewrite with config of previous version. After that trunk Lazarus starts normally. At this point I again try to compile and install package duplicateline.dpk, after what Lazarus give me the message in attachment. Maybe something wrong with this package? Did somebody try my steps without changing the code of unit? P/s: if it necessary I'll crate the topic on bugtracker with attachment of "bad" config ---------------------------------------------------------------------- JuhaManninen · 2016-02-14 09:47 Quote from: staratel20 on February 14, 2016, 09:49:44 amAt this point I again try to compile and install package duplicateline.dpk, after what Lazarus give me the message in attachment. Maybe something wrong with this package? Did somebody try my steps without changing the code of unit? *.dpk is usually the suffix for Delphi packages. Lazarus packages have suffix *.lpk. The last error message means that Lazarus binary was built with the package but it cannot be found any more. QuoteP/s: if it necessary I'll crate the topic on bugtracker with attachment of "bad" config No, the bugtracker is for bugs in FPC and Lazarus projects. Please attach your problematic package here Zipped (only source files) and somebody finds the problem for sure. ---------------------------------------------------------------------- staratel20 · 2016-02-14 10:22 I attach my config here and the packed dir of package(write in prev post .dpk by the habit, mean .lpk). Please help me anybody. ---------------------------------------------------------------------- frakno · 2016-02-14 11:14 staratel20 - Nice Idea! My first attempt works fine. Made it like you've described Quote...  file duplicateline.pas to a package anf press Compile   ...  Corrected the errors - missing packages - by adding IDEIntf, SynEdit and checked 'Register unit' like Leledumbo said Compile, Install and works fine. Thank you ------------------- FPC 3.0 - Lazarus1.6RC2 - Windows ---------------------------------------------------------------------- staratel20 · 2016-02-14 12:02 >>staratel20 - Nice Idea! Nice idea make package from it? If so - is exist way to use this tool without creating package? Now... I try next steps - Open .lpk file, popup on Required packages - New requirement, then type names  IDEIntf, SynEdit so that appears in tree of Required packages. Then Compile, Install and... Stack overflow again(config rewriting helps). Maybe I was need to uninstall same(dummy) package duplicateline? But when I go to Package-Instal/Unistall package I don't see it in list. ---------------------------------------------------------------------- JuhaManninen · 2016-02-14 12:22 Quote from: staratel20 on February 14, 2016, 11:22:29 amI attach my config here and the packed dir of package(write in prev post .dpk by the habit, mean .lpk). Where is your source code? The package only contains an auto-generated unit dupliline. Besides, the procedure Register creates a recursive loop. Makes no sense. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure Register;begin  RegisterUnit('dupliline', @dupliline.Register);end; Why did you copy your whole config directory? It is not relevant for this problem. Just copy the package with the actual source code. BTW, you don't need to include the compiled files under "lib" directory. ---------------------------------------------------------------------- frakno · 2016-02-14 12:39 Hey Guys, as this package can contain a lot of useful things i renamed my try to fExtendIde. I attach my three files in one zip. Unzip this to a directory. Load the lpk, compile and install and it should work. The ShortCuts should work. And the menuCommands you should find in the Edit-Menu, last line 'Lines' If not give me a cry ---------------------------------------------------------------------- staratel20 · 2016-02-14 13:42 JuhaManninen: thanks, I discover it with wondering. After I press compile the file was overwritten. frakno: thank for the best answer of topic! The greatest way to learn something - see how it works. Of cause after success installing I'll uninstall and try to successful reproduce all steps)). Think that this easy and useful example must be added to this tutorial: http://wiki.freepascal.org/Extending_the_IDE#Search_in_all_packages Thanks again everybody for the help. ---------------------------------------------------------------------- JuhaManninen · 2016-02-14 13:49 Quote from: frakno on February 14, 2016, 01:39:14 pmas this package can contain a lot of useful things i renamed my try to fExtendIde. Nice, it works. Only the [ssCtrl, ssShift] + VK_UP/VK_DOWN do not work because they are already assigned. I guess they must be unassigned first. How about MyExtendIde for the name? Ok, just kidding, but "Extend IDE" is rather generic. In fact all packages under lazarus/components directory extend the IDE somehow. ExtendSourceEditor would be more accurate. Some minor notes, not important: LCLProc, SysUtils and IDEMsgIntf are not needed in uses section. There is a nice "Unused Units ..." feature in Refactoring menu. Code: [Select]Compile package fExtendIde_pkg 0.0: Success, Hints: 4 fExtendIde.pas(24,7) Note: Local variable "tempStr1" not used fExtendIde.pas(72,7) Note: Local variable "TextPos" is assigned but never used fExtendIde.pas(73,7) Note: Local variable "ScreenPos" is assigned but never used fExtendIde.pas(74,7) Note: Local variable "Filename" is assigned but never used ---------------------------------------------------------------------- staratel20 · 2016-02-14 14:05 Also MyNewPackage sounds good too))). Finally - big my fault that I give a name to unit, same with a name of package - that's why all goes wrong. So steps(returning to 1st post): 1) In Lazarus - New package - Save to folder in directory components\ 2)  create a Unit1.pas in the same dir and Copy/Paste code from forum 3) Add Unit1 to package and register the Unit1 as described Leledumbo above(set checkbox) 4) Open .lpk file, popup on Required packages - New requirement, then type names  IDEIntf(the same for SynEdit) so that appears in tree of Required packages. 5) Compile, Install Hope it will be useful so someone ---------------------------------------------------------------------- frakno · 2016-02-14 14:13 Good Hint. Yes, if i add more useful functions i'll rename it to something like ExtendSourceEditor or similar. And its true tempStr1, TextPos, ScreenPos and Filename are not needed. But also   ... uses ... IDEMsgIntf is at the moment not needed. But i like this approach because it is easy to understand how to extend the SourceEditor  and how to implement ShortCuts and Menu items. therefore many thanks to all involved guys and to be gender fair  - to all girlies from frakno-boy