vscode-fish icon indicating copy to clipboard operation
vscode-fish copied to clipboard

Basic VS Code autosuggestions don't work

Open EmilyGraceSeville7cf opened this issue 1 year ago • 3 comments

I mean them:

image

Now just builtins and keywords are suggested.

EmilyGraceSeville7cf avatar Jan 17 '24 18:01 EmilyGraceSeville7cf

I assume my last PR broke this basic builtin VS Code completion.

EmilyGraceSeville7cf avatar Jan 17 '24 18:01 EmilyGraceSeville7cf

@EmilyGraceSeville7cf Ah thanks for noticing & filing the ticket.

There seems to be a way to still provide word-based completion in addition to the new suggestions. This is what the shellscript language combined with the Bash IDE extension does: image

image

So it might be worth checking out what Bash IDE does, though I'm not sure it can be replicated here without spinning it out into a separate extension: https://github.com/bash-lsp/bash-language-server/blob/7fffe661caad70fc2fc023ff8c35007047a6a76d/vscode-client/src/extension.ts

If that doesn't work, we might be able to fix this by just... implementing function-based suggestions. We get passed in a document object which we can get the whole file contents from:

https://github.com/bmalehorn/vscode-fish/blob/b7f550d6c5f76f552580d599657bed49c84e9a22/src/extension.ts#L148-L153

And we can then do something like add the following suggestions based on simple regexes:

  1. function *([^\s]+) (function definition)
  2. \$([^\s]+) (using variable)
  3. set +(-\w )*([^\s]+) (setting variable)

Lastly I can still just revert the PR for now until it works with the word-based suggestions. Do those options all make sense?

If you're not feeling like jumping on a fix soon, I'll probably just revert it until we know how to add suggestions on top of the existing ones.

bmalehorn avatar Jan 17 '24 19:01 bmalehorn

I can't fix it right now, I have no enough knowledge on this topic. Maybe just split everything into words and add them to suggestions? I thought there is something like a default completion provider to do this task, I don't know.

I also wanted to implement completion for all commands in $PATH. It really would make the extension much better. :)

EmilyGraceSeville7cf avatar Jan 20 '24 15:01 EmilyGraceSeville7cf