bashsupport-pro
bashsupport-pro copied to clipboard
autocomplete support for alias
it would be nice to have the same auto-complete support for user defined aliases like we have for user defined functions.
currently in intellij, when writing something like the snippet bellow:
hey() {
echo "hey ${1}"
}
alias heyjoe="hey joe" # could be hey\ joe
heyjoe
it would be nice in the editor when ctrl clicking on the invocation of heyjoe if would jump to the location where the alias was defined (possibly opening another tab if it was defined in a different file, if in scope. similarly if you'd ctrl+click on the hey in the right hand side of the alias definition, you'd be taken to the definition of that function, if it's in scope.
currently the alias and the aliased are not autocompleted or ctrl+clickable, they're probably not recognized.
i am using bash support pro 4.0.1.232, bash 5.14, intellij ultimate 2023.2.3, ubuntu 22
I expected that alias is usually used to set up or configure interactive shells.
Are you using alias in regular shells scripts, i.e. not for interactive mode?
If you do, what's the advantage to you to use alias x ="my code" instead of function x() { my code; }?
Thanks!
Thanks for getting back to me, Joachim!
I am indeed using alias in scripts. The difference I guess is in the way alias is implemented, and sometimes the less powerful alternative is both the semantic and technically correct choice.
To answer your first point: aside using it in scripts (of various complexity), when just using alias to shorten commands it's usually best to define aliases in some script that gets sourced, rather than on-the-fly definitions.
Your example is valid, but it would be also nice to have support for alias in autocomplete
On Mon, 22 Apr 2024, 08:21 Joachim Ansorg, @.***> wrote:
I expected that alias is usually used to set up or configure interactive shells.
Are you using alias in regular shells scripts, i.e. not for interactive mode? If you do, what's the advantage to you to use alias x ="my code" instead of function x() { my code; }?
Thanks!
— Reply to this email directly, view it on GitHub https://github.com/BashSupport-Pro/bashsupport-pro/issues/151#issuecomment-2068663671, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABZC6FEQ3QZJJJ62BY22DLY6S25ZAVCNFSM6AAAAABGQZHEBKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRYGY3DGNRXGE . You are receiving this because you authored the thread.Message ID: @.***>
Proper support for alias would require at least the following:
- go to definition (supporting sourced files)
- find usages
- code completion, I'd probaby rank aliased named below function names in the popup
- rename
- quick documentation
- highlighting of calls to
aliascommands (perhaps) - syntax support for the rhs value (e.g.
echo hello $HOMEinalias say='echo hello $HOME'). This will be difficult, I think
I'll try to add basic support into 5.0, but can't promise it atm. If you have thoughts or ideas about the feature set, please share :)