-
Notifications
You must be signed in to change notification settings - Fork 70
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
WIP: Scala 3 #170
base: master
Are you sure you want to change the base?
WIP: Scala 3 #170
Conversation
Would be nice |
@cchantep yep, I'm working on it as I get time. Good news is if you use mostly the old syntax for now, the mode is up to date enough to be reasonable to use with Scala 3. It's going to be a while before there is a lot of code on newly converted codebases that is thoroughly embracing Scala 3 idioms. Hopefully by then I will have this done. My team is going to adopt quickly, so I will have incentive. |
I haven't been able to find exactly when it was dropped but it seems to have actually been during Scala 2.
Ah yes, I discovered that it is a Flycheck acting as a minor mode. The question is, where is Flycheck getting its syntactic knowledge? |
Ah, it is getting it from |
You can run the compiler with |
@smarter ah, thank you. BTW enjoyed hearing from you at the release party just now. |
@smarter for further context, I have hit this problem not just with Flycheck but also with using Scala 3 in Org Babel. I looked for a color option, but couldn't find it. Maybe it isn't documented? Maybe I'm bad at finding things. It wouldn't be the first time. |
I have to tear down first, before I can rebuild. 20% of the algorithm gets us 80% of the way there for braces. This totally breaks whitespace again, but it wasn't _really_ working with what I had before, and it will be much easier to get it working once we get a bunch of stuff out of the way. So many concepts of have shifted, and it's just too hard to read Emacs-style code which is not declarative. More tearing down may come after this.
I don't know if this is the right place for this comment, but here goes: Indentation with quiet syntax is currently unusable.
Hitting Enter where indicated results in
Sure, that's correctly formatted, but not the user's intent. The first rule ought to be "do no harm". If a user indented a line and then hits Enter, don't mess with the preceding line. The next line should have the same indent or one more (after def, if, class, etc.)
The Tab key should cycle through the valid indentations, like the Python mode does. It should be easy enough to find the number of valid indentations--either the same as the preceding line, or one more. |
@cayhorstmann is this comment in relation to the WIP scala3 changes or also applicable to the scala2 mode? |
In Scala 2, both Enter and Tab work as expected. I just checked with a Scala 2 project. The issue is the quiet (brace-free) syntax, which changes how Tab must work. |
@cayhorstmann yeah, this work is severely incomplete, and was interrupted for some time while I did not have access to a second monitor. I hope to pick it up again soon, but no promises on when I can get it finished; I have found it challenging, and we are not moving to 3 as rapidly as I had expected at work, so the push isn't as hard as I expected. |
I don't know. This is rather overwhelming. |
How far back, in general, should I look in order to correct indentation? If I have |
I see it! I'll get to it tonight after work.
Jack Viers - 515.313.7838 ***@***.***
…On Wed, May 18, 2022, 11:02 AM Keith Pinson ***@***.***> wrote:
@jackcviers <https://github.com/jackcviers> ☝️ No rush, but want to make
sure you see the CLA message above.
—
Reply to this email directly, view it on GitHub
<#170 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFBHFGWM3MK2PXAUI2CT4DVKUH7XANCNFSM42I5RXGA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Incorrect order of arguments causes wrong type argument error in scala-indent:indent-line. Swapping argument order fixes the error reported by @jj1uzh [here](#1 (comment)).
Fixes incorrect argument order in call-interactively
They are all the same committed. I'll see if I can find the commit without an email address.... |
PR fixing missing email address in commit: Kazark#3 |
Oh why is this still blocked... |
@VitalyAnkh All the codebases I worked on (except breakable toys) are stuck on Scala 2 until, at a minimum, this gets fixed. As such, my motivation to work on this has stalled. If any wants to contribute, I'm happy to rebase the branch to get rid of the committer problem above, and open the branch for others to edit. You can also use what I've got so far (which is okay, but imperfect) but just downloading this branch and manually loading this version of the package. |
I'd be happy to pick up the remaining work on this. I used Emacs Lisp only for my personal configuration before, but I have some free time to spend on this during the next few weeks. |
@maemre would you want to have a video call to hand stuff off? I don't know whether you will find my approach intelligible or not just reading the code. |
@Kazark That'd be great! I can go through the code over the weekend and we can have a quick chat next week, if that sounds good. For scheduling the chat, my email address is maemre2 at gmail dot com |
I edited my last comment because my email address wasn't formatted properly. |
Noted. I have an exceedingly busy week ahead---I'll hope to drop you a line next week. |
Hi! Just a kind reminder: how are things going now? |
@VitalyAnkh thanks for the reminder, this completely fell through the cracks because I haven't been using Scala for the past few months. @Kazark would you be free sometime this week or next week to meet up? I am looking at the code base again, and some functions like Also, from what I understand pretty much everything is implemented behind the custom variable I can try some git cherry-picking and re-implement the cycling feature that commit describes, then I think this should be good for a merge. @Kazark how does that sound? |
No, that part should be relatively easy to fix, I think. The main issue with merging is that this is still in a highly experimental state. I have been steadily using this branch locally for as long as it has existed, but I haven't written any Scala 3 beyond toys. |
The last time I had my head really into this, there were definitely some cases that didn't work right. Ultimately it is up to @hvesalai ; we could just plunge in & patch; but from my point of view, this is not stable yet. |
Also @rossabaker was wondering whether we might be able to replace some of this haphazardness with Treesitter. |
@maemre I might be able to do something on Friday; otherwise my week is pretty full. Did you get my email of few months back, or did it perhaps go to your spam folder? Just asking so we can coordinate further over email. |
I have been using it, and it still fails to cycle a lot. If someone has
some time this week to pair, I'd appreciate it.
Jack Viers - 515.313.7838 ***@***.***
…On Tue, Mar 14, 2023, 8:08 AM Keith Pinson ***@***.***> wrote:
would you be free sometime this week or next week to meet up?
@maemre <https://github.com/maemre> I might be able to do something on
Friday; otherwise my week is pretty full. Did you get my email of few
months back, or did it perhaps go to your spam folder? Just asking so we
can coordinate further over email.
—
Reply to this email directly, view it on GitHub
<#170 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFBHFA2VWTATTCOE25ZQX3W4BUWNANCNFSM42I5RXGA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I see. I'd be interested in debugging it then. I'll set it up locally and see if I hit any bugs myself. @Kazark I found your email, and replied to it for scheduling. |
In Scala 3, `do-while` is dropped, and `do` is used only for separating the body of a `while` or `for` from the guard/comprehension. So, `do` would need to be indented like `then` or `else`. See: https://docs.scala-lang.org/scala3/reference/dropped-features/do-while.html#
This allows differentiating between indenting a blank line and re-indenting the line before it. This situation occurs fairly often: it happens every time the user hits re turn to create a new line, which calls indentation function on the previous line and the newly created line separately. Before this fix, these two calls would incorrectly calculate the same indentation level, e.g. when the previous line just created a block.
Various indentation fixes: typos, differentiating new lines, support for `do` and `extension`
Hello. I was hoping to use scala-mode and metals for scala 3 work using python-style identation. Is there any update on this PR? Or some other way people get that working? |
Putting this here in case anyone wants to follow my progress and comment or critique.