- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Re: Emacs - Maven and SBT support for Scala Mode
Wed, 2009-07-29, 02:03
I've created a Wiki page on how to put together a nice suite of capability for Emacs based Scala development.
http://scala.sygneca.com//tools/emacs
Its minimal. Just ask questions or catch me on #scala.
Ray
On Tue, Jul 28, 2009 at 5:38 PM, Meredith Gregory <lgreg.meredith@gmail.com> wrote:
http://scala.sygneca.com//tools/emacs
Its minimal. Just ask questions or catch me on #scala.
Ray
On Tue, Jul 28, 2009 at 5:38 PM, Meredith Gregory <lgreg.meredith@gmail.com> wrote:
Ray,
Please post to the list. i'm very interested in seeing how this works and don't mind too much set up pain.
Best wishes,
--greg
On Tue, Jul 28, 2009 at 2:36 PM, Ricky Clarkson <ricky.clarkson@gmail.com> wrote:
Do you have a set of instructions for setting this up? I don't mind
having to grab a load of .el files for now if need be.
2009/7/28 Ray Racine <ray.racine@gmail.com>:
> Hi to the SCALA Emacs mode maintainer(s) at Scala Central (EPFL).
>
> I've managed create the rudiments of a fairly decent Emacs based IDE for
> Scala.
>
> http://imagebin.ca/view/BObUKpq.html
>
> I'm trying to get all the pieces added to where I think are appropriate
> places as "contrib". The idea is to avoid have to grab lots of little elisp
> files from all over the place. I'm been successful in getting Scala
> support directly added to the CEDET project for example.
>
> I have 2 orphaned pieces of code left in search of a home. One deals with
> compiling and building Scala projects/code with SBT and the other via
> Maven. I'd like to get them added as part of the standard Scala mode in the
> contrib section if possible.
>
> What say you, yea or nay? No problem if you'd like to the keep the current
> scala-tools/scala-mode stuff clean with "just editing mode" stuff.
>
> Thanks,
>
> Ray
>
--
Ricky Clarkson
Java Programmer, AD Holdings
+44 1565 770804
Skype: ricky_clarkson
Google Talk: ricky.clarkson@gmail.com
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
1219 NW 83rd St
Seattle, WA 98117
+1 206.650.3740
http://biosimilarity.blogspot.com
Fri, 2009-07-31, 04:07
#2
Re: Emacs - Maven and SBT support for Scala Mode
With regard to picking up new methods in the source code.
M-x semantic-idle-scheduler-mode If enabled, when emacs is idle, will re-parse your file picking up any new methods.
I've only invested a 2-3 weekend mornings and a few post-dinner hours in getting this far. I think its pretty nice that for ~15-20 hours investment I was able to get a system that's not too far behind some of the other options out there. :) This also means I only have a few days practice playing with all this myself.
Another nice thing to try is M-x ecb-toggle-compile-window to bring up dedicated compiler window at the bottom.
Then, when one you are editing a Scala file, launch SBT with M-x sbt-shell.
Then I like to enable SBT's incremental compiling mode.
> ~ compile
Now when you edit your Scala code, pause and save the file, ecb will re-parse and SBT will re-compile giving you navigable errors (same for test failures). Use C-c . / to toggle the compile window bigger and back.
Using CTags to parse the Scala code provided some very nice bang for the buck for little time investment. I had never used CEDET or ECB before and did not know what to expect, but am now impressed.
Better parsing is the key and necessary to take it to the next level. I've been thinking and poking around a bit. Here is where I am at.
I'm sure I can improve the ctags based parsing to grab method args. But ctags will always be less than perfect. Trying to encode the Scala grammer using CEDET's Bison grammer would be a big job and difficult. For example, Scala's implied semi-colon inferencing alone would make the lexing tough and I don't know how flexible CEDET's parser code is to deal with it.
On the other hand, we don't need to parse everything, just key tags, such as trait, class, object, def. val, var, arg lists etc... Writing a sufficiently "smart" syntax source code scanner seems very feasible to pull off. My elisp experience is limited but my Scheme-fu is pretty solid....
But any straight forward syntax scanner would lack type inference and therefore less the perfect with regard to auto-completion / intellisense in all situations. But I'd guess even then, very useful.
I think the best option is to use the Scala compiler itself to emit symbol information that would be easily parsed, and put into CEDET's semantic database. This weekend I plan on taking a look at what the 2.8 Scala compiler will offer in this regard. If lucky some IL or AST emitting option is available. In addition, I intend to get a handle on what it would take to create a simple Scala compiler plug-in which walks the AST and emits the info that CEDET's Semantic system needs.
This would give us comprehensive intellisense, xrefing, autocompletion etc. on par (maybe better) with the other IDE options for Scala. CEDET's symbol properties probably need to be extended to deal with default and implicit args.
I'll post the outcome of what I find this weekend.
Ray
On Thu, Jul 30, 2009 at 9:49 PM, Andrei Formiga <andrei.formiga@gmail.com> wrote:
M-x semantic-idle-scheduler-mode If enabled, when emacs is idle, will re-parse your file picking up any new methods.
I've only invested a 2-3 weekend mornings and a few post-dinner hours in getting this far. I think its pretty nice that for ~15-20 hours investment I was able to get a system that's not too far behind some of the other options out there. :) This also means I only have a few days practice playing with all this myself.
Another nice thing to try is M-x ecb-toggle-compile-window to bring up dedicated compiler window at the bottom.
Then, when one you are editing a Scala file, launch SBT with M-x sbt-shell.
Then I like to enable SBT's incremental compiling mode.
> ~ compile
Now when you edit your Scala code, pause and save the file, ecb will re-parse and SBT will re-compile giving you navigable errors (same for test failures). Use C-c . / to toggle the compile window bigger and back.
Using CTags to parse the Scala code provided some very nice bang for the buck for little time investment. I had never used CEDET or ECB before and did not know what to expect, but am now impressed.
Better parsing is the key and necessary to take it to the next level. I've been thinking and poking around a bit. Here is where I am at.
I'm sure I can improve the ctags based parsing to grab method args. But ctags will always be less than perfect. Trying to encode the Scala grammer using CEDET's Bison grammer would be a big job and difficult. For example, Scala's implied semi-colon inferencing alone would make the lexing tough and I don't know how flexible CEDET's parser code is to deal with it.
On the other hand, we don't need to parse everything, just key tags, such as trait, class, object, def. val, var, arg lists etc... Writing a sufficiently "smart" syntax source code scanner seems very feasible to pull off. My elisp experience is limited but my Scheme-fu is pretty solid....
But any straight forward syntax scanner would lack type inference and therefore less the perfect with regard to auto-completion / intellisense in all situations. But I'd guess even then, very useful.
I think the best option is to use the Scala compiler itself to emit symbol information that would be easily parsed, and put into CEDET's semantic database. This weekend I plan on taking a look at what the 2.8 Scala compiler will offer in this regard. If lucky some IL or AST emitting option is available. In addition, I intend to get a handle on what it would take to create a simple Scala compiler plug-in which walks the AST and emits the info that CEDET's Semantic system needs.
This would give us comprehensive intellisense, xrefing, autocompletion etc. on par (maybe better) with the other IDE options for Scala. CEDET's symbol properties probably need to be extended to deal with default and implicit args.
I'll post the outcome of what I find this weekend.
Ray
On Thu, Jul 30, 2009 at 9:49 PM, Andrei Formiga <andrei.formiga@gmail.com> wrote:
It's looking good. I noticed it still does not identify method
parameters (at least they don't show in ECB), and also the information
is not updated after I add a new method. As I understand you added
parsing support by using ctags, but CEDET's site seem to recommend
defining a parser using Semantic. Do you plan to do this in the
future? I could help with some things, although I know almost nothing
about CEDET and ECB, and only have a slight acquaintance with Elisp
(have used other lisps before, though).
--
[]s, Andrei Formiga
On Wed, Jul 29, 2009 at 6:33 PM, Ray Racine<ray.racine@gmail.com> wrote:
> Highly recommend the CVS pulls for CEDET and ECB. They both build flawless
> with a single $ make for CEDET and with one edit in (the path to CEDET) the
> ECB Makefile and then another $ make you're done. CEDET 1.0pre4 is very
> old. I've only tested against latest CEDET and ECB from CVS.
>
> Ray
>
> On Wed, Jul 29, 2009 at 4:29 PM, Andrei Formiga <andrei.formiga@gmail.com>
> wrote:
>>
>> On Tue, Jul 28, 2009 at 10:03 PM, Ray Racine<ray.racine@gmail.com> wrote:
>> > I've created a Wiki page on how to put together a nice suite of
>> > capability
>> > for Emacs based Scala development.
>> >
>> > http://scala.sygneca.com//tools/emacs
>> >
>> > Its minimal. Just ask questions or catch me on #scala.
>>
>> I'm really interested in this, but I have one question: which version
>> of CEDET and ECB to install? Should I get them from repositories?
>> Ubuntu 9.04 has CEDET 1.0pre4 and ECB 2.32; will these versions work?
>>
>> --
>> []s, Andrei Formiga
>
>
Fri, 2009-07-31, 06:37
#3
Re: Emacs - Maven and SBT support for Scala Mode
On Fri, Jul 31, 2009 at 12:05 AM, Ray Racine wrote:
>
> Better parsing is the key and necessary to take it to the next level. I've
> been thinking and poking around a bit. Here is where I am at.
>
> I'm sure I can improve the ctags based parsing to grab method args. But
> ctags will always be less than perfect. Trying to encode the Scala grammer
> using CEDET's Bison grammer would be a big job and difficult. For example,
> Scala's implied semi-colon inferencing alone would make the lexing tough and
> I don't know how flexible CEDET's parser code is to deal with it.
>
I don't think semi-colon inferencing affects lexing at all, only
parsing. And I may be wrong, but I think if the semi-colon inferencing
is done as a pre-processing step, parsing Scala should be
straightforward. The question is if this pre-processing step would
play nicely withing CEDET's framework. Besides, inferring the
semi-colons is a local operation, so it should be no problem to do
incrementally.
>
> But any straight forward syntax scanner would lack type inference and
> therefore less the perfect with regard to auto-completion / intellisense in
> all situations. But I'd guess even then, very useful.
>
I thought about this too. I believe the type-inference algorithm for
Scala is also local, but I have no idea how hard would it be to
implement it, considering things like subtyping.
> I think the best option is to use the Scala compiler itself to emit symbol
> information that would be easily parsed, and put into CEDET's semantic
> database. This weekend I plan on taking a look at what the 2.8 Scala
> compiler will offer in this regard. If lucky some IL or AST emitting option
> is available. In addition, I intend to get a handle on what it would take
> to create a simple Scala compiler plug-in which walks the AST and emits the
> info that CEDET's Semantic system needs.
>
Yes, I guess that would be the ideal solution, so it wouldn't be
necessary to redo the parsing and type-inferencing already implemented
in the compiler.
Sat, 2009-08-01, 09:37
#4
Re: Emacs - Maven and SBT support for Scala Mode
Ray Racine wrote:
> I'm sure I can improve the ctags based parsing to grab method args. But
> ctags will always be less than perfect.
You might also want to look at this, it already uses the compiler to
generate tags files:
http://github.com/stevej/sctags/tree/master
- Florian.
Sat, 2009-08-01, 17:57
#5
Re: Emacs - Maven and SBT support for Scala Mode
Its perfect. Thank you.
Ray
On Sat, Aug 1, 2009 at 4:32 AM, Florian Hars <hars@bik-gmbh.de> wrote:
Ray
On Sat, Aug 1, 2009 at 4:32 AM, Florian Hars <hars@bik-gmbh.de> wrote:
Ray Racine wrote:
I'm sure I can improve the ctags based parsing to grab method args. But ctags will always be less than perfect.
You might also want to look at this, it already uses the compiler to generate tags files:
http://github.com/stevej/sctags/tree/master
- Florian.
On Tue, Jul 28, 2009 at 10:03 PM, Ray Racine wrote:
> I've created a Wiki page on how to put together a nice suite of capability
> for Emacs based Scala development.
>
> http://scala.sygneca.com//tools/emacs
>
> Its minimal. Just ask questions or catch me on #scala.
I'm really interested in this, but I have one question: which version
of CEDET and ECB to install? Should I get them from repositories?
Ubuntu 9.04 has CEDET 1.0pre4 and ECB 2.32; will these versions work?