Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autocomplete: install script instead of generating it in shell config #2693

Open
Codelax opened this issue Dec 26, 2022 · 2 comments
Open

autocomplete: install script instead of generating it in shell config #2693

Codelax opened this issue Dec 26, 2022 · 2 comments
Assignees
Labels
autocomplete core enhancement priority:low Low priority such as UX improvements and esthetics

Comments

@Codelax
Copy link
Member

Codelax commented Dec 26, 2022

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Currently, the autocomplete is installed by adding the script generation command to shell config (.bashrc), but the command scw autocomplete generate takes more than half a second to run, it should be quicker or we can generate this script once to the location of completion script for the used shell.

This would speed up the shell startup time.

How I imagine scw could expose this functionality

scw autocomplete install would install shell completion correctly

References

@Codelax
Copy link
Member Author

Codelax commented Dec 26, 2022

Printing a couple lines of shell script is very slow

 ○ time scw autocomplete script shell=zsh
autoload -U compinit && compinit
_scw () {
	output=($(scw autocomplete complete zsh -- ${CURRENT} ${words}))
	opts=('-S' ' ')
	if [[ $output == *= ]]; then
		opts=('-S' '')
	fi
	compadd "${opts[@]}" -- "${output[@]}"
}
compdef _scw scw
scw autocomplete script shell=zsh  0.67s user 0.07s system 173% cpu 0.430 total

@Codelax Codelax added the core label Dec 26, 2022
@remyleone remyleone added the priority:high New features label Jan 25, 2023
@Codelax
Copy link
Member Author

Codelax commented Apr 19, 2023

First goal of this issue was to improve completion speed but this was solved in multiple perf PRs.
We should first work on generated scripts.
Lookup #1959 #2887 #2832 #2831

@Codelax Codelax added priority:low Low priority such as UX improvements and esthetics and removed priority:high New features labels Apr 19, 2023
@remyleone remyleone assigned remyleone and unassigned Codelax Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autocomplete core enhancement priority:low Low priority such as UX improvements and esthetics
Projects
None yet
Development

No branches or pull requests

2 participants