Continuing from "Moving to 3rd Rail"
After being educated on the virtues of NBRubyIde, I was motivated to
actually checked out code completion of the much maligned free Aptana
radrails. This is the result
1. Type validates+ctrl-space
1.1 NBRubyIDE
Result :
validates_presence_of *attr_names
1.2 Aptana RadRails
Result :
validates_presence_of(attributes, :message => "message")
1.3 3rdRail
Result : My test license has expired
Cody, pse fill up the blank :-)
So guys, which IDE does better code completion ?
More info here...
http://www.sapphiresteel.com/Ruby-On-Rails-Code-Completion-The
http://www.sapphiresteel.com/Ruby-On-Rails-IntelliSense-1
http://www.sapphiresteel.com/Evaluating-Ruby-IntelliSense
best wishes
Huw Collingbourne
SapphireSteel Software
Ruby and Rails In Visual Studio
http://www.sapphiresteel.com
--
Posted via http://www.ruby-forum.com/.
I wish I could test out your statement on code accuracy but
unfortunately, I don't use VS :-)
Why don't you post what RIS will output when one types
validates+ctrl+space ?
On Sep 26, 9:52 pm, Huw Collingbourne <rails-mailing-l...@andreas-
s.net> wrote:
> We are not aware of any IDE that equals the code completion in Ruby In
> Steel. (both in terms of speed and accuracy) and we do test the others
> pretty regularly. We have written a great deal about the technology that
> lies behind this and we shall soon be releasing an updated evaluator's
> guide so that you can test our code completion against any other IDE.
>
I'll go through the various editors and post actual example of code
completion. I use code completion in the project commander when
executing scripts, in the style-sheet editor to remember a specific
selector, in the rhtml templates, and of course in the editor.
There'll be a follow-up posting soon containing the examples...
Great ! I am looking forward to your post :-)
On Sep 26, 10:33 pm, Cody Skidmore <rails-mailing-l...@andreas-s.net>
wrote:
>
> Why don't you post what RIS will output when one types
>
> validates+ctrl+space ?
That all depends on the context and scope. We don't use lookup lists. We
actually analyze all the code, its inheretence tree, mixins, scope
(class/instance), visibility (public/private) etc. That means that when
you are in a class that descends from ActiveRecord::Base you will see a
whole load of validation methods (too many for me to type in here) - but
when you are in some other scope (where they are not valid) you won't
see any. The same goes for all classes, modules, methods etc. We never
ever use lookup lists - absolutely not ever. We always analyze code in
context.
I should say that this applies to the new version of Ruby In Steel 1.1.5
(currently available as a final beta). Earlier versions did full
analysis of Ruby but only partial analysis of Rails (for quite complex
reasons, Rails introduces some special problems for code completion). In
1.1.5 we've introduced full code analysis into Rails.
best wishes
Huw
SapphireSteel Software
The context is that if one selects validates_presence_of , what does
RIS output ?
On Sep 26, 10:53 pm, Huw Collingbourne <rails-mailing-l...@andreas-
I'm not quite sure what you mean by its "output". If you enter part of
the name - e.g. val then press ctrl+space, you will get a list of
methods (in scope) that begin with those letters. The RDOC for
validates_presence_of is shown alongside it in a tooltip next to the
code completion list or (more nicely formatted) in a docked RDOC window
(this is the complete RDOC documentation which, for reference, I've put
at the end of this post).
The parameter list and class (here: attr_names:Object) can also be
displayed in a hovering tooltip. Here the parameter type is Object
because that is all that can be inferred from this method definition at
edit time. In many cases, we can infer specific class types such as
Array or String but it turns out that the code in the
validates_preesence_of method does not provide that information. We also
have a type assertion facility, however, whereby you can enter a comment
over a method - e.g.
#:return: => Array
#:arg: anArg => MyClass
This will then provide more detailed parameter info in tooltips than can
be inferred from the code itself.
best wishes
Huw
SapphireSteel Software
Ruby and Rails In Visual Studio
http://www.sapphiresteel.com
p.s. As promised, above, here's our context-sensitive RDOC documentation
for validates_presence_of...
Validates that the specified attributes are not blank (as defined by
Object#blank?). Happens by default on save. Example:
class Person < ActiveRecord::Base
validates_presence_of :first_name
end
The first_name attribute must be in the object and it cannot be blank.
If you want to validate the presence of a boolean field (where the real
values are true and false),
you will want to use validates_inclusion_of :field_name, :in => [true,
false]
This is due to the way Object#blank? handles boolean values.
false.blank? # => true
Configuration options:
* message - A custom error message (default is: "can't be blank")
* on - Specifies when this validation is active (default is :save, other
options :create, :update)
* if - Specifies a method, proc or string to call to determine if the
validation should
occur (e.g. :if => :allow_validation, or :if => Proc.new { |user|
user.signup_step > 2 }). The
method, proc or string should return or evaluate to a true or false
value.
Warning
Validate the presence of the foreign key, not the instance variable
itself.
Do this:
validate_presence_of :invoice_id
Not this:
validate_presence_of :invoice
If you validate the presence of the associated object, you will get
failures on saves when both the parent object and the child object are
new.
return: => Object
arg: attr_names => Object
It would appear that all 3 IDEs displays a box for one to select the
validation method of choice.
However, it looks as if the resultant source codes are pasted
differently !
For example,
1) using nbRubyIde, once selected, this will appear in your source
codes
validates_presence_of *attr_names
2) using Aptana RadRails , the following is pasted
validates_presence_of(attributes, :message => "message")
Can you see the difference ?
What I am interested to know is the resultant code that will be pasted
automatically by RIS :-)
On Sep 27, 1:04 am, Huw Collingbourne <rails-mailing-l...@andreas-
> Ruby and Rails In Visual Studiohttp://www.sapphiresteel.com
we insert:
validates_presence_of
We don't insert any args by default. However, we display parametr-info
tooltips showing the args with each arg (when more than 1) highlighted
as it is entered by the user.
I should probably point out that we also have auto-expand snippets (and
a snippet editor) - these optionally have fill-in-the-gap insertion
points so you could create a snippet which, when you enter vp (say)
followed by a tab automatically expands to
validates_presence_of attr_names
Where attr_names would be highlighted ready to be edited. You can, of
course, create much more complex snippets to so that when you edit an id
(say a variable or parameter name) in one part of the snippet, the same
id is automatically changed throughout the remainder of the snippet.
In short then: code-completion (IntelliSense) is based on deep
code-analysis and only enters valid code (with no 'place holders');
snippets are auto-expanding code blocks which may contain a number of
place-holders that can be tabbed to and from and edited to change
similarly named placed-holders throughout the rest of the snippet.
best wishes
Huw
SapphireSteel Software
Ruby and Rails In Visual Studio
http://www.sapphiresteel.com
Ummm, you must not have registered your trial copy.
You need to register it to use it for the 30 day trial. Your trial
obviously isn't expired since it was just released last week...
In terms of code completion 3rdRail uses type inference to determine
what is appropriate for completion options. In some cases we're better
then others, in some cases we're trailing a bit. NetBeans uses
hueristics, in my experience this is limited and can offer a lot of
incorrect choices.
For example, in netbeans completion on
require "^" # cursor at ^ character
should give a reasonable list of choices. We didn't think this was a
key use case.
In a form_for block in rhtml though we offer all of the right choices,
including the symbols for the models created in the action, ids, etc.
NB offers \t and \r, which didn't help me.
I did a side-by-side comparison of 3rdRail and NetBeans last week and in
my view our completion is much more useful than NB. I know I'm biased,
but that was what I saw. I'm sure you could find cases on both sides,
it's software after all. Absolutes are rare.
There is a short video that shows a bit of code completion here:
http://dn.codegear.com/article/37034
Trial downloads here
http://cc.codegear.com/free/3rdrail
Joe
3rdRail Team
Hi Joe
Asking the same question, what does 3rdrail insert when
validates_presence_of is selected ?
Nope, I was referring to the field test copy and not the trial copy.
On Sep 27, 7:55 am, Joe Mcglynn <rails-mailing-l...@andreas-s.net>
wrote:
Ahhh, the field test is over...that makes more sense. You can still get
the trial of course...
Just to be clear: NetBeans also uses type inference for completion
options such that in many cases it gives accurate results. The
validates-example listed earlier on this thread is one such example
where it knows exactly what the inherited and mixed in methods are in
the current context, and can complete accurately.
However, it -also- relies on heuristics in cases where it's not sure,
such as a call to a method whose return type is unknown. I looked at
the video you linked to and the narrator states that 3rdRail relies
type inference and "Rails Conventions" - which sounds like heuristics
to me. And in a dynamic language like Ruby I don't think there's any
way to NOT use heuristics if you want to offer reasonable completion -
with methods and classes being modified dynamically computing the
correct set of methods etc. requires solving the Halting Problem.
Anyway, NetBeans doesn't do parameter completion right yet; I had
started that work but disabled it until I could finish it as I got
distracted with other tasks. This discussion has inspired me to go and
look at that code again :)
-- Tor
> Anyway, NetBeans doesn't do parameter completion right yet; I had
> started that work but disabled it until I could finish it as I got
> distracted with other tasks. This discussion has inspired me to go and
> look at that code again :)
cch: I started this discussion :-)
It is great to know that you are so responsive.
For the time being, it looks as if RadRails have the best code
completion (for novices and newbies anyway)
BTW, I have been trying nbRubyIDE(standalone) on and off and one
concern of mine is starting speed and indexing of project.
I have perhaps 10 projects (each with perhaps 50 controllers or more)
in the nRubyIDE. It does take quite a bit of time to start up.
Is there anything that I can do on my end.
>
> -- Tor
Hi Tor,
Thanks for the clarification, I have to admit my knowledge of the
inner workings of NB is second hand.
Joe
Since there was no answer forthcoming from you as to what was inserted
on code completing validate, I decided to download the Trial.
Just wasted 1 hour to download the Trial just to get this message
3rd Rail Trial License , O (days) left on trail
What is this ? Wasn't 3rdRail just launched on 17th Sept ????
Thanx !
The result is out for code completion of a simple typing of
validates+ctrl_space
1.1 NBRubyIDE
Result :
validates_presence_of *attr_names
1.2 Aptana RadRails
Result :
validates_presence_of(attributes, :message => "message")
1.3 Ruby in Steel
Result :
validates_presence_of
1.4 3rdRail
Result :
validates_presence_of
CONCLUSION :
So seemingly, Aptana RadRails has the most useful code completion for
this simple test.
To be fair, I have seen a Video cast of Shelby of CodeGear showing
impressive code completion on a migration file.
In addition, Tor of netbeans had already promised to look into
improving the completion code for my random example.
On Sep 28, 1:28 am, Anthony Richardson <anth...@viewpointsa.com>
wrote:
CCH,
Like I've said, code completion is much more complex than this, you
can't select one scenario to judge all IDEs. Each has it's strengths
and weaknesses. I can pick out an example that makes NetBeans look
great or one that makes 3rdRail The Ruler.
This is why I haven't been pasting specific examples here. No one
wants this to become a relegious war, arguing one discrete example
against the other.
Two things that would be more productive IMO:
1. If you find shortcomings in a tool report them to the folks that
make the tool so they can make it better.
2. If you really want to compare code completion, put together a
comprehensive matrix of places where completion should exist (types of
files, types of code fragments, different kind of syntax errors the
completion should recover from) and what choices should be provided
and do a complete comparison. This would show intersections for
different situations (methods defined on a parent class, methods
defined in the current class, dynamic methods provided by the
framework, dynamic methods provided by user code, for a simple
example) and what would be provided there (paramater arity, paramater
types, locally-defined paramater choices, paramater choices that are
made available by the framework, method calls that return the type
represented by the paramater...etc)
Then users can look at this and decide which tool best meets their
needs.
Just my two cents.
The example that's been quoted in favour of RADRails (that is, insertion
of validates_presence_of with extra args shown) is more like what we
would call 'snippets' in Ruby In Steel and which other IDEs may call
templates (though similar functionality might also be programmed as a
macro). We can certainly do auto-expand snippets (and macros) with,
optionally, editable 'fill in the gap' placeholders for you to edit the
argument lists. But that is a different feature from what Joe, Tor and I
mean when we talk about code completion.
best wishes
Huw
SapphireSteel Software
Ruby and Rails In Visual Studio
http://www.sapphiresteel.com
Of course, both of you are right.
What I was trying to point out was that sweeping statements made by
overzealous fans/developers etc of IDEs can easily be debunked !
IMHO, one should by all means trumpet the great features (eg, Project
Commander in 3rd Rail) but not at the expense of condemning another
with four-letter words.
I believe, I have already made my point :-)
The bottom line is that there must be healthy competition and IDE
developers who do not wish to accept constructive criticism and
improve will simply perish...
TQ
CCH,
What O/S are you running? On Windows XP, the following happens (I just
tested this):
validates_presence_of <ctrl-spacebar>
... :description
... :email
... :*other_attributes*
... find_all_by_description(description, *options) - ::User
... find_all_by_email(description, *options) - ::User
... find_all_by_*other_attr*(description, *options) - ::User
> validates_presence_of <ctrl-spacebar>
> ... :description
> ... :email
> ... :*other_attributes*
> ... find_all_by_description(description, *options) - ::User
> ... find_all_by_email(description, *options) - ::User
> ... find_all_by_*other_attr*(description, *options) - ::User
When editing a stylsheet in 3rdRail, the following occurs:
a {
<ctrl-spacebar>
*a whole list of sytle attributes*
}
select background-image
a {
background-image <ctrl-spacebar>
*url("")
*none
*inherit
}
Having a unified editor where you don't have to switch from one tool to
another when editing code, style sheets, and templates is pretty cool.
>
> CCH,
>
> What O/S are you running? On Windows XP, the following happens (I just
> tested this):
cchL Windows XP Pro, SP2
>
> validates_presence_of <ctrl-spacebar>
> ... :description
> ... :email
> ... :*other_attributes*
> ... find_all_by_description(description, *options) - ::User
> ... find_all_by_email(description, *options) - ::User
> ... find_all_by_*other_attr*(description, *options) - ::User
cch: When I type validates+ctrl+spacebar in 3rdRail
a dropdown list is shown and when I select validates_presence_of ,
validates_presence_of is inserted
Radrails inserts
validates_presence_of(attributes, :message => "message")
which is clearly more appropriate :-)
Aptana Radrails have similar functionality, check it out..
On Sep 29, 3:30 am, Cody Skidmore <rails-mailing-l...@andreas-s.net>
wrote:
I'm using RadRails since I can't spring $2049 for TextMate (and
accompanying Mac). I've also tested the "e" editor, and otherwise have
used EditPlus.
EditPlus doesn't do code completion, but I find that it has better
per-language (really per-file-extension) configuration options. Much
like radRails, it has some capacity to capture console output from an
external program, or just trigger another program altogether. In
general, this is my editor of choice. FWIW, I just submitted an RHTML
syntax file that you can download from the User Files section of
editplus.com.
RadRails is a nice balance of a compact work space, console/logger, and
syntax hilighter. I also like its Auto-completion functionality, but
it's anywhere from complete OR consistent. And it's preferences panel
leaves much to be desired. Then again, it is still a beta release so you
have to take some of those problems in context. I look forward to future
releases.
"e" was clunky IMO, and it was too dependent on Cygwin for my tastes (I
like cygwin, but getting Ruby and Rails installed on it took some extra
steps compared to Windows). I tried it for less than a day before coming
across RadRails, so I can't say too much more about it. However, since
it uses the same auto-completion files as TextMate, it most likely has
RadRails licked in that department.
I can't speak to any of the others that you tested.
On Sep 29, 4:32 pm, Chris Bloom <rails-mailing-l...@andreas-s.net>
wrote:
>
> RadRails is a nice balance of a compact work space, console/logger, and
> syntax hilighter. I also like its Auto-completion functionality, but
> it's anywhere from complete OR consistent. And it's preferences panel
> leaves much to be desired. Then again, it is still a beta release so you
> have to take some of those problems in context. I look forward to future
> releases.
cch: Pretty appropriate description of Aptana Radrails which has
worked for me thus far.
FYI, they have in mind a Project Commander functionality in future...
> "e" was clunky IMO, and it was too dependent on Cygwin for my tastes (I
> like cygwin, but getting Ruby and Rails installed on it took some extra
> steps compared to Windows). I tried it for less than a day before coming
> across RadRails, so I can't say too much more about it. However, since
> it uses the same auto-completion files as TextMate, it most likely has
> RadRails licked in that department.
"e" is a nice idea, but unfortunately it's open-source-alpha quality with
closed-source-1.0 development; you have to pay, there's only one guy
writing it, and it's really really slow and buggy right now. Many basic
things don't work, like HOME and END keys. It also takes about 5 seconds
just to launch on my dual-3GHz PC.
There's also a newcomer Windows TextMate clone, InType, but it's in fairly
early days as well, and considering he's not going the cygwin route, I
imagine most TextMate bundles will need heavy hacking to work in InType.
--
Jay Levitt |
Boston, MA | My character doesn't like it when they
Faster: jay at jay dot fm | cry or shout or hit.
http://www.jay.fm | - Kristoffer
As Huw explained yesterday, you're talking about a different feature -
code template insertion (aka "snippets" in textmate). In Aptana, try
typing "validates"+ctrl+space in ANY file (not just a model file) and
it will offer the exact same thing. I think all the other IDEs being
discussed here offer the same feature. Code snippets weren't showing
up in code completion in NB6 beta1 but it's there in the dailys - see
this screenshot: http://blogs.sun.com/tor/resource/codetemplate-completion.png
I'm not trying to put down Aptana in any way, but since you started
this thread comparing "code completion" among the IDEs and since you
have several times now implied that Aptana has the best code
completion, I felt it important to point out that your comparison is
unfair.
Of course, all 3 you are right.
Like I said earlier, what I was trying to point out was that sweeping
statements made by
overzealous fans/developers etc of IDEs can easily be debunked !
IMHO, one should by all means trumpet the great features (eg, Project
Commander in 3rd Rail) but not at the expense of condemning another
with four-letter words.
I believe, I have already made my point :-)
The bottom line is that there must be healthy competition and IDE
developers who do not wish to accept constructive criticism and
improve will simply perish...
> Code snippets weren't showing
> up in code completion in NB6 beta1 but it's there in the dailys - see
> this screenshot:http://blogs.sun.com/tor/resource/codetemplate-completion.png
cch:
BTW, I have just downloaded the latest hudson 4289 and
validates+ctrl+space still inserts
validates_presence_of *attr_names
Over to you...
BTW, at first glance , l think your css editor is the best.
Do you have a google group or similar to post bugs comments already
discovered ?
Ctrl+space shouldn't insert anything. It should just pop up a list of
alternatives. It's up to you which item in the list you choose.
If you choose the above method, then yes, it will insert the above
signature (which matches the definition in the Rails code for the
validates_presence_of method, but yes, it should be smarter here and
offer better parameter items, which soon it will ;-)
If you on the other hand choose some of the code templates listed
below (different icon, see the earlier screenshot I listed) then it
will insert the corresponding code template.
A faster way than typing out the prefix and hitting ctrl-space is to
just type the trigger name (listed on the right in the completion
popup). E.g. for validates presence of, type just "vp"+tab, or
"vpif"+tab. Yes, these are the TextMate snippet names.
Unfortunately, 15 of the snippets were truncated at import (tracked by
NetBeans issue 117104), and "vp" is one of them - which is why it
doesn't insert a hash value yet. More details about the code snippets
are listed here: http://wiki.netbeans.org/wiki/view/RubyCodeTemplates
.
> Do you have a google group or similar to post bugs comments already
> discovered ?
The various feedback channels (issue tracker, mailing lists, forums,
etc) are listed here:
http://wiki.netbeans.org/wiki/view/RubyFeedback
In particular, a forum interface to our "dev" and "users" mailing
lists is available here:
http://www.nabble.com/NetBeans-Ruby-f27019.html
-- Tor
On Sep 30, 12:54 am, Tor Norbye <tor.nor...@gmail.com> wrote:
> On Sep 29, 9:09 am, CCH <c...@karensoft.com.my> wrote:
>
> > cch:
> > BTW, I have just downloaded the latest hudson 4289 and
>
> > validates+ctrl+space still inserts
>
> > validates_presence_of *attr_names
>
> > Over to you...
>
> Ctrl+space shouldn't insert anything. It should just pop up a list of
> alternatives. It's up to you which item in the list you choose.
cch: Sorry, I mean Ctrl+space and then slect :-)
>
> If you choose the above method, then yes, it will insert the above
> signature (which matches the definition in the Rails code for the
> validates_presence_of method, but yes, it should be smarter here and
> offer better parameter items, which soon it will ;-)
cch: This feature is very useful to newcomers to RoR
>
> If you on the other hand choose some of the code templates listed
> below (different icon, see the earlier screenshot I listed) then it
> will insert the corresponding code template.
cch: Noted
>
> A faster way than typing out the prefix and hitting ctrl-space is to
> just type the trigger name (listed on the right in the completion
> popup). E.g. for validates presence of, type just "vp"+tab, or
> "vpif"+tab. Yes, these are the TextMate snippet names.
cch: Cool Tip !
I'll definitely check this out, Nbrubyide/hudson is getting better and
better.
> Unfortunately, 15 of the snippets were truncated at import (tracked by
> NetBeans issue 117104), and "vp" is one of them - which is why it
> doesn't insert a hash value yet. More details about the code snippets
> are listed here:http://wiki.netbeans.org/wiki/view/RubyCodeTemplates
> .
>
> > Do you have a google group or similar to post bugs comments already
> > discovered ?
>
> The various feedback channels (issue tracker, mailing lists, forums,
> etc) are listed here:http://wiki.netbeans.org/wiki/view/RubyFeedback
>
> In particular, a forum interface to our "dev" and "users" mailing
> lists is available here:http://www.nabble.com/NetBeans-Ruby-f27019.html
cch: TQ
BTW, there is a bug in your gem manager when there is a need to choose
1/2/3/4
I was trying to install fast debugger and chooing 2 just hangs
The SVN integration is really cool but I noticed that one can check
out a project say crm4web into different folders and both folders will
appear in the Project View as crm4web which is pretty confusing ...
>
> -- Tor
Just an update on this older thread, since I promised it would work
better soon:
http://blogs.sun.com/tor/entry/ruby_screenshot_of_the_week20
-- Tor