LazyVim.LazyVim/lua/lazyvim/util
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
..
cmp.lua fix(snippets): fix snippets with multiple placeholders for the same tabstop 2024-05-28 19:32:21 +02:00
extras.lua fix(ui): remove extra space in extras ui (#3481) 2024-06-06 06:09:58 +02:00
format.lua feat: use LazyVim everywhere instead of require("lazyvim.util") 2024-03-22 09:15:09 +01:00
init.lua fix(util): ensure unique cache keys in LazyVim.memoize (#3576) 2024-06-11 06:41:37 +02:00
inject.lua feat(util): set_upvalue 2024-05-16 21:25:51 +02:00
json.lua feat: trouble v3 2024-05-30 14:41:13 +02:00
lazygit.lua feat(git): added leader-gB to browse remotes of the current repo 2024-06-06 10:46:56 +02:00
lsp.lua fix(typescript): implemented move to new file. Fixes #3534 2024-06-08 07:30:49 +02:00
lualine.lua feat(lualine): show readonly icon (#3567) 2024-06-10 22:06:09 +02:00
mini.lua feat(mini.ai): mini.ai is back in core with some improved features. Removing it was a mistake. 2024-05-18 21:53:26 +02:00
news.lua feat: use LazyVim everywhere instead of require("lazyvim.util") 2024-03-22 09:15:09 +01:00
pick.lua feat(extras): added fzf-lua (#3555) 2024-06-10 21:58:33 +02:00
plugin.lua fix(python): removed the python-semshi extra 2024-06-05 11:01:10 +02:00
root.lua feat(extras): added fzf-lua (#3555) 2024-06-10 21:58:33 +02:00
telescope.lua feat(extras): added fzf-lua (#3555) 2024-06-10 21:58:33 +02:00
terminal.lua fix(terminal): make gf behave. Fixes #3335 2024-05-27 17:38:51 +02:00
toggle.lua fix(toggle): slightly better maximize 2024-06-05 07:40:28 +02:00
ui.lua feat(octo): re-open octo windows when restoring session + cleanup 2024-06-09 11:42:58 +02:00