Re: [scala-ide-user] scala-ide not formatting source

220 views
Skip to first unread message

Simon Schäfer

unread,
May 23, 2013, 5:20:29 PM5/23/13
to scala-i...@googlegroups.com
Hi Colin,

I'm not aware that there are any limitations on the formatting feature,
thus I would it is a bug. Some days ago there is a bug reported that
said that formatting doesn't work if a source file contains a case-block
that doesn't have whitespace between the expression and the => keyword:
"case x=>"

You can try to find such places in your source file. If you don't have
them, then you may stumbled on another bug. You can try to find it by
partially commenting out or deleting of parts of your files. If
formatting then works, you have found the place of code the formatter
doesn't like. In that case we would be thankful if you could report is
as bug.

Simon

On 05/23/2013 10:32 PM, Colin Bester wrote:
> I am (and have been for awhile) using Eclipse Juno with Scala-Ide 3
> (from http://download.scala-ide.org/sdk/e38/scala210/stable/site) and
> scala 2.10 and am developing on a mac.
>
> I have a project with numerous files but two of them will not format
> no matter what I try. I have even tried cutting text, placing into a
> pure text editor saving this and pulling it back in to my scala source
> file.
>
> Other scala files format fine. I am not a heavy user of the scala
> formatter, but in this instance (and it just so happens for these two
> files) I have done a ton of refactoring and need to clean it up.
>
> I am working in the scala perspective as well.
>
> Any ideas on what the issue could be - is there a limit on size of
> file for formatting?
>
> Error log shows no error when I try and format the file.
>
> Suggestions appreciated.
>
> Colin
> --
> You received this message because you are subscribed to the Google
> Groups "Scala IDE User" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to scala-ide-use...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

iulian dragos

unread,
May 24, 2013, 5:40:23 AM5/24/13
to scala-i...@googlegroups.com
One known limitation is that the formatter expects syntactically correct code (type errors are handled, though).

iulian


To unsubscribe from this group and stop receiving emails from it, send an email to scala-ide-user+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.


--
You received this message because you are subscribed to the Google Groups "Scala IDE User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-ide-user+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.





--
« Je déteste la montagne, ça cache le paysage »
Alphonse Allais

Colin Bester

unread,
May 24, 2013, 7:37:16 AM5/24/13
to scala-i...@googlegroups.com
Thanks, I will try and comment out sections of code and test.

Code is functional and syntactically correct so I know this is not the issue.

Will let you know.

~C

Colin Bester

unread,
May 24, 2013, 8:08:45 AM5/24/13
to scala-i...@googlegroups.com
Okay, what I have found is that the code reduced to 
package colin.test

  class Test {
    private var requires = ""
  private var promised = ""
    private var make = ""
  private var model = ""
  private var serial = ""
  private var note = ""
  private var completed: Int = 0
}

does not format. Note the var "requires" with a 's'

Changing this var to anything else including require (no 's') and code formats fine.

I assume require is still a scala keyword but as far as I know requires is not a keyword and I could well be wrong.

I thought I'd post this finding before assuming a bug.

~C

On Thursday, May 23, 2013 4:20:29 PM UTC-5, Simon Schäfer wrote:

iulian dragos

unread,
May 24, 2013, 8:35:46 AM5/24/13
to scala-i...@googlegroups.com
On Fri, May 24, 2013 at 2:08 PM, Colin Bester <bester...@gmail.com> wrote:
Okay, what I have found is that the code reduced to 
package colin.test

  class Test {
    private var requires = ""
  private var promised = ""
    private var make = ""
  private var model = ""
  private var serial = ""
  private var note = ""
  private var completed: Int = 0
}

does not format. Note the var "requires" with a 's'

Changing this var to anything else including require (no 's') and code formats fine.

I assume require is still a scala keyword but as far as I know requires is not a keyword and I could well be wrong.

I thought I'd post this finding before assuming a bug.

Excellent finding! requires used to be a keyword in Scala, until around version 2.4. It seems scalariform still considers it a keyword, (and considers it to be a syntax error).

Could you please open a ticket on https://github.com/mdr/scalariform?

thanks,
iulian
Reply all
Reply to author
Forward
0 new messages