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

Basic VS Code autosuggestions don't work #45

Open
EmilyGraceSeville7cf opened this issue Jan 17, 2024 · 3 comments · May be fixed by #46
Open

Basic VS Code autosuggestions don't work #45

EmilyGraceSeville7cf opened this issue Jan 17, 2024 · 3 comments · May be fixed by #46

Comments

@EmilyGraceSeville7cf
Copy link
Contributor

I mean them:

image

Now just builtins and keywords are suggested.

@EmilyGraceSeville7cf
Copy link
Contributor Author

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

@bmalehorn
Copy link
Owner

@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:

provideCompletionItems(
document: vscode.TextDocument,
position: vscode.Position,
token: vscode.CancellationToken,
context: vscode.CompletionContext,
) {

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.

@EmilyGraceSeville7cf
Copy link
Contributor Author

EmilyGraceSeville7cf commented Jan 20, 2024

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 EmilyGraceSeville7cf linked a pull request Jan 26, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants