mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 16:39:00 +02:00
plugins/lsp: correct motivation for onAttach
alias impl
Previously I said we alias the definitions instead of the value to allow `mkOrder` to work correctly. That is incorrect, as order-priorities are already sorted in `<opt>.definitions`. The actual reason to use the definitions instead of the final value is to avoid inf-recursion. The "from" option's `apply` function would read the "to" option's value, which is defined based on the "from" option's value, which is set by the "from" option's apply function... For a one-way binding, `mkDerivedConfig` is best. For a two-way binding, `mkAliasAndWrapDefsWithPriority` is necessary.
This commit is contained in:
parent
5fed6b9363
commit
10f899d669
1 changed files with 3 additions and 9 deletions
|
@ -182,15 +182,9 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
||||||
# `mkAliasAndWrapDefinitions` and `mkAliasAndWrapDefsWithPriority` propagates the un-merged
|
# `mkAliasAndWrapDefinitions` and `mkAliasAndWrapDefsWithPriority` propagates the un-merged
|
||||||
# `definitions`.
|
# `definitions`.
|
||||||
#
|
#
|
||||||
# This assumes both options have compatible merge functions, but it allows override and order
|
# This assumes both options have compatible merge functions, but not using the final value allows
|
||||||
# priorities to be merged correctly.
|
# implementing a two-way binding in the option's `apply` function. Using `mkDerivedConfig` for a
|
||||||
#
|
# two-way binding would result in infinite recursion.
|
||||||
# E.g:
|
|
||||||
# lsp.onAttach = mkAfter "world";
|
|
||||||
# plugins.lsp.onAttach = mkBefore "hello"
|
|
||||||
# ⇒
|
|
||||||
# hello
|
|
||||||
# world
|
|
||||||
#
|
#
|
||||||
# This is equivalent to `mkAliasOptionModule`, except predicated on `plugins.lsp.enable`.
|
# This is equivalent to `mkAliasOptionModule`, except predicated on `plugins.lsp.enable`.
|
||||||
#
|
#
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue