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

Remove all triggers #21

Closed
cd-a opened this issue Feb 12, 2024 · 9 comments
Closed

Remove all triggers #21

cd-a opened this issue Feb 12, 2024 · 9 comments

Comments

@cd-a
Copy link

cd-a commented Feb 12, 2024

Is there a way to remove all triggers and just trigger it manually with C-x?

I know you can override them, but I tried passing empty string and it didn't work.

[language-server.gpt]
command = "bun"
args = ["run", "/Users/att/.local/bin/helix-gpt.js"]
triggerCharacters = ""
@leona
Copy link
Owner

leona commented Feb 12, 2024

Try this

[language-server.gpt]
command = "bun"
args = ["run", "/Users/att/.local/bin/helix-gpt.js", "--triggerCharacters"]

Helix still triggers them sometimes anyway though, so it's hard to disable the automatic ones entirely.

@cd-a
Copy link
Author

cd-a commented Feb 12, 2024

This does not work, this is the helix log output:

2024-02-12T10:18:29.127 helix_lsp::transport [ERROR] gpt err <- "TypeError: Option '--triggerCharacters <value>' argument missing\n"
2024-02-12T10:18:29.127 helix_lsp::transport [ERROR] gpt err <- " code: \"ERR_PARSE_ARGS_INVALID_OPTION_VALUE\"\n"
2024-02-12T10:18:29.127 helix_lsp::transport [ERROR] gpt err <- "\n"
2024-02-12T10:18:29.127 helix_lsp::transport [ERROR] gpt err <- "      at /Users/att/.local/bin/helix-gpt.js:2:853\n"
2024-02-12T10:18:29.127 helix_lsp [ERROR] failed to initialize language server: server closed the stream
2024-02-12T10:18:29.127 helix_lsp::transport [ERROR] gpt err: <- StreamClosed

@leona
Copy link
Owner

leona commented Feb 12, 2024

This does not work, this is the helix log output:

2024-02-12T10:18:29.127 helix_lsp::transport [ERROR] gpt err <- "TypeError: Option '--triggerCharacters <value>' argument missing\n"
2024-02-12T10:18:29.127 helix_lsp::transport [ERROR] gpt err <- " code: \"ERR_PARSE_ARGS_INVALID_OPTION_VALUE\"\n"
2024-02-12T10:18:29.127 helix_lsp::transport [ERROR] gpt err <- "\n"
2024-02-12T10:18:29.127 helix_lsp::transport [ERROR] gpt err <- "      at /Users/att/.local/bin/helix-gpt.js:2:853\n"
2024-02-12T10:18:29.127 helix_lsp [ERROR] failed to initialize language server: server closed the stream
2024-02-12T10:18:29.127 helix_lsp::transport [ERROR] gpt err: <- StreamClosed

Ok you'll need to set the value then, I thought it might accept it. Just set it to something like ""

@cd-a
Copy link
Author

cd-a commented Feb 12, 2024

Thanks. This works (without errors now), but I don't really see much of a difference since it's still triggering all the time on its own :)

@hnorkowski
Copy link

hnorkowski commented Feb 12, 2024

You need a pattern that matches nothing. The regex "" matches on anything. You could try the following regexs:

  • (?!): This is a zero-width negative lookahead assertion that always fails to match because it looks ahead to ensure that nothing follows the current position 1.
  • \A\Z: This pattern uses the anchors \A (beginning of the string) and \Z (end of the string) to assert that the string must begin and end simultaneously, which means it must be empty 1.
  • $^: This combination of anchors attempts to match the position right after the end of the string ($) and right before the start of the string (^). It should theoretically match nothing, but its behavior may vary depending on the implementation and flags used 1.
  • /(?:)/: This pattern defines a non-capturing group with no content inside. Since the group is empty, it cannot match anything 3.

@leona
Copy link
Owner

leona commented Feb 12, 2024

You need a pattern that matches nothing. The regex "" matches on anything. You could try the following regexs:

  • (?!): This is a zero-width negative lookahead assertion that always fails to match because it looks ahead to ensure that nothing follows the current position 1.
  • \A\Z: This pattern uses the anchors \A (beginning of the string) and \Z (end of the string) to assert that the string must begin and end simultaneously, which means it must be empty 1.
  • $^: This combination of anchors attempts to match the position right after the end of the string ($) and right before the start of the string (^). It should theoretically match nothing, but its behavior may vary depending on the implementation and flags used 1.
  • /(?:)/: This pattern defines a non-capturing group with no content inside. Since the group is empty, it cannot match anything 3.

It's currently a list of characters, no regex. Although I'm pretty sure I can check if it was triggered by a character instead of a keybind, so I'll look at adding a config option to disable automatic completions.

@hnorkowski
Copy link

It also looks like the even if there are no triggers detected the debounce delay is still executed before returning no auto-completions to helix. therefore you always have to wait for the debounce time before you get auto-completions. Would be great to only debounce when there are triggers.

@leona
Copy link
Owner

leona commented Feb 17, 2024

So unfortunately Helix doesn't support the additional context (here) I need to detect if it was a manual completion. I'll add this to the list and keep an eye out for Helix support.

@leona leona closed this as completed Feb 17, 2024
@cd-a
Copy link
Author

cd-a commented Feb 18, 2024

Is this the related issue? helix-editor/helix#9656

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

No branches or pull requests

3 participants