Skip to content

plugins/lsp: correct motivation for onAttach alias impl #3297

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

MattSturgeon
Copy link
Member

@MattSturgeon MattSturgeon commented May 8, 2025

This PR has no code changes, but it corrects an incorrect and misleading comment in #3295.

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 reads the "to" option's value, which would be 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.

@MattSturgeon MattSturgeon requested a review from a team May 8, 2025 01:45
Copy link
Member

@GaetanLepage GaetanLepage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

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.
@MattSturgeon MattSturgeon force-pushed the plugins/lsp-on-attach-comment branch from f602cea to 10f899d Compare May 8, 2025 14:51
@MattSturgeon

This comment was marked as resolved.

This comment was marked as resolved.

Copy link
Contributor

mergify bot commented May 8, 2025

This pull request, with head sha 10f899d669659f0248b9c9768bd2fd06eaa8d3b1, has been successfully merged with fast-forward by Mergify.

This pull request will be automatically closed by GitHub.

As soon as GitHub detects that the sha 10f899d669659f0248b9c9768bd2fd06eaa8d3b1 is part of the main branch, it will mark this pull request as merged.

It is possible for this pull request to remain open if this detection does not happen, this usually happens when a force-push is done on this branch plugins/lsp-on-attach-comment, this means GitHub will fail to detect the merge.

@mergify mergify bot merged commit 10f899d into nix-community:main May 8, 2025
4 checks passed
@mergify mergify bot temporarily deployed to github-pages May 8, 2025 14:57 Inactive
@MattSturgeon MattSturgeon deleted the plugins/lsp-on-attach-comment branch May 8, 2025 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants