# supermaven: Improve completion caching and position validation \(\#37047\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/fcc3d1092fc2c0323d6f06e93e06c5ed8fad2c0e)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: fcc3d1092fc2c0323d6f06e93e06c5ed8fad2c0e

Requested commit: fcc3d1092fc2c0323d6f06e93e06c5ed8fad2c0e

Commit: fcc3d1092fc2c0323d6f06e93e06c5ed8fad2c0e

Tree: b7612c5f5a12f1d524778a4a3af7a273e213db7d

Author: Raphael Lüthy

Committer: GitHub

## Message

```
supermaven: Improve completion caching and position validation (#37047)

Closes #36981 

- Add completion text and position caching to reduce redundant API calls
- Only trigger new completion requests on text changes, not cursor
movement
- Validate cursor position to ensure completions show at correct
location
- Improve end-of-line range calculation for more accurate deletions
- Extract reset_completion_cache helper for cleaner code organization
- Update completion diff algorithm documentation for clarity

Edit: Sorry this is the 2nd PR, I forgot that the forks history was
messy; I cherrypicked and cleaned it properly with this PR

Release Notes:

- supermaven: Improved caching of predictions
- supermaven: Fixed an issue where changing cursor position would
incorrectly trigger new completions
```

## Parents

- [a790e514af4d6957aa1a14cc8190b2ff24a0484c](https://git.cafe/gitcafe/zed/commit/a790e514af4d6957aa1a14cc8190b2ff24a0484c?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/fcc3d1092fc2c0323d6f06e93e06c5ed8fad2c0e?format=markdown)
