[SOLVED] Control-D no confirmation option to JCF formatting lazarus / 9-Editor ---------------------------------------------------------------------- tudi_x · 2017-07-12 09:34 hi All, please advise if there is an option not to have displayed the confirmation option for the JCF formatting? thank you ---------------------------------------------------------------------- balazsszekely · 2017-07-12 10:20 Hi tudi_x, I don't see any option to disable that dialog, however if you go to $(LazarusDir)\components\jcf2\IdePlugin\lazarus\jcfidemain.pas and comment out the line in the see screenshot, then reinstall package $(LazarusDir)\components\jcf2\IdePlugin\lazarus\jcfidelazarus.lpk, the dialog won't appear again. Ideally we should add an checkbox to Options-->Editor-->JCF Format Settings:  "Show confirmation dialog?", checked by default. I'm too lazy for that now. ---------------------------------------------------------------------- tudi_x · 2017-07-12 10:27 thank you for the hint GetMem. no hurry, Lazarus is still the best IDE. ---------------------------------------------------------------------- JuhaManninen · 2017-07-12 11:07 Quote from: tudi_x on July 12, 2017, 12:27:44 pmno hurry, Lazarus is still the best IDE. Please provide a patch. There is also another thread regarding JCF:  http://forum.lazarus.freepascal.org/index.php/topic,37518 Many people agree that the GUI should be changed but nobody promised to do it. ---------------------------------------------------------------------- balazsszekely · 2017-07-12 13:37 @Juha Patch attached. Please apply, I don't have commit rights in that folder. ---------------------------------------------------------------------- JuhaManninen · 2017-07-12 15:12 Q: What is the idea here in unit ConvertTypes: -  OLD_REG_ROOT_KEY = '\Software\Jedi\JediCodeFormat'; +  OLD_REG_ROOT_KEY = 'Software\Jedi\JediCodeFormat'; Was there a bug in the registry path? ---------------------------------------------------------------------- balazsszekely · 2017-07-12 16:16 @Juha QuoteWas there a bug in the registry path?Yes. If you put the slash back, Lazarus throws an exception: "Failed to create key ''\\Software\Jedi\JediCodeFormat". Please note the double backslash in the front. ---------------------------------------------------------------------- JuhaManninen · 2017-07-12 16:52 Quote from: GetMem on July 12, 2017, 06:16:29 pmYes. If you put the slash back, Lazarus throws an exception: "Failed to create key ''\\Software\Jedi\JediCodeFormat". Please note the double backslash in the front. I applied the patch in r55491. Thanks. I wonder why nobody noticed the bug earlier. ---------------------------------------------------------------------- balazsszekely · 2017-07-12 17:03 QuoteI wonder why nobody noticed the bug earlier.Because the frame frFiles.pas(Options-->JCF Format Settings-->Format File) did not attempt to write back anything to registry, basically it was read only until know. Take a look at WriteSettings method, before the patch it looked like this: 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 TfFiles.WriteSettings(AOptions: TAbstractIDEOptions);begin  FormatSettings.Description := mDescription.Text;end; Where FormatSettings is the TFormatSettings(https://www.freepascal.org/docs- html/rtl/sysutils/tformatsettings.html) it has nothing to do with JEDI format settings/registry. ---------------------------------------------------------------------- JuhaManninen · 2017-07-13 09:24 Quote from: GetMem on July 12, 2017, 07:03:55 pmWhere FormatSettings is the TFormatSettings(https://www.freepascal.org/docs- html/rtl/sysutils/tformatsettings.html) it has nothing to do with JEDI format settings/registry. Sorry but your diagnosis is wrong. For some reason JEDI named their options class as "TFormatSettings" and a function "FormatSettings". It is extremely confusing especially because the same unit frFiles also uses DefaultFormatSettings from Sysutils. It must be changed ... and so I did in r55493. It is now "FormattingSettings". In my tests the new option is not persistent. I turn it off, then restart Lazarus and it is on again. Restoring the backslash to OLD_REG_ROOT_KEY makes no difference. No errors but still not persistent. Tested in Linux. The code uses TRegIniFile which is cross-platform. IMO this looks wrong without backslash:   OLD_REG_ROOT_KEY = 'Software\Jedi\JediCodeFormat'; Every other registry path has the leading backslash. The package has JcfSettings which uses JcfRegistrySettings. It is not straightforward. Can you please take a look. ---------------------------------------------------------------------- balazsszekely · 2017-07-13 14:36 QuoteSorry but your diagnosis is wrong. For some reason JEDI named their options class as "TFormatSettings" and a function "FormatSettings". It is extremely confusing especially because the same unit frFiles also uses DefaultFormatSettings from Sysutils. It must be changed ... and so I did in r55493. It is now "FormattingSettings". What a mess! I even [Ctrl] + [Click]-ed the old FormatSettings(now FormattingSettings) and took me to Sysutils. How is this possible? TJCFRegistrySettings(JcfRegistrySettings.pas) combined with OLD_REG_ROOT_KEY = '\Software\Jedi\JediCodeFormat' is not working at all, however it works under windows with OLD_REG_ROOT_KEY = 'Software\Jedi\JediCodeFormat' and writes the data to the registry. Unfortunately this is not good enough because it's not cross-platform. If I move the checkbox and its setting to TFormattingSettings(JcfSettings.pas) it works both under windows, linux and osx, even when OLD_REG_ROOT_KEY = '\Software\Jedi\JediCodeFormat', and writes data to file. Please test attached patch. Thank you! ---------------------------------------------------------------------- JuhaManninen · 2017-07-13 19:29 Quote from: GetMem on July 13, 2017, 04:36:32 pmWhat a mess! I even [Ctrl] + [Click]-ed the old FormatSettings(now FormattingSettings) and took me to Sysutils. How this is possible? It is apparently a bug in Codetools but it does not happen always. I first Ctrl-Clicked FormatSettings.Description and it went to the correct place. Then I jumped to DefaultFormatSettings, came back, and Codetools started to behave bad. Somebody should make a simple demo where the issue can be reproduced and then report in bug tracker. QuotePlease test attached patch. Thank you! Applied in r55497. Works now.