Lazarus

Using the Lazarus IDE => Editor => Topic started by: tudi_x on August 07, 2018, 04:34:08 pm

Title: Open project file in OS / shell and GIT Integration
Post by: tudi_x on August 07, 2018, 04:34:08 pm
hi,
as part of the commands for committing to the git server the project i need access to command line.
sometimes i do not keep a file manager opened and i need to run the commands for committing to the git server in the project folder.
so i need to open a file manager and navigate to the project folder manually.
is there an option or do you feel a change could be posted to have on right click in Project Inspector the option of opening a file manager and / or command line?
(i have seen this option in Brackets and LiteIDE)
please advise.
thank you
Title: Re: Open project file in OS / shell
Post by: taazz on August 07, 2018, 04:51:03 pm
the same way I open the nautilus in the source folder add a new external tool with a command along the lines of
external application : gnome-terminal
working directory    : $Path($EdFile())

If that does not work then use the Parameters editor and add --working-directory $Path($EdFile()) fine tune as needed.


Oops sorry for windows here are the cmd.exe parameters use /K

https://ss64.com/nt/cmd.html
Title: Re: Open project file in OS / shell
Post by: tudi_x on August 07, 2018, 04:53:53 pm
sorry, i am not familiar with nautilus. do you have a link or something please?
Title: Re: Open project file in OS / shell
Post by: taazz on August 07, 2018, 04:57:32 pm
sorry, i am not familiar with nautilus. do you have a link or something please?
nautilus is the GUI file manager I gave you the terminal application is usually gnome-terminal or xterminal in linux cmd.exe on windows see my updated post above
Title: Re: Open project file in OS / shell
Post by: tudi_x on August 07, 2018, 05:38:24 pm
thank you! sounds complicated only to me most probably ...
i will open a change in the Lazarus tracker to provide something more immediately available to the IDE user.
Title: Re: Open project file in OS / shell
Post by: taazz on August 07, 2018, 06:10:41 pm
thank you! sounds complicated only to me most probably ...
i will open a change in the Lazarus tracker to provide something more immediately available to the IDE user.
here a screenshot of the description above. Not that complicated, but if it does not work for you please post OS and what the error message says someone with the same os might be able to help. I'm on windows and I can test and create a command for windows if that helps

PS.
Make sure that the hide main window is not checked my bad I forgot about that.
Title: Re: Open project file in OS / shell
Post by: balazsszekely on August 07, 2018, 07:57:42 pm
@tudi_x
Quote
so i need to open a file manager and navigate to the project folder manually.
I don't know if it helps, but you can right click the status bar(editor window), then click "Open folder...". If the current unit is part of your project it will open the project folder in the file manager.
Title: Re: Open project file in OS / shell
Post by: sash on August 07, 2018, 08:46:39 pm
I have 2 handy shortcuts in external tools
Title: Re: Open project file in OS / shell
Post by: tudi_x on August 09, 2018, 05:30:27 pm
@GetMem
thank you but on my Linux I did not get the open folder option.

i am attaching two screen captures with this option from Brackets (IDE for JavaScript, HTML, CSS, ...) and LiteIDE (IDE for Go).
i will open a ticket with a change to have the feature in project inspector. i know it is work, i know it is difficult, you guys can cancel or ignore it, but from my perspective i did my best.
Title: Re: Open project file in OS / shell
Post by: taazz on August 09, 2018, 07:13:01 pm
@GetMem
thank you but on my Linux I did not get the open folder option.

i am attaching two screen captures with this option from Brackets (IDE for JavaScript, HTML, CSS, ...) and LiteIDE (IDE for Go).
i will open a ticket with a change to have the feature in project inspector. i know it is work, i know it is difficult, you guys can cancel or ignore it, but from my perspective i did my best.
Not enough information what linux? which version of lazarus? as far as I know the menu is not present in lazarus 1.4.4. See attached my suse external tool settings.
Title: Re: Open project file in OS / shell
Post by: balazsszekely on August 09, 2018, 09:35:40 pm
Quote
@GetMem
thank you but on my Linux I did not get the open folder option.
It was only recently implemented(few months or so), you won't find it in 1.8.4. The good new is it will be available in the next major release.

