Smit Barmase
06a199da4d
editor: Fix completion accept for optional chaining in Typescript ( #31878 )
...
Closes #31662
Currently, we assume `insert_range` will always end at the cursor and
`replace_range` will also always end after the cursor for calculating
range to replace. This is a particular case for the rust-analyzer, but
not widely true for other language servers.
This PR fixes this assumption, and now `insert_range` and
`replace_range` both can end before cursor.
In this particular case:
```ts
let x: string | undefined;
x.tostˇ // here insert as well as replace range is just "." while new_text is "?.toString()"
```
This change makes it such that if final range to replace ends before
cursor, we extend it till the cursor.
Bonus:
- Improves suffix and subsequence matching to use `label` over
`new_text` as `new_text` can contain end characters like `()` or `$`
which is not visible while accepting the completion.
- Make suffix and subsequence check case insensitive.
- Fixes broken subsequence matching which was not considering the order
of characters while matching subsequence.
Release Notes:
- Fixed an issue where autocompleting optional chaining methods in
TypeScript, such as `x.tostr`, would result in `x?.toString()tostr`
instead of `x?.toString()`.
2025-06-02 10:45:40 +05:30
..
2025-05-29 01:58:40 +00:00
2025-05-30 13:46:41 +00:00
2025-05-30 19:06:08 -03:00
2025-05-22 21:00:54 +00:00
2025-05-16 05:04:36 -04:00
2025-05-20 23:06:07 +00:00
2025-05-30 13:49:09 +00:00
2025-05-21 09:27:54 +00:00
2025-05-26 11:48:50 -04:00
2025-05-28 18:44:49 +00:00
2025-05-30 08:28:22 -07:00
2025-05-26 21:20:41 -03:00
2025-05-28 11:51:21 -04:00
2025-05-20 23:06:07 +00:00
2025-05-30 08:29:52 +00:00
2025-04-02 13:26:34 -07:00
2025-05-27 10:54:42 +02:00
2025-05-30 08:32:54 -07:00
2025-05-26 11:48:50 -04:00
2025-05-26 23:04:31 -04:00
2025-05-26 23:04:31 -04:00
2025-05-20 23:06:07 +00:00
2025-05-26 23:04:31 -04:00
2025-05-04 08:28:39 +00:00
2025-05-31 19:38:32 -04:00
2025-05-26 23:04:31 -04:00
2025-04-02 13:26:34 -07:00
2025-05-26 23:04:31 -04:00
2025-04-02 13:26:34 -07:00
2025-05-14 23:29:11 +02:00
2025-05-26 10:29:45 +02:00
2025-05-30 21:28:31 +02:00
2025-04-02 13:26:34 -07:00
2025-05-30 22:37:40 +00:00
2025-05-30 23:08:41 +02:00
2025-05-20 00:20:00 +00:00
2025-05-22 07:24:46 -04:00
2025-05-14 11:15:27 +02:00
2025-05-30 23:08:41 +02:00
2025-05-20 23:06:07 +00:00
2025-05-26 23:04:31 -04:00
2025-05-27 16:56:03 +00:00
2025-06-02 10:45:40 +05:30
2025-05-29 20:43:12 +00:00
2025-05-26 16:06:38 +02:00
2025-05-26 16:06:38 +02:00
2025-05-20 23:06:07 +00:00
2025-05-26 11:48:50 -04:00
2025-05-29 22:07:34 +00:00
2025-05-17 16:42:45 +00:00
2025-05-23 14:53:53 +00:00
2025-06-01 03:31:38 +00:00
2025-04-02 13:26:34 -07:00
2025-05-20 23:06:07 +00:00
2025-04-02 13:26:34 -07:00
2025-05-12 14:43:14 +00:00
2025-05-26 11:31:25 +00:00
2025-05-20 23:06:07 +00:00
2025-05-29 20:43:12 +00:00
2025-05-07 23:11:09 +03:00
2025-05-27 10:54:42 +02:00
2025-05-30 15:45:03 -07:00
2025-05-26 17:43:57 +00:00
2025-04-02 13:26:34 -07:00
2025-04-02 13:26:34 -07:00
2025-05-20 23:06:07 +00:00
2025-04-02 13:26:34 -07:00
2025-05-30 18:18:23 -03:00
2025-05-20 23:06:07 +00:00
2025-05-20 23:06:07 +00:00
2025-05-20 23:06:07 +00:00
2025-05-27 21:52:42 +00:00
2025-05-26 17:43:57 +00:00
2025-05-20 23:06:07 +00:00
2025-05-17 16:42:45 +00:00
2025-05-17 16:42:45 +00:00
2025-04-23 20:54:09 +00:00
2025-05-29 20:51:20 +00:00
2025-05-08 14:01:39 +02:00
2025-05-29 20:43:12 +00:00
2025-05-29 20:43:12 +00:00
2025-05-20 23:06:07 +00:00
2025-05-27 00:57:45 +03:00
2025-05-30 16:11:13 -04:00
2025-05-20 23:06:07 +00:00
2025-05-20 23:06:07 +00:00
2025-05-26 13:54:17 +02:00
2025-05-26 11:48:50 -04:00
2025-05-29 21:41:15 +00:00
2025-05-30 08:29:52 +00:00
2025-05-20 23:06:07 +00:00
2025-04-29 21:58:45 -03:00
2025-05-30 08:10:12 -03:00
2025-05-22 14:22:35 -04:00
2025-05-28 23:05:06 +00:00
2025-05-21 21:17:14 +03:00
2025-05-14 23:29:11 +02:00
2025-05-30 16:12:39 -04:00
2025-05-26 11:46:35 +00:00
2025-05-26 23:04:31 -04:00
2025-05-26 23:04:31 -04:00
2025-04-02 13:26:34 -07:00
2025-05-27 14:14:25 -04:00
2025-05-29 12:55:47 +00:00
2025-05-20 23:06:07 +00:00
2025-05-30 22:18:32 +02:00
2025-05-26 23:04:31 -04:00
2025-05-26 23:04:31 -04:00
2025-05-20 23:06:07 +00:00
2025-05-26 22:19:02 +03:00
2025-05-29 09:24:39 +05:30
2025-05-26 17:43:57 +00:00
2025-05-23 14:53:53 +00:00
2025-05-27 16:56:27 +00:00
2025-05-27 23:01:31 +00:00
2025-05-29 22:07:34 +00:00
2025-05-20 23:06:07 +00:00
2025-04-02 13:26:34 -07:00
2025-05-26 11:48:50 -04:00
2025-05-26 11:48:50 -04:00
2025-05-29 20:43:12 +00:00
2025-04-02 13:26:34 -07:00
2025-05-26 23:04:31 -04:00
2025-05-29 20:43:12 +00:00
2025-05-20 23:06:07 +00:00
2025-04-25 17:41:49 +03:00
2025-05-27 14:14:25 -04:00
2025-05-27 14:14:25 -04:00
2025-05-20 23:06:07 +00:00
2025-05-26 23:04:31 -04:00
2025-05-26 13:44:09 +00:00
2025-05-20 23:06:07 +00:00
2025-04-02 13:26:34 -07:00
2025-05-16 17:35:44 +02:00
2025-05-20 23:06:07 +00:00
2025-05-01 17:37:43 +02:00
2025-05-26 11:48:50 -04:00
2025-04-02 13:26:34 -07:00
2025-05-23 20:45:32 +00:00
2025-05-29 16:09:07 +00:00
2025-05-30 14:32:59 +02:00
2025-05-30 19:28:56 +00:00
2025-04-02 13:26:34 -07:00
2025-04-21 21:30:21 -07:00
2025-05-23 14:28:53 +03:00
2025-05-31 20:02:56 +03:00
2025-05-28 12:32:54 +00:00
2025-05-26 18:23:41 +00:00
2025-04-02 13:26:34 -07:00
2025-05-26 18:23:41 +00:00
2025-05-30 20:37:38 +00:00
2025-05-06 10:18:48 +00:00
2025-05-30 17:13:50 +00:00
2025-05-26 23:04:31 -04:00
2025-05-29 21:41:15 +00:00
2025-05-14 23:29:11 +02:00
2025-05-23 19:31:25 +00:00
2025-05-30 15:26:27 +00:00
2025-05-28 10:16:34 -04:00
2025-05-01 19:24:14 +00:00
2025-05-28 06:30:51 +05:30
2025-04-23 20:54:09 +00:00
2025-04-23 15:30:20 +00:00
2025-05-20 23:06:07 +00:00
2025-05-29 15:20:58 -04:00
2025-06-01 19:50:06 -04:00
2025-05-26 23:04:31 -04:00
2025-06-01 03:31:38 +00:00
2025-05-26 19:40:07 +00:00
2025-05-26 11:48:50 -04:00
2025-05-26 11:48:50 -04:00
2025-04-23 20:54:09 +00:00