Filtering out Gems from Code Completion and Go To navigation

View: New views
5 Messages — Rating Filter:   Alert me  

Filtering out Gems from Code Completion and Go To navigation

by Chris Kutler :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The following is from http://wiki.netbeans.org/RubyOptions. I can't make this work. I have tried editing the netbeans.conf file and the project.properties file. I don't see any change in behavior.

Is this still true? If so, can someone give me a step-by-step and a before and after behavior? Perhaps I am not understanding this.

Filtering Gems

By default, in a Rails project, NetBeans will make ALL installed gems available to your files - for code completion, go to declaration, etc. Ruby projects include all gems, except for the Rails ones (although ActiveRecord -is- included). By changing this filtering, you can remove gems that add methods to core classes like Object and Module if you don't want these methods showing up in completion in your own files.

You can tweak how gems are included or excluded yourself, through the use of regular expressions. To change it globally, for all Ruby projects (not Rails projects), as follows:

-J-Druby.prj.includegems=all
-J-Druby.prj.excludegems=^(rails|action[a-z]+|activesupport)-\\d+\\.\\d+\\.\\d+(-\\S+)?$

The regular expression is matched against the gem file names (e.g. activesupport-1.3.5 or foo-bar-1.2.3-ruby) and if the file is in the includegems pattern it is included, else if it is in the exclude filter, it is excluded, else it is included.

For Rails projects, use the same approach except the property names are slightly different: rails.prj.excludegems and rails.prj.includegems .

You can also set these filters on a per-project basis. Edit the nbproject/project.properties file in your project, and add these lines:

ruby.includegems=actionpack
ruby.excludegems=rspec

(where again, these are regular expressions as shown above.)





Guess Filled Method Arguments

by Chris Kutler :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Am I correct that the Guess Filled Method Arguments in the
Editor/General tab doesn't apply to Ruby and Rails?
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


Re: Filtering out Gems from Code Completion and Go To navigation

by Tor Norbye :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sep 24, 2008, at 2:47 PM, Chris Kutler wrote:

The following is from http://wiki.netbeans.org/RubyOptions. I can't make this work. I have tried editing the netbeans.conf file and the project.properties file. I don't see any change in behavior.

Is this still true? If so, can someone give me a step-by-step and a before and after behavior? Perhaps I am not understanding this.

It's supposed to work but it's definitely an expert option. 

Can you confirm that you tried adding the two lines (ruby.includegems=actionpack,ruby.excludegems=rspec) to your Rails project's "nbproject/project.properties" file? If so, if you performed code completion, was it the case that rspec no longer showed up in code completion? e.g. in an rspec file, "describe" was not shown (and without the filtering, it is?)

-- Tor

Re: Guess Filled Method Arguments

by Tor Norbye :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sep 24, 2008, at 4:17 PM, Chris Kutler wrote:

> Am I correct that the Guess Filled Method Arguments in the Editor/
> General tab doesn't apply to Ruby and Rails?

Yes. It arguably should be - but it isn't today.

-- Tor

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


Re: Filtering out Gems from Code Completion and Go To navigation

by Chris Kutler :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Even without filtering, des does not have any code completion
suggestions (and, of course neither does describe) so that is probably
not a good way to test this.

I tried a different rspec call, match (Spec::Matchers).

My project.properties looks like this

javac.classpath=
main.file=main.rb
platform.active=default
source.encoding=UTF-8
spec.src.dir=spec
src.dir=lib
test.src.dir=test
rails.includegems=actionpack
rails.excludegems=rspec-1.1.4
ruby.excludegems=all
ruby.excludegems=rspec-1.1.4
ruby.excludgems=rspec

match Spec::Matchers is not filtered out of code completion.

I have a question -- why did you want me to have
ruby.includegems=actionpack? Does this affect the test in some way? I am
not quite grasping why/when one would need to includegems. I thought
that the IDE makes all installed gems available to the files, so what
does the includegems do?

 (I am working with a Ruby project).

Agreed this is an expert option. That is why it is discussed in the back
of the book. But, as it exists, and as it is difficult to use, I thought
it should be discussed. I can leave it out if you think I should. It is
such a head-banger for me, I am thinking it might be for others.

What scenario where you addressing when you created this option?

Tor Norbye wrote:

> It's supposed to work but it's definitely an expert option.
>
> Can you confirm that you tried adding the two lines
> (ruby.includegems=actionpack,ruby.excludegems=rspec) to your Rails
> project's "nbproject/project.properties" file? If so, if you performed
> code completion, was it the case that rspec no longer showed up in
> code completion? e.g. in an rspec file, "describe" was not shown (and
> without the filtering, it is?)
>
> -- Tor

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...