Repository navigation
Conversation
this adds folding. makes it much easier to read large blocks of nix code. todo: * use customfoldingbuilder maybe?
# Conflicts: # src/main/resources/META-INF/plugin.xml
There was a problem hiding this comment.
Thanks for your contribution. Here is my review so far. I haven't tried whether it actually works, but it looks simple enough. Of course, tests would always be nice, but doesn't seem necessary in this case. Not sure if there is anything which could be tested reasonably, besides verifying that we don't throw any runtime exception.
| } | ||
|
|
||
| override fun visitFile(file: PsiFile) { | ||
| super.visitFile(file) |
There was a problem hiding this comment.
question (non-blocking): Why are you calling the super-method here, and only here? The super method doesn't seem to do anything important.
| } | ||
|
|
||
| override fun visitExprIf(o: NixExprIf) { | ||
| o.acceptChildren(this) |
There was a problem hiding this comment.
suggestion: You could override visitElement(PsiElement) with o.acceptChildren(this). Then you can remove all the other methods that do nothing but delegating to the children.
There are also various method which only delegate to children using element-specific code. Like visitExprWith, which just calls o.exprList.forEach { it.accept(this) }. Is there a good reason for that? Otherwise, you could just remove them after overriding visitElement.
| return descriptors.toArray(FoldingDescriptor.EMPTY_ARRAY) | ||
| } | ||
|
|
||
| override fun getPlaceholderText(node: ASTNode): String? = |
There was a problem hiding this comment.
thought: Looks like you could provide the placeholder text and whether the region is collapsed by default to the constructor of FoldingDescriptor. It looks like in this case, getPlaceholderText and isCollapsedByDefault could just throw an UnsupportedOperationException or trigger an assertion.
What is the advantage? |
|
@0xcaff are ye still working on this? Edit: just compiled and installed yer changes and holy fuck, that makes such a difference, especially on really long files |
|
No have my forked version setup with folding tbh forgot to upstream. Please someone take over |
|
I might, but I havent worked with kotlin before (or jetbrains plugins) |
this adds folding. makes it much easier to read large blocks of nix code.
todo: