zed icon indicating copy to clipboard operation
zed copied to clipboard

Kotlin curly braces do not auto-close

Open spaceunifyfifty opened this issue 1 year ago • 6 comments

Check for existing issues

  • [X] Completed

Describe the bug / provide steps to reproduce it

I have in my settings

"Kotlin": {
    "auto_close": true
}

but still whenever I type in a .kt file fun main() { and press enter, it does not automatically insert a closing }. It does however do this with parentheses.

Environment

Zed: v0.125.3 (Zed) OS: macOS 14.2.1 Memory: 8 GiB Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

No response

spaceunifyfifty avatar Apr 18 '24 09:04 spaceunifyfifty

That's a bug in Kotlin extension then; basically, we need to add more brackets into this array in config.toml.

osiewicz avatar Apr 18 '24 09:04 osiewicz

That's a bug in Kotlin extension then; basically, we need to add more brackets into this array in config.toml.

That looks pretty simple. Should I submit a pull request for the addition to that file?

spaceunifyfifty avatar Apr 18 '24 10:04 spaceunifyfifty

Yeah, the change itself is simple, though that repository seems to be unmaintained per this comment. I've pinged folks from my team to see what we can do about it.

osiewicz avatar Apr 18 '24 10:04 osiewicz

So the pull request was merged into the kotlin extension https://github.com/zed-extensions/zed-kotlin/pull/2 but it doesn't look like that has made it into Zed itself yet. Just ran brew upgrade zed and tried it out, still no auto-close behavior (and the Kotlin extension says v0.0.1) What is the process for getting the newest version of an extension into Zed?

edit: found the instructions. Trying to test the updated extension locally before submitting a PR for it in /extensions. If anyone could help me figure that out getting local testing working properly at a discussion I made https://github.com/zed-industries/zed/discussions/10834

spaceunifyfifty avatar Apr 22 '24 06:04 spaceunifyfifty

Oh, right, we need to cut a new release of Kotlin extension. I'll do that in a sec

osiewicz avatar Apr 22 '24 10:04 osiewicz

Auto-closing is working now, but the newline + automatic indentation behavior is not quite right yet. https://github.com/zed-extensions/zed-kotlin/pull/2#issuecomment-2069905683

spaceunifyfifty avatar Apr 22 '24 15:04 spaceunifyfifty

While more work needs to be done to get newline + automatic indentation, this particular issue was solved with commit https://github.com/zed-extensions/zed-kotlin/commit/e175918c3de463040b025fa7059a33993bd0fdcf.

Opened dedicated issue https://github.com/zed-extensions/zed-kotlin/issues/5 for newline + automatic indentation

spaceunifyfifty avatar Apr 24 '24 14:04 spaceunifyfifty