Closed kmoschcau closed 5 months ago
Thanks for the feedback, will add some more templates to the project tonight.
Currently, I'm a little preoccupied with adding more extensive test coverage, to catch edge cases like this. Having said that, I will work on producing a fix when I get a chance.
Feel free to submit a PR, if you find a quick way to build the abbr completions, without exiting on stderr when there are no abbreviations.
I believe the file producing this error is src/utils/completions/startup-config.ts
In the meantime, I believe if you add any abbr
to your config.fish
, it should remove this error. I highly encourage their usage. Just incase you wanted to try a couple out, here are some examples:
i do use abbr but i gate them behind the is-interactive flag. i guess the suggestion here is to enable override this for fish lsp?
So your setup looks something like the following?
if status is-interactive
abbr --add gco git checkout
end
Assuming I understand the purpose behind this setup, do you think this project should consider itself as an interactive process (i.e., parsing out the relevant abbr commands, and attempting to build them for the user's completion list)? Or, are only some of your abbreviations included here, and these should be ignored by the lsp?
all of my abbr are gated since non-interactive sessions can’t use abbreviations i believe
it would be cool if the lsp handled this but i think it’s also reasonable to just recommend adding an env var
Thanks for the feedback.
Currently, the fish-lsp, does build abbreviations for the completion list, and uses them in non-interactive sessions (although the newer releases to the abbr command like --set-cursor
and --position
are not supported).
Theoretically, tree-sitter could gather all the abbr
commands, and build equivalent completions. Trying to build that would be difficult, though.
For now, I am testing this command:
[ (abbr --show | count) -eq 0 ] || abbr --show | string split ' -- ' -m1 -f2 | string unescape
Which I believe should work. LMK, if y'all come up with something shorter.
can confirm that after i add an abbr and an alias i'm able to start the lsp!! looking into how we can handle this case of no alias or abbr
rip what are the odds that i comment at the exact same time
have a patch that has the env var i referenced which is working. however this makes me think that it would be better for the lsp to do the retrieval of the functions/aliases rather than fish to do it. that way i don't have to add this flag everywhere
Good tip about the aliases too, Added the relevant fix/no-abbrs-causing-crash
[ (alias | count) -eq 0 ] || alias | string collect | string unescape | string split ' ' -m1 -f2
Could you link me to the env fix?
we're synced up on these comment times :rofl:
Is there a good way to start fish in subshell, with a different profile? Something like:
fish --profile=$HOME/.config/empty-fish-config/
Would make testing this way easier
after scanning the documentation really quickly i don't think so, however we can probably just source <path to config>
?
lemme setup a fork rq to share the patch better
also my autofixer is changing all the files like willy nilly, would you be opposed to adding some pre push hook or github actions to format/lint the files
Nah I'm all for that. I do have an action setup for lint, and husky is included. Maybe one of those dependencies didn't get installed correct? I've had husky need extra steps before.
If you're writing a github action, it's a little tricky because the yarn install
scripts need fish to execute the scripts/* files for setting up the project.
Yep the server starts now, thanks.
When I open my fish config in nvim with fish-lsp set up via nvim-lspconfig, the server soon crashes with the following error:
Here is the relevant LSP log:
Running
abbr --show
in my shell returns an empty output. Which in turn causes bothstring split
andstring unescape
to return with exit code 1.(PS: You might want to add another issue template for bug reports, besides feature requests and security vulnerabilities.)