This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 172043 - Code completion does not work if java is not activated
Summary: Code completion does not work if java is not activated
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Parsing & Indexing (show other bugs)
Version: 6.x
Hardware: Macintosh All
: P2 blocker (vote)
Assignee: Vitezslav Stejskal
URL:
Keywords: RANDOM
Depends on:
Blocks:
 
Reported: 2009-09-11 14:26 UTC by Tomas Danek
Modified: 2009-09-18 22:33 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
screenshot (11.09 KB, image/png)
2009-09-15 11:01 UTC, Tomas Danek
Details
Patch of the fix, please review before apply. (1.48 KB, patch)
2009-09-17 09:48 UTC, Tomas Zezula
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tomas Danek 2009-09-11 14:26:36 UTC
Product Version: NetBeans IDE Dev (Build 090911)
Java: 1.5.0_20; Java HotSpot(TM) Client VM 1.5.0_20-141
System: Mac OS X version 10.5.8 running on i386; MacRoman; en_US (nb)
Userdir: /tmp/ud1
--------
- built with ant clean && ant
- start ide with fresh userdir
- create ruby app
- type a="hello"
- type a.| and invoke CC - does not work (no suggestion)
- activate java (e.g. create j2se project)
- go back to ruby file and invoke CC on the same place, now it works
Comment 1 Erno Mononen 2009-09-11 15:03:19 UTC
Seems like FoD related, I'll give this a try with a fresh build (my build from yesterday's sources doesn't exhibit this 
problem). 
Comment 2 Erno Mononen 2009-09-14 14:55:49 UTC
Unfortunately I can't reproduce with build 090914 (e8b4a4ca8d01 to be exact). Based on the description I have a reason 
to believe that the problem is FoD related though. Does CC work for you normally in the Ruby only distribution (or if 
you build just the ruby cluster)?
Comment 3 Tomas Danek 2009-09-15 11:00:06 UTC
reproduced with 20090914, with full IDE by the original steps. However, seems to be some kind of random, reproduced on
the second attempt:(
will try to reproduce with just ruby cluster.
Comment 4 Tomas Danek 2009-09-15 11:01:27 UTC
Created attachment 87674 [details]
screenshot
Comment 5 Tomas Danek 2009-09-15 11:12:30 UTC
btw while comparing indexes between successful and unsuccessful attempt, found that:
in both is s7 s7=file\:/space/ruby-main/nbbuild/netbeans/ruby2/jruby-1.3.1/lib/ruby/1.8/

but while listing s7 dir, the unsuccessful attempt userdir is missing folder 'ruby', which might be the root cause.

drwxr-xr-x  3 tomas  wheel    102 Sep 15 11:55 TLIndexer
drwxr-xr-x  3 tomas  wheel    102 Sep 15 11:55 TaskListIndexer
drwxr-xr-x  3 tomas  wheel    102 Sep 15 11:55 javascript
drwxr-xr-x  3 tomas  wheel    102 Sep 15 11:55 org-netbeans-modules-jumpto-file-FileIndexer
drwxr-xr-x  3 tomas  wheel    102 Sep 15 11:55 ruby
-rw-r--r--  1 tomas  wheel  22841 Sep 15 11:55 timestamps.properties
drwxr-xr-x  3 tomas  wheel    102 Sep 15 11:55 void-indexer
Comment 6 Erno Mononen 2009-09-16 14:11:39 UTC
I was able to reproduce after a couple of attempts. The ruby class path provider and indexer don't get called at all 
until Java is activated. Not sure where to pass this (as I wrote above FoD may play a role here), perhaps java/
classpath as per the problem with the class path provider.
Comment 7 Tomas Zezula 2009-09-16 14:56:48 UTC
Seems as FOD problem, I will try it and reassign to correct module.
Comment 8 Tomas Zezula 2009-09-16 20:29:18 UTC
While debugging the problem the ruby ClasspathProvider (from Ruby project) is called when invoking the code completion.
The code completion return nothing. Even the PathRecognizer seems is in the main lookup. When a new Ruby project was created the roots were correctly 
recognized by the PathRegistry.
The problem is in the editor lib. The MimeLookup.getLookup("text/x-ruby").lookup(type) returns the [EmbeddingIndexerFactory,TLIndexer] but neither the 
tracker.results nor the infosBy.* contain indexer for "text/x-ruby".
This is a result of the fact the the Util.getAllMimeTipes() and EditorSettings.getDefault().getAllMimeTypes() do not contain the ruby mime type.
Seems as some bug in order of firing (handling of events) caused by FOD.

EditorSettings.getDefault().getAllMimeTypes:
"[text/x-el, text/x-sql, text/x-javascript-string, text/xml, text/xhtml, application/xml-dtd, text/html, text/x-json, text/x-java, text/plain, text/x-jsp, 
text/javascript, text/x-diff, text/x-javascript-comment, text/x-css, text/x-yaml, text/x-dialog-binding, text/x-properties, text/xml-external-parsed-
entity]"

MimeLookup.getLookup("text/x-ruby").lookupAll(type):
"[org.netbeans.modules.csl.core.EmbeddingIndexerFactoryImpl@80b260, org.netbeans.modules.csl.core.TLIndexerFactory@3ef5d0]"
Comment 9 Tomas Zezula 2009-09-17 09:47:48 UTC
The problem is that the MimeTypesTracker does not hold the subfolders which causes lazy fs not to fire.
Comment 10 Tomas Zezula 2009-09-17 09:48:59 UTC
Created attachment 87825 [details]
Patch of the fix, please review before apply.
Comment 11 Vitezslav Stejskal 2009-09-17 12:22:45 UTC
Thanks for the patch Tomasi - http://hg.netbeans.org/jet-main/rev/e1aa8a733585
Comment 12 Quality Engineering 2009-09-18 22:33:02 UTC
Integrated into 'main-golden', will be available in build *200909181401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/e1aa8a733585
User: Vita Stejskal <vstejskal@netbeans.org>
Log: #172043: hard reference all traversed folder FileObjects in order to get reliable filesystem events