# How to complete words that contains special chars like \`-\` or \`\>\`

**URL:** <https://discuss.kakoune.com/t/how-to-complete-words-that-contains-special-chars-like-or/1939>\
**Category:** Uncategorized\
**Created:** [November 21, 2021, 1:22pm UTC](https://discuss.kakoune.com/t/how-to-complete-words-that-contains-special-chars-like-or/1939 "2021-11-21T13:22:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![shenlebantongying](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/shenlebantongying/32/1021_2.png) [@shenlebantongying](https://discuss.kakoune.com/u/shenlebantongying)\
**Post date:** [November 21, 2021, 1:22pm UTC](https://discuss.kakoune.com/t/how-to-complete-words-that-contains-special-chars-like-or/1939/1 "2021-11-21T13:22:28Z")

</div>

Hi, I am experimenting kakoune with racket.

One problem troubles me, racket (and scheme) has a lot of functions that look like `string->list` or `int->string`.

However, the completion candidates disappear if I type beyond `-` or `>`.  
How can I keep narrowing completion list that contains special chars like `-` or `>`?

![asd](https://discuss.kakoune.com/uploads/default/original/2X/e/ee63948dd373024c16be3fe4121dae714d9d08d8.gif)

I tried

```auto
set-option buffer extra_word_chars '>' '-'

```

but doesn’t work.

---

<div class="post-metadata">

**Author:** ![Screwtapello](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/screwtapello/32/12_2.png) [@Screwtapello](https://discuss.kakoune.com/u/Screwtapello)\
**Post date:** [November 22, 2021, 1:20am UTC](https://discuss.kakoune.com/t/how-to-complete-words-that-contains-special-chars-like-or/1939/2 "2021-11-22T01:20:46Z")

</div>

If you’re using Kakoune’s “scheme” plugin (i.e. `:info %opt{filetype}` displays “scheme”) then `extra_word_chars` should be set correctly:

> <https://github.com/mawww/kakoune/blob/860b20ef0a2a421381130200916feec45a5e842c/rc/filetype/scheme.kak#L19>

If I launch Kakoune as `kak test.scm` (to create a buffer with the Scheme filetype), I can type `string->list` (one of the Scheme built-ins hard-coded into the Scheme plugin) and the completion works as expected. However, some of the completions mentioned in your screen-recording (like `list->bytes`) aren’t built-in to the scheme plugin, and there doesn’t appear to be a specific Racket plugin. Where do they come from?

---

<div class="post-metadata">

**Author:** ![shenlebantongying](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/shenlebantongying/32/1021_2.png) [@shenlebantongying](https://discuss.kakoune.com/u/shenlebantongying)\
**Post date:** [November 22, 2021, 9:45pm UTC](https://discuss.kakoune.com/t/how-to-complete-words-that-contains-special-chars-like-or/1939/3 "2021-11-22T21:45:17Z")

</div>

I removed all `static_words` and use completions from kak-lsp. The `static_words` and words from current file can do complete perfectly, but this is not the case for kak-lsp.

I suspect **there is a bug somewhere** , which **may** be:

- on kak’s side that cannot handle `extra_word_chars` for other completion sources

- on kak-lsp’s side that `extra_word_chars` got ignored, and will re-query completion without consider `extra_word_chars`

Sorry, i don’t know any further and my guess might be wrong.

My minimalist `racket.kak`(which is missing in current kak)

```nohighlight
hook global BufCreate .*[.](rkt|rktd|rktl|rkts) %{
  set-option buffer filetype racket
}

hook global WinSetOption filetype=racket %{
  require-module racket

  set-option buffer extra_word_chars '!' '$' '%' '&' '*' '+' '-' '.' '/' ':' '<' '=' '>' '?' '@' '^' '_' '~'
  set-option buffer comment_line ';'
  set-option buffer comment_block_begin '#|'
  set-option buffer comment_block_end '|#'

  hook -once -always window WinSetOption filetype=.* %{ remove-hooks window racket-.+ }
}

hook -group racket-highlight global WinSetOption filetype=racket %{
  add-highlighter -override window/racket ref racket
  hook -once -always window WinSetOption filetype=.* %{
    remove-highlighter window/racket

  }
}

# --------------------------------------------------------------------------------------------------- #
provide-module -override racket %§
add-highlighter -override shared/racket regions
add-highlighter -override shared/racket/code default-region group
add-highlighter -override shared/racket/comment region ';' '$' fill comment
add-highlighter -override shared/racket/comment-form region -recurse "\(" "#;\(" "\)" fill comment
add-highlighter -override shared/racket/comment-block region "#\|" "\|#" fill comment
§

```

---

<div class="post-metadata">

**Author:** ![JJK96](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/jjk96/32/305_2.png) [@JJK96](https://discuss.kakoune.com/u/JJK96)\
**Post date:** [November 22, 2021, 10:05pm UTC](https://discuss.kakoune.com/t/how-to-complete-words-that-contains-special-chars-like-or/1939/4 "2021-11-22T22:05:57Z")

</div>

Also try this plugin: [Bitbucket](https://bitbucket.org/KJ_Duncan/kakoune-racket.kak)

---

<div class="post-metadata">

**Author:** ![Screwtapello](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/screwtapello/32/12_2.png) [@Screwtapello](https://discuss.kakoune.com/u/Screwtapello)\
**Post date:** [November 23, 2021, 4:38am UTC](https://discuss.kakoune.com/t/how-to-complete-words-that-contains-special-chars-like-or/1939/5 "2021-11-23T04:38:40Z")

</div>

I suspect this is a bug in kak-lsp. Kakoune’s built-in completions all respect `extra_word_chars`, but for various reasons it’s awkward to support in plugins. Supporting only “traditional” C-style identifiers the 20% effort that provides 80% of the results, so I’d imagine most general-purpose plugins start there and only bother to support `extra_word_chars` once they become popular enough that somebody notices the omission.
