After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 566693 - Code completion of symbols usually not working
Code completion of symbols usually not working
Status: RESOLVED FIXED
Product: anjuta
Classification: Applications
Component: plugins: language-support-c-cpp-java
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Sébastien Granjoux
Anjuta maintainers
: 568031 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2009-01-05 23:04 UTC by Philip Van Hoof
Modified: 2009-02-05 20:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Wrong tooltip (240.81 KB, image/png)
2009-01-12 17:47 UTC, Massimo Cora'
Details

Description Philip Van Hoof 2009-01-05 23:04:43 UTC
When I typed

gtk_[CURSOR WAS HERE]

I saw a menu with a few items being "gtk_reserved1 until 4".

I continued typing and the menu disappeared completely. I would rather expect the menu to simply lessen in amount of items it displays. But of course it was only showing the gtk_reserved1..4 variables, not the symbols of Gtk+.

gtk_widget_[CURSOR WAS HERE]

At this point it was not possible to get any menu with any item anymore.

Note that gtk+ is selected as API with symbols to load.

Same for this:

g_list_[I tried whatever I wanted, no menu]

g_list_prepend ([I tried whatever I wanted, no menu]

In old Anjuta (Ubuntu hardy package) it did show a tooltip with the API as soon as the API was typed right. Even that has now disappeared and ain't working anymore.

I was testing these things with Anjuta trunk using scite.
Comment 1 Johannes Schmid 2009-01-06 00:13:32 UTC
There are some problems in the language-support code currently, I will have a look at it. It doesn't have much to do with the new symbol-db.
Comment 2 Johannes Schmid 2009-01-10 18:17:43 UTC
That should work now with trunk. I cannot really say that it works for any case but I couldn't find any further problems.

This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.
Comment 3 Massimo Cora' 2009-01-12 17:47:57 UTC
Created attachment 126296 [details]
Wrong tooltip

I'm encountering a weird behaviour with completions after, I think, this patch.
Attached is a screenshot that displays, with Scintilla, a tooltip appearing when pressing just enter in a blank row.

Tooltips are now appearing quite everywhere and are making editing difficult.
Comment 4 Massimo Cora' 2009-01-12 17:52:10 UTC
ok, the "gboolean" completion that you see in the screenshot was previously and correctly displayed elsewhere.
Seems like the last completion is not well cleaned in the stack or something.

Can you please check this?

Comment 5 Johannes Schmid 2009-01-12 18:21:01 UTC
Hmm, could you give me some instructions to reproduce? I did not encounter this yet but it could be because I always use sourceview or because my computer is faster/slower than yours.
Comment 6 Massimo Cora' 2009-01-13 19:40:53 UTC
ok cctually  I can reproduce with these steps:

1. create a foobar generic c project
2. be sure to use Scintilla
3. Add a c++ class, call it foo.cpp with header foo.hpp
4. go on foo.hpp and write somewhere "g_free ("
5. a completion would popup
6. write inside the brackets something and close them with a semicolon at the end.
7. press enter. You see the g_free () completion everytime, which shouldn't be there.
Comment 7 Sébastien Granjoux 2009-01-16 21:27:23 UTC
I get a similar problem after enabling glib module in symbol-db preferences.

But here, I get g_freopen instead of g_free.
Comment 8 Sébastien Granjoux 2009-02-01 11:40:36 UTC
I think this bug shouldn't be closed. It seems that I don't get any completion. So I don't get this bug neither.
Comment 9 Johannes Schmid 2009-02-01 14:49:55 UTC
Completions work for me but I don't use scintilla so I cannot say much about the other problem.
Comment 10 Sébastien Granjoux 2009-02-04 20:54:05 UTC
Completion doesn't work correctly in Scintilla.

It's because ianjuta_editor_get_text return NULL on Scintilla, when the begin and the end iterator are at the same place, and "" on GtkSourceView. This return value arrives in assist->priv->pre_word.


Anyway, I don't think it's a good idea to rely on that.

Then the problem is triggered here in te cpp_java_assist_show_autocomplete function

	if (assist->priv->completion_cache->cache)
		completion_list = assist->priv->completion_cache->cache;
	
	/* If there is no cache, it means that no string completion happened
	 * because the list is being shown for member completion just after
	 * scope operator where there is no preword yet entered. So use the
	 * full list because that's the full list of members of that scope.
	 */
	else if (!assist->priv->pre_word)
		completion_list = assist->priv->completion_cache->items;
		
	else
		return FALSE;

With Scintilla we get the full completion list (completion_list = assist->priv->completion_cache->items;) while with GtkSourceView we just return FALSE.

Anyway, there is already a check if assist->priv->pre_word is NULL at the beginning. I think that in this case, we can return FALSE directly.

I will write a patch for this.



But when I type gtk_wid[CURSOR WAS HERE] by example, I expect to get a long list of possible completion (limit is 20). Instead I get only 8 choices. Is it an expected behavior ?

I get this on both with Scintilla and GtkSourceView.
Comment 11 Sébastien Granjoux 2009-02-04 20:54:22 UTC
*** Bug 568031 has been marked as a duplicate of this bug. ***
Comment 12 Sébastien Granjoux 2009-02-05 20:54:12 UTC
Ok, I think I have fixed this code. It should works fine now.