Fix completion-filtering by checking actual word boundaries & reduce Ruby word chars (#9170)
This fixes https://github.com/zed-industries/zed/issues/9069 by 1. reverting https://github.com/zed-industries/zed/issues/7819 2. fixing completion filtering with regards to word boudaries For (2) see explanation in commit message: > Previously, this would only split words on upper-lower boundaries or > on `_`/`-`. > > The result was that we would filter out completions too aggressively. > The filter works by taking a suggested completion, say `foo_bar_lol`, split > it up into words - `foo`, `bar, `lol` - and check whether any of the words > start with the same characters as what the user already typed: `fo`, or `bar`, > ... > > In the case of Ruby, though, `:` wasn't considered a word boundary. If the > LSP would return `:foobar` when the user typed `:foo`, we'd check if there are > any completions that match `foo` (because that's the current word) but > we'd compare against `foobar`, not `:` or `:foobar`. > > With this change, we get more match candidates and thus more completions in Ruby. With that we can do (1) because we don't need these characters as word characters anymore to trigger completions. Release Notes: - Fixed word boundaries in Ruby by restoring old behavior (`@`, `:`, ... are no longer considered word characters) ([#9069](https://github.com/zed-industries/zed/issues/9069)) - Fixed completions being filtered out when they happened at word boundaries on special characters (e.g. `:`) --------- Co-authored-by: Max <max@zed.dev>
This commit is contained in:
parent
f2aa183512
commit
b2981f4baa
4 changed files with 19 additions and 26 deletions
|
@ -37,4 +37,3 @@ brackets = [
|
|||
] },
|
||||
]
|
||||
collapsed_placeholder = "# ..."
|
||||
word_characters = ["_", "$", "=", "@", "!", ":", "?"]
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
(comment) @comment
|
||||
(string) @string
|
||||
[(simple_symbol) (delimited_symbol)] @simple_symbol
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue