Recent

Author Topic: AutoFormat IDE plugin  (Read 1469 times)

fifr

  • Newbie
  • Posts: 6
AutoFormat IDE plugin
« on: February 04, 2025, 09:14:47 am »
https://chiselapp.com/user/fifr/repository/pas-lazautoformat

AutoFormat is an IDE plugin for Lazarus that calls the JEDI code formatter automatically when saving a file.

This is my very first Lazarus plugin, so please excuse the bad style. The current state is that it works for me in my workflow but little is known beyond that. I'm announcing this here in case it is useful for someone else.

Much of the code is taken from the jcf2 plugin itself because I could not figure out how to call the proper (private) methods of that plugin. Everything would be much easier if the functionality of AutoFormat was integrated directly into the jcf2 plugin code, but I prefer it to be separated as much as possible (for now).

lainz

  • Hero Member
  • *****
  • Posts: 4690
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: AutoFormat IDE plugin
« Reply #1 on: February 06, 2025, 03:17:33 am »
I can't access that website from Argentina.

TRon

  • Hero Member
  • *****
  • Posts: 4133
Re: AutoFormat IDE plugin
« Reply #2 on: February 06, 2025, 03:30:26 am »
OP is probably not allowed to attach either so let me give it a try. In case not wanted then please let me know and I'll remove.

Which reminds me: trunk version link was https but the release link was http only.
Today is tomorrow's yesterday.

fifr

  • Newbie
  • Posts: 6
Re: AutoFormat IDE plugin
« Reply #3 on: February 06, 2025, 08:35:07 am »
@lainz I do not really know why you can't access the page. Maybe a cert chain issue of the hoster (it has already been reported, so let's hope the best)

@TRon thanks for sharing the archives. Both links should be https now.

TRon

  • Hero Member
  • *****
  • Posts: 4133
Re: AutoFormat IDE plugin
« Reply #4 on: February 06, 2025, 08:58:29 am »
You're welcome fifr.

I checked the https and that seems to be ok 👍
Today is tomorrow's yesterday.

fozkan

  • Newbie
  • Posts: 4
Re: AutoFormat IDE plugin
« Reply #5 on: February 13, 2025, 11:58:01 am »
I could not install it in Linux x64 with Fpcupdeluxe.
Code: Pascal  [Select][+][-]
  1. procedure TAutoFormat.MakeEditorConverter;
  2. begin
  3.    if fcEditorConverter = nil then begin
  4.       fcEditorConverter := TEditorConverter.Create;
  5.       fcEditorConverter.OnStatusMessage := @LogIDEMessage;
  6.       fcEditorConverter.OnIncludeFile := @OnIncludeFile;
  7.    end;
  8.    Assert(fcEditorConverter <> nil);
  9. end;

No member "OnIncludeFile".

Lazarus v3.6 fpc 3.2.2

Thaddy

  • Hero Member
  • *****
  • Posts: 16631
  • Kallstadt seems a good place to evict Trump to.
Re: AutoFormat IDE plugin
« Reply #6 on: February 13, 2025, 12:09:35 pm »
AutoFormat is an IDE plugin for Lazarus that calls the JEDI code formatter automatically when saving a file.
OMG

That would be a good effort when jcf was flawless or close to flawless which it isn't.
Jcf can ruin your code outlay pretty easily - think generics - so I would never want to  excute that automaticcaly, it does not even correct tabs #9 very well.
« Last Edit: February 13, 2025, 12:14:23 pm by Thaddy »
But I am sure they don't want the Trumps back...

TRon

  • Hero Member
  • *****
  • Posts: 4133
Re: AutoFormat IDE plugin
« Reply #7 on: February 13, 2025, 12:13:29 pm »
I could not install it in Linux x64 with Fpcupdeluxe.
No member "OnIncludeFile".

Lazarus v3.6 fpc 3.2.2
Requires Lazarus 4.0 or trunk.

@fifr:
If I try to download release tag 0.1.0 with:
- mainpage
- tags
- V0.1.0
- check-in: 78ea4a162f
- files
- Download, Latest tagged release: lazautoformat-0.1.0.tar.gz

The browser returns (insecure connection): "Not found"
« Last Edit: February 13, 2025, 12:26:29 pm by TRon »
Today is tomorrow's yesterday.

Thaddy

  • Hero Member
  • *****
  • Posts: 16631
  • Kallstadt seems a good place to evict Trump to.
Re: AutoFormat IDE plugin
« Reply #8 on: February 13, 2025, 12:16:11 pm »
Even then it makes no sense, in the sense it will for sure lead to a floud of questions.
But I am sure they don't want the Trumps back...

TRon

  • Hero Member
  • *****
  • Posts: 4133
Re: AutoFormat IDE plugin
« Reply #9 on: February 13, 2025, 12:21:56 pm »
Yes, I do not use the JCF formatter for that reason either Thaddy.

Things have a tendency to get fixed if enough people complain about it :)
Today is tomorrow's yesterday.

fifr

  • Newbie
  • Posts: 6
Re: AutoFormat IDE plugin
« Reply #10 on: February 13, 2025, 01:24:50 pm »
@TRon: yes that's because by going through tags/.../checkin/etc you end up at that checkin and that had a typo in the README, and this is the version of the file shown on that page. The README on the main page is the one of trunk, which has the correct(ed) URL. I would have to move the tag to a different checkin to fix this (but basically the README on this specific checkin is doomed, sorry for that).
« Last Edit: February 13, 2025, 02:16:21 pm by fifr »

TRon

  • Hero Member
  • *****
  • Posts: 4133
Re: AutoFormat IDE plugin
« Reply #11 on: February 13, 2025, 08:42:36 pm »
@fifr:
Ok thank you for having taken a look at it.

I mentioned it because I am very intrigued by the repository software you are using. I don't remember being familiar with it. Looks pretty nice btw. I definitely will need to give that a try myself.
Today is tomorrow's yesterday.

DomingoGP

  • Jr. Member
  • **
  • Posts: 81
Re: AutoFormat IDE plugin
« Reply #12 on: February 13, 2025, 08:44:33 pm »
AutoFormat is an IDE plugin for Lazarus that calls the JEDI code formatter automatically when saving a file.
Jcf can ruin your code outlay pretty easily - think generics - so I would never want to  excute that automaticcaly, it does not even correct tabs #9 very well.

Although as a maintainer of the jcf2 package my opinion is biased, but I think jcf2 has no issues formating code with generics. Anyway, it would be worth create a ticket in the issue tracker with the wrongly formatted code.

Things have a tendency to get fixed if enough people complain about it :)

Instead of complaining it would be much more useful to fill tickets in the bug tracker in order to solve the problems encountered.  :)





fifr

  • Newbie
  • Posts: 6
Re: AutoFormat IDE plugin
« Reply #13 on: February 13, 2025, 08:52:26 pm »
@TRon: You mean fossil (https://fossil-scm.org)? It's my favourite scm. It's based on the same ideas as git, but is completely self contained (including wiki, bug tracker, forum, chat, etc.). No need for an external software or platform like github/gitlab/sourceforge/whatever, and all contained in a single executable. I use it for all my small and personal projects and am pretty satisfied (it's probably not the best of large community projects, though).

TRon

  • Hero Member
  • *****
  • Posts: 4133
Re: AutoFormat IDE plugin
« Reply #14 on: February 13, 2025, 09:03:11 pm »
@fifr: Thank you, Indeed I was referring to fossil (the name eluded me in my previous post). Especially the self contained part intrigues me which would indeed be pretty suitable for (hosting) small projects.

The GUI without all the screaming whistles and bells seems pretty clean and functional which is something that I personally prefer.
Today is tomorrow's yesterday.

 

TinyPortal © 2005-2018