LazyVim.LazyVim/lua/lazyvim
Aofei Sheng 335487282a
fix(util): ensure unique cache keys in LazyVim.memoize (#3576)
## What is this PR for?

This PR fixes a bug in the `LazyVim.memoize` function that was causing
unexpected behavior in my configuration. The issue was discovered when
setting `vim.g.lazyvim_prettier_needs_config = true` in my
`lua/config/options.lua`, which did not work as expected.

The root cause was an issue with `LazyVim.memoize` cache key generation,
which led to `M.has_config(ctx)` always returning the same result as
`M.has_parser(ctx)`. This happened because `LazyVim.memoize` generates
cache keys based on the function parameters, and both functions were
being called with identical parameters:


7d30360df2/lua/lazyvim/plugins/extras/formatting/prettier.lua (L77-L81)

By improving the cache key generation to include function information,
we can ensure unique keys for different functions even if their
parameters are identical, thereby fixing the issue.

## Does this PR fix an existing issue?

N/A

## Checklist

- [x] I've read the
[CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md)
guidelines.
2024-06-11 06:41:37 +02:00
..
config fix: removed leader-m, since it is leading to too many issues. Still available at leader-wm 2024-06-07 10:53:56 +02:00
plugins refactor: config = true >> opts = {} 2024-06-11 00:06:56 +02:00
util fix(util): ensure unique cache keys in LazyVim.memoize (#3576) 2024-06-11 06:41:37 +02:00
health.lua fix(health): add warning when not using 0.10.0 2024-05-16 21:25:51 +02:00
init.lua fix: add shim for vim.uv just in case someone upgrades lazyvim before lazy 2024-03-22 10:30:35 +01:00
types.lua style: better types for vim.api.nvim_create_autocmd 2024-06-07 23:02:47 +02:00