If your interested in building your knowledge on functional programming for ‘Kotlin’: I am working my way through the below book, its on my preferred list of reads for the topic.
The authors last and final outstanding task for this book is: ‘Appendix E: Type Classes’.
You can purchase the book with all the available chapters and come back for the last ‘Appendix E’ later for free. Also for free is the books Github repository for you to work and play with kotlin code examples from the authors (see the above book reference for details).
I have no affiliations with either Manning Publications or Github. Bye
Hi yerlaser,
I set up mawww’s pedantic branch (mpb) to make things easier in regards to latest #4112 feedback. Grab it on: git clone --branch mpb --depth 1 https://bitbucket.org/KJ_Duncan/kakoune-kotlin.kak.git
Mate can do this trick again for us as you know it best. I will copy and paste those changes back into mpb for the next go round.
Wow, I was about (somewhat reluctantly) to look into this myself, knowing that it would be difficult as hell to understand and correct somebody else’s code, but, here you go, as if you listen to me
Thanks a lot!
I’ll update the file and will let you know.
Regarding “pedantic”, he is the author and I understand he only wants good code to go in since he will mostly also maintain it.
Hey man, congratulations!
The commit was merged, so, hopefully, next version will have kotlin support built-in.
Let’s hope the bits that you’ve written will serve people!
By the way, if you want to maintain your copy on bitbucket, would be good if you copy the file from github. The only change is removal of kotlin_ prefix from lines already containing kotlin/ in the path. But, that will make futher contributions easier.
I have a question.
Today I tried to set my indent level to two spaces.
However, with Kotlin files it still indents with four spaces (e.g. after opening brace)
I looked through the code and I couldn’t find where the number of indent spaces is getting set.
Can you advise?
Note that Kakoune has two separate indentation-related options: tabstop tells Kakoune how wide actual tab characters should be drawn, while indentwidth describes how many spaces should be inserted by indentation commands like < and > (0 means “use a tab instead of spaces”).
If you’ve set tabstop to 2, that generally won’t affect auto-ident hooks, since they typically use < and > to change indentation.
Thanks for the suggestion. Unfortunately, it doesn’t apply to my case.
I have both options set to 2 spaces.
And it works in all other languages.
So, something in the new kotlin.kak file which I can’t figure out.
Hey buddy, nice work on getting kolin.kak into the wider community.
Why would I not? I’ll put it down to a self doubting day.
Your kotlin.kak-patch-1 was awesome! It got my butt in gear and made some changes at Bitbucket check it out as it may give you some more ideas to play with as your kotlin.kak-patch-1 did for me.
Try this: comment out all changes to any preference in spaces and tabs. Then use a single source of truth https://editorconfig.org/ for your file-type preferences.
Glad you’re back!
Yeah, I have pinpointed that tabulation error to dev version of Kakoune that I compiled on Ubuntu. I am currently on Fedora and on stable version and thus don’t have that problem any more. We’ll look into that later.
And, regarding that comment about listening, that was when maww requested changes and at that time I was nervous and ashamed that I couldn’t fix myself. So, your fixes came just in time and were big relief.
Since then I think I understand better the syntax of kakoune highlighters.
That’s very cool, let me compile those binaries and I’ll try.
I might even think about merging those into a single executable with the methods being supplied as an argument.
Hey all, I worked out how to do function indentation correctly. It will indent the next successive line for function continuation and de-dent the following line if no text was on the previous line.
fun hello() =
<space><space>\n
no indentation here as previous line contains no text
fun hello(): String = "hi"
<space><space>\n
fun noIndent(): Int = 1
try %< execute-keys -draft k <a-x> <a-k>^\h*?(?:\b(private|public|protected|internal)\b)?\h*?(?:\b(tailrec|inline|infix|operator|external|suspend)\b)?\h*?\b(fun|where)\b[\S\s]*?$ <ret> j<a-gt>
> catch %<
execute-keys -draft JK <a-&>
>
Also realised I forgot kotlin keywords on kakoune static word completion list this is now fixed.
Haha Cool, glad you’re on Git as well. I am sure you won’t regret as there are so many projects. I am more DevOps, but, will have a look at your suggestions. This whole thingy about big-data, AI, ML etc. becomes too big to ignore.