Skip to content
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

goto definition for nixos options #265

Closed
Tracked by #421
lf- opened this issue Sep 30, 2023 · 4 comments · Fixed by #433
Closed
Tracked by #421

goto definition for nixos options #265

lf- opened this issue Sep 30, 2023 · 4 comments · Fixed by #433
Labels
enhancement New feature or request

Comments

@lf-
Copy link

lf- commented Sep 30, 2023

Since my PR NixOS/nixpkgs#249243 has been merged, we have non-garbage character level position information for about 90% of nixos options available under options.OPTION.declarationPositions, in the format of unsafeGetAttrPos.

This could, at least theoretically, form the basis of goto definition on nixos options. I expect this may have similar challenges to implement as #174, namely, figuring out what the actual option name is, but once those are resolved, this should be very possible.

@inclyc
Copy link
Member

inclyc commented Oct 1, 2023

This is already implemented in #93 ?

@lf-
Copy link
Author

lf- commented Oct 1, 2023

Yes, you're right; I missed that one. I think you may be able to use the declarationPositions attribute for a more direct way of getting to the attribute location which would be more reliable in certain cases (but falls over in different cases).

@inclyc inclyc added the enhancement New feature or request label Oct 16, 2023
@inclyc
Copy link
Member

inclyc commented Oct 18, 2023

we have non-garbage character level position information for about 90% of nixos options available under options.OPTION.declarationPositions, in the format of unsafeGetAttrPos.

I just carefully read your PR looks like we can have line & column information by eval declarationPositions, and might be a preferred way to answer LSP requests.

This could, at least theoretically, form the basis of goto definition on nixos options. I expect this may have similar challenges to implement as #174,

The real challenge about options is, we cannot easily find out the attrpath where the user clicked. For now we have a slightly modified parser on the main branch, but that discards necessary information after parsing (that's why we have #257 and cannot be trivially merged).

@inclyc inclyc linked a pull request Apr 15, 2024 that will close this issue
@inclyc inclyc removed a link to a pull request Apr 15, 2024
@inclyc inclyc mentioned this issue Apr 19, 2024
9 tasks
inclyc added a commit that referenced this issue Apr 19, 2024
inclyc added a commit that referenced this issue Apr 19, 2024
@inclyc
Copy link
Member

inclyc commented Apr 19, 2024

This feature gets implemented in #433.

@lf-

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants