-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Complete command line arguments #294
Conversation
Codecov Report
@@ Coverage Diff @@
## master #294 +/- ##
==========================================
+ Coverage 74.04% 74.30% +0.25%
==========================================
Files 18 18
Lines 551 576 +25
Branches 88 94 +6
==========================================
+ Hits 408 428 +20
- Misses 124 126 +2
- Partials 19 22 +3
Continue to review full report at Codecov.
|
@otreblan thanks for adding this! 👏 Do you have time to add a few unit tests? That would be great. |
Done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much for contributing here. This would be a great addition to the language server.
The get-options.sh
shell script doesn't seem that portable. I'm wondering if we can come up with a more portable/cross platform solution. Note the we already have the man and help page that we could parse.
Another thing: updating the triggerCharacters
configuration option (line 107 in src/server.ts
) to include -
makes it work without additional configuration.
Co-authored-by: Kenneth Skovhus <skovhus@users.noreply.github.com>
When trigger.mp4 |
@@ -1,6 +1,8 @@ | |||
#!/usr/bin/env bash | |||
|
|||
source /usr/share/bash-completion/bash_completion | |||
DATADIR="$(pkg-config --variable=datadir bash-completion)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does the script handle if the user doesn't have the completion installed?
~ pkg-config --variable=datadir bash-completion
package bash-completion was not found in the pkg-config search path.
Perhaps you should add the directory containing `bash-completion.pc'
to the PKG_CONFIG_PATH environment variable
No package 'bash-completion' found
~ echo $?
1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least on OS X the suggested solution doesn't work. Does the solution works on most Linux distributions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should work if the bash-completion
package is installed and it provides a bash-completion.pc
file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this!
# Disabled by default because _longopt executes the program | ||
# to get its options. | ||
if (( ${BASH_LSP_COMPLETE_LONGOPTS} == 1 )) | ||
then | ||
_longopt "${COMP_WORDS[0]}" | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw _longopts
is disabled until BASH_LSP_COMPLETE_LONGOPTS=1
, because it can execute an arbirary program.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, so we require people to set BASH_LSP_COMPLETE_LONGOPTS=1
in their bash profile, or?
Should it work when editing sh file (with |
Do you have |
Version 1. Works with @2, thank you! Although I am only getting completions for find, none for head or sort, as per video above. Using native nvim LSP client. |
|
I see, there is no completions for those in |
Hi, I can't find any documentation on this feature in the README. I have the following installed, and it works with
It does not seem to work in Neovim using the default config for the LSP https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#bashls and https://github.com/hrsh7th/nvim-cmp . Can anyone help? Thanks.
|
@David-Else Whats the output of |
@otreblan The result is nothing, just an empty line. Also |
@David-Else Does your installation has |
@otreblan yes:
|
@David-Else And it's contents? |
Am I still meant to add |
@David-Else Your bash-completion is too old, datadir was added 2 years ago https://github.com/scop/bash-completion/blame/master/bash-completion.pc.in |
@otreblan Cheers! I will try to update using the source from Github, I am using Rocky Linux 8, and they do have some out of date things hidden in there. |
Noteworthy changes: * Upgrade dependencies * Adds support for completing command line arguments (bash-lsp/bash-language-server#294) * Default configuration change: parsing errors are not highlighted as problems (as the grammar is buggy)
Noteworthy changes: * Upgrade dependencies * Adds support for completing command line arguments (bash-lsp/bash-language-server#294) * Default configuration change: parsing errors are not highlighted as problems (as the grammar is buggy)
Noteworthy changes: * Upgrade dependencies * Adds support for completing command line arguments (bash-lsp/bash-language-server#294) * Default configuration change: parsing errors are not highlighted as problems (as the grammar is buggy)
@otreblan Hello again. I removed my old Centos 8 RPM version of
I am still not getting auto completion in neovim. You asked me before did I have EDIT |
@otreblan Thanks to the new 2.1 version it now works! :) |
This feature works in Helix, but there is a problem. It does not happen in Neovim, can it be solved here or should I make a request to the Helix devs? If so, what should I ask them to implement? Cheers!
|
@David-Else it seems like a Helix issue as it works in all other clients. And I'm honestly not sure what the issue is. |
@skovhus Thanks for the quick reply! |
Closes #117.
bash.mp4
In vim,
-
must be added to the keyword characters for this to work.