PS: You should try Lazarus trunk. It's quite trivial to set it up and won't interfere with you current installation
1. open a terminal
1. sudo apt-get install subversion
2. go to a particular folder then: svn co https://svn.freepascal.org/svn/lazarus/trunk lazarus
3. cd to lazarus folder then: make bigide
4. when you wish to update to the recent version: svn update
Title: Re: Open project file in OS / shell
Post by: tudi_x on August 10, 2018, 10:18:25 am
thank you all for your solutions.

I am adding another two screen captures from Atom and Sublime text where the concept of opening CLI or file manager on right mouse click exists and this functionality is available in the files / folder section. given the fact that Sublime, Atom, Brackets and LiteIDE have exactly the same UX i think we can say that this is how in 2018 IDEs have decided to give access to the user to the folder where his code resides.
i think Lazarus IDE should stick to the same UX implementation as this would provide easy adoption by users coming from other IDEs and also good IDE reviews. Besides LiteIDE the afore mentioned IDEs have larger user base than Lazarus, thus it is that these users would need to adopt Lazarus and not Lazarus users to adopt ex. Atom.

Sticking to this direction I am proposing the below for the Git integration for Lazarus IDE:

1. Prerequisites
verify Git is installed

OS: git --version

if Git is installed enter Git mode for Project Inspector.
in Git mode Project Inspector would initially show on mouse right click a new section Git with initial option:
- initialize

2. Initialization
user can initialize folder in which project file is located as Git repo
on initialize the OS command would be git init.

after git init a hidden folder would be created.

3. Using the Git integration

operations to be supported while in Git mode:
- add file to Git repo aka track file
- remove file from Git repo (but leave file as part of Pascal project)
- change branch (IDE would need to silently reopen project folder)
- commit
- open default terminal at Git repo path
- open default file manager at Git repo path
   
4. UI changes:
- tracked files (files added to the Git repo would have an icon signalizing they were added to the Git repo)
- pop-up menu on mouse right click showing Git actions
- pop up for commit message

Unsupported features for now
a. change of Git email and user name - to be done from CLI
b. create tag
c. navigate through Git changes
Title: Re: Open project file in OS / shell
Post by: taazz on August 10, 2018, 11:28:24 am
thank you all for your solutions.
uninteresting stuff about adaptation and social hierarchies are snipped sorry but I'm only interested in addressing problems not adopting behaviors.
Sticking to this direction I am proposing the below for the Git integration for Lazarus IDE:

1. Prerequisites
verify Git is installed

OS: git --version

if Git is installed enter Git mode for Project Inspector.
in Git mode Project Inspector would initially show on mouse right click a new section Git with initial option:
- initialize

2. Initialization
user can initialize folder in which project file is located as Git repo
on initialize the OS command would be git init.

after git init a hidden folder would be created.

3. Using the Git integration

operations to be supported while in Git mode:
- add file to Git repo aka track file
- remove file from Git repo (but leave file as part of Pascal project)
- change branch (IDE would need to silently reopen project folder)
- commit
- open default terminal at Git repo path
- open default file manager at Git repo path
   
4. UI changes:
- tracked files (files added to the Git repo would have an icon signalizing they were added to the Git repo)
- pop-up menu on mouse right click showing Git actions
- pop up for commit message

Unsupported features for now
a. change of Git email and user name - to be done from CLI
b. create tag
c. navigate through Git changes
Ok that is interesting the git integration is a bit light and needs work those proposals go to my personal list for evaluation. In the mean time I would suggest to post this list as a feature request to the bug tracking site although I do not expect the team to implement them it is a good place to create and keep track of git integration feature list that everybody has access.
Any way have you managed to open the terminal window on the source dir? if yes would you mind posting a screen shot of your tool settings?
Title: Re: Open project file in OS / shell and GIT Integration
Post by: tudi_x on August 10, 2018, 11:43:32 am
opened: https://bugs.freepascal.org/view.php?id=34110

i respect and like your sense of humor.

Quote
Any way have you managed to open the terminal window on the source dir? if yes would you mind posting a screen shot of your tool settings?
sorry taazz but i did not understand what i need to do and i looked mostly at installing the IDEs from where i got the screen captures and analyzing the GIT plugin in Brackets.
i will navigate the OS file manager for now.
Title: Re: Open project file in OS / shell and GIT Integration
Post by: taazz on August 10, 2018, 11:54:50 am
sorry taazz but i did not understand what i need to do and i looked mostly at installing the IDEs from where i got the screen captures and analyzing the GIT plugin in Brackets.
i will navigate the OS file manager for now.
that's ok I'll fire up my suse VM at home this evening and see if I can make an "open terminal on source dir" external tool if succesfull I'll post a step by step guide.
Title: Re: Open project file in OS / shell and GIT Integration
Post by: lucamar on August 10, 2018, 12:09:39 pm
Rather than a Git integration like that---which, incicentally, exceeds the limits of the post question---I would like to see generic plugin hooks for version control, maybe a la Delphi. Unless they are already there, of course ...  ;)

The problem is that you use Git, but I use SVN and others use Mercurial or Fossil or what-not. The IDE should be agnostic with respect to any one of those and instead try to catter generically to the concept.

IMHO, of course.  ;D
Title: Re: Open project file in OS / shell and GIT Integration
Post by: taazz on August 10, 2018, 05:09:41 pm
here goes this works for me on suse with KDE installed I have no idea how it fairs for other systems or in gnome.
1) Open the menu Tools\Configure External Tools
2) press the add button to add a new menu item
3) In the tile type Konsole.
4) in the Program filename type konsole be carefull with the letter case in this editor otherwise nothing will run.
5) in the parameters type --workdir $projPath()
6) uncheck the Hide main Form check box bellow the working directory editor.
7) press OK twice to save the item and exit the configuration dialog.

Ready, now you can find a new menu under the tools menu titled Konsole when you click it it will open the konsole terminal application in the projects path as long as the path does not have a space in its name if it does it will open one level up.
Title: Re: Open project file in OS / shell and GIT Integration
Post by: tudi_x on August 10, 2018, 05:23:43 pm
@lucamar
https://stackoverflow.com/questions/871/why-is-git-better-than-subversion#875
what can be easily observed is that most repos are migrating to Git. even Microsoft bought a Git based company.
Github, Gitlab, Bitbucket companies are Git based.
this is the trend right now and this trend is for many years now strongly eroding the user base of other systems.
decentralized solutions will win nowadays, just look at the number of blockchain projects not being actual currencies.

IMO the IDE should not be agnostic, the IDE should target so the invested time of team resources is used to make the biggest difference to the most users with the least amount of work.
Skilled users could always maintain very antic code base (sorry Lazarus repo) and have a plug in created as Lazarus code is open sourced.
Title: Re: Open project file in OS / shell and GIT Integration
Post by: lucamar on August 10, 2018, 08:57:15 pm
Skilled users could always [...] have a plug in created as Lazarus code is open sourced.

Let's avoid the "mine washes whiter" snips, OK? My point is that if Lazarus had specific hooks (or a generic API) for version control plugins, sooner or later there will appear more or less "standard" plugins for the most used version control systems. That's what is important, not whether GIT is the bestest and must be treated apecially.
Title: Re: Open project file in OS / shell and GIT Integration
Post by: tudi_x on August 11, 2018, 11:53:44 am
@taazz
thank you for the steps. i do not have the checkbox mentioned in step 6.
i configured the external tool as xfce4-terminal but a terminal does not appear when clicking the new menu item.
xfce4-terminal opens a terminal on MX Linux - the terminal window below i opened with the command in the command window up.

OS and version as per my signature.
Title: Re: Open project file in OS / shell and GIT Integration
Post by: taazz on August 11, 2018, 01:20:24 pm
@taazz
thank you for the steps. i do not have the checkbox mentioned in step 6.
i configured the external tool as xfce4-terminal but a terminal does not appear when clicking the new menu item.
xfce4-terminal opens a terminal on MX Linux - the terminal window below i opened with the command in the command window up.

OS and version as per my signature.
1) remove any and all parameters until a window is successfully opened.
2) in your terminal window type xfce4-terminal --help (or what ever the equivalent is for xfce4-terminal) to see a list of command line parameters and see if it uses --workdir or some other form.
3) test the parameter in the terminal window to make sure that it works as expected before jumping in the external tools settings.
4)I have no idea what is going on with 1.8.4 I recently installed 1.8.2 my self on windows and I'm sorry to say I'm not looking forward to finding more free space for yet an other lazarus installation. Sorry someone else will have to help with the specifics of lazarus 1.8.4.
Title: Re: Open project file in OS / shell and GIT Integration
Post by: sash on August 11, 2018, 10:32:32 pm
For xfce use exo-open
Title: Re: Open project file in OS / shell and GIT Integration
Post by: dbannon on August 12, 2018, 06:56:08 am
On Ubuntu Mate its

Program Filename : mate-terminal
Parameters : --working-directory=$projPath()

And it works like a dream !

Personally, given how easy this is and given the complexity of (eg) git, I rather not see scarce developer time committed (if you forgive the pun) to implementing git as a GUI.

Davo
Title: Re: Open project file in OS / shell and GIT Integration
Post by: taazz on August 12, 2018, 02:17:48 pm
insignificant little changes just to make things annoying enough to keep linux outside of the main stream! Nive to have the differences in one place though thanks for the heads up everyone.
Title: Re: Open project file in OS / shell and GIT Integration
Post by: sash on August 12, 2018, 02:28:15 pm
Personally, given how easy this is and given the complexity of (eg) git, I rather not see scarce developer time committed (if you forgive the pun) to implementing git as a GUI.

I second this, and for all not very experienced users there is a lot of well working, free gui tools for any vcs, like Tortoise(SVN/Git/HG) and a bunch of similar.

Personally (being mostly a Mercurial user), I also use Netbeans IDE (for C/C++/PHP/HTML) which supports most of VCS, but despite this fact I find more convenient to use external application instead - TortoiseHG. Which is especially convenient when working with complex code that overlaps across languages and repos.
Title: Re: Open project file in OS / shell and GIT Integration
Post by: lucamar on August 12, 2018, 02:53:05 pm
One more, for Kubuntu and other KDE-based distros:

Program Filename : konsole
Parameters : --working-dir $projPath()

One thing you can say for Linux: you're never out of options  :D

--
Oops! Just realized that Taazz explaination above (http://forum.lazarus.freepascal.org/index.php/topic,42151.msg294012.html#msg294012) is for konsole too
Title: Re: Open project file in OS / shell and GIT Integration
Post by: af0815 on August 12, 2018, 03:55:55 pm
... as part of the commands for committing to the git server the project i need access to command line. ...
I have found a component to integrate basics of svn and git in Lazarus https://gitlab.com/ccrdude/lazvcshelper
maybe this a soloution for the originally problem !?
Title: Re: Open project file in OS / shell and GIT Integration
Post by: dbannon on August 13, 2018, 11:50:08 am

Quote
Program Filename : konsole
Parameters : --working-dir $projPath()

Program Filename : mate-terminal
Parameters : --working-directory=$projPath()
.....
OK, opening a terminal is a good idea, sounds like some of this needs to find its  way to http://wiki.freepascal.org/IDE_tricks - I assume no one objects ?
Title: Re: Open project file in OS / shell and GIT Integration
Post by: dbannon on August 16, 2018, 01:24:10 pm

OK, opening a terminal is a good idea, sounds like some of this needs to find its  way to http://wiki.freepascal.org/IDE_tricks - I assume no one objects ?
[/quote]

Done

http://wiki.freepascal.org/IDE_tricks#Opening_a_Terminal_Windows_from_the_IDE
TinyPortal © 2005-2018