Skip to content

Commit

Permalink
ws before
Browse files Browse the repository at this point in the history
  • Loading branch information
ms-jpq committed Dec 6, 2024
1 parent 3c9362e commit 976012b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion coq/clients/cache/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class _CacheCtx:
col: int
syms_before: str
words_before: str
ws_before: str


def _use_cache(match: MatchOptions, cache: _CacheCtx, ctx: Context) -> bool:
Expand All @@ -47,7 +48,7 @@ def _use_cache(match: MatchOptions, cache: _CacheCtx, ctx: Context) -> bool:
and cache.commit_id == ctx.commit_id
and ctx.buf_id == cache.buf_id
and row == cache.row
and bool(cache.words_before) == bool(ctx.words_before)
and (bool(cache.words_before) == bool(ctx.words_before) or bool(cache.ws_before))
and multi_set_ratio(
ctx.syms_before, cache.syms_before, look_ahead=match.look_ahead
)
Expand Down Expand Up @@ -91,6 +92,7 @@ def __init__(self, supervisor: Supervisor) -> None:
col=-1,
syms_before="",
words_before="",
ws_before=""
)
self._clients: MutableSet[str] = set()
self._cached: MutableMapping[bytes, Completion] = {}
Expand Down Expand Up @@ -141,6 +143,7 @@ def apply_cache(
col=col,
syms_before=context.syms_before,
words_before=context.words_before,
ws_before=context.ws_before
)

use_cache = _use_cache(
Expand Down

0 comments on commit 976012b

Please sign in to comment.