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

Functions autosuggestions

Open artemijan opened this issue 2 years ago • 2 comments

Hello!First of all I would like to thank you for a such superb extension, it's really great! Would it be possible to implement functions autosuggestions, e.g. when I start typing some word at a new line it will show me function names I can call? Functions located in /functions/ folder (this autosuggestion works in a terminal)

artemijan avatar May 27 '22 16:05 artemijan

Hi @artemijan, thanks for the suggestion!

To start out with, you can already get basic, word-based suggestions in vscode fish files: image This is built-in to vscode and can be configured here: https://code.visualstudio.com/docs/editor/intellisense#_customizing-intellisense It works by looking for any words in the current file. pros:

  • built-in to vscode, no implementation required in vscode-fish
  • works on functions, arguments, variables, keywords cons:
  • won't recognize function names like foo-bar-baz as one word
  • context-unaware. For example, it will suggest functions when you're typing an argument
  • only looks at current file

What you're asking for is a bit more like having a whole fish IDE. As in, vscode-fish would open a terminal, load fish, and then when you wanted suggestions it would type your text so far and hit tab in the terminal to see what the suggestions are.

pros:

  • would give accurate function & variable suggestions
  • could give documentation & linting in individual fish files cons:
  • a lot of work to set up "open terminal & run tab-completion" framework
  • assumes current file is loaded in interactive terminal, rather than a script
  • requires writing real fish file parser that parses it into a syntax tree

Personally I just edit my config.fish with small changes for fun - it's not a serious part of my job so I'm alright with not having amazing IDE tools for fish.

Does that all make sense?

bmalehorn avatar Jun 01 '22 23:06 bmalehorn

Maybe I can motivate you or somebody else to implement the requested feature by telling that Nushell already has some LSP. ;) I definitely like Fish, but for me writing scripts in Fish without a proper LSP is a pain. That's why I used Bash for a long time - it has LSP available for VS Code.

EmilyGraceSeville7cf avatar Apr 26 '23 11:04 EmilyGraceSeville7cf