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

add support for path references #90

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

0xcaff
Copy link

@0xcaff 0xcaff commented Dec 8, 2024

This PR adds go to declaration for nix path references.

Screen.Recording.2024-12-07.at.8.00.34.PM.mov

I've kept it as simple as possible. It only supports stdpaths and not lookup paths. References are resolved following a simple set of rules.

fun resolvePath(fs: VirtualFileSystem, cwd: String, target: String): VirtualFile? {
val resolved = FileUtil.join(cwd, target)
val resolvedFile = fs.findFileByPath(resolved) ?: return null
if (resolvedFile.isDirectory) {
return resolvedFile.findChild("default.nix")
}
return resolvedFile
}

I spend hours a day reading nix files in IJ and this plugin is an important part of making this bearable. Thanks for making this, its really nice.

this is going to make my life suck significantly less

need to fix
* slurp up channel usages and flake inputs at index time and add as external library roots
* probably worthwhile to embed nix binaries into the ide plugin
file if first class primitive, directory is not
nix repl isn't in the ij sandbox path, avoid using it and instead do the path handling in band

this breaks handling of channel paths like <nixpkgs> but i don't care about those, would rather have something stable than something complete (also i only care about flakes)
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.

1 participant