Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#677 Include keywords with autocomplete symbols?

v1.23
pending
nobody
None
5
2013-07-01
2013-06-27
Chris Reece
No

Apologies if this has been covered, I couldn't find a feature request for "autocomplete" that looked relevant.

Symbol autocomplete (which is very useful) offers symbol alternatives as expected, but these symbols do not include language keywords. In the very specific case of writing Python, using the pass statement, which is naturally the end of a line, I'm getting autocompletes on symbols starting "pass", which are substituted in when I hit Return. This may be applicable under other circumstances, it's just "pass" that's biting me. I've verified this behaviour under 0.21 (via apt) and 1.23.1 (compiled just now) on:

Linux denmark 3.2.45-custom-20130529 #1 SMP Wed May 29 10:43:58 NZST 2013 x86_64 x86_64 x86_64 GNU/Linux

running Kubuntu 12.04. Screenshot attached.

I can work around by bumping the autocomplete length, but I wonder if it'd be possible to include keywords when autocompleting symbols?

Many thanks for Geany -- I fell on it while trying to edit a 20,000 line YAML file (three cheers for folding!) and it looks like it might become my editor of choice.

Cheers,

Chris.

1 Attachments

Related

Feature Requests: #677

Discussion

  • Lex Trotman
    Lex Trotman
    2013-06-28

    Hi,

    I believe the pass problem has been fixed in the symbols distributed with 1.23. Are you sure you installed it totally independent of 0.21? And you ran it with a different config dir eg geany -c /tmp/somethingthatdoesnotexist

     
  • Lex Trotman
    Lex Trotman
    2013-06-28

    • status: open --> pending
     
  • Chris Reece
    Chris Reece
    2013-06-28

    Lex,

    thanks for getting back to me.

    For completeness, forgive me if I sound pedantic:

    I downloaded 1.23.1 today, configured it with --prefix=/tech/home/car (an
    NFS-mounted directory that's not my home dir) and compiled and installed it
    into there. I ran it just now from the command line (after a fresh,
    unrelated reboot) without having run the Kubuntu 12.04 default version
    first, like so:

    car@denmark:~$ /tech/home/car/bin/geany -c /tmp/asdfasdgfafgsdfgsdf

    and the pass problem still seems to bite me. I've attached a screenshot of
    the problem, and the results of my non-existent config. The screenshot
    doesn't show it, but the sequence of keypresses p-a-s-s-Return still gets
    me a line that reads "password". Also attached are ldd output for
    /tech/home/car/bin/geany and pmap output of the running process, in case
    they help answer the question of whether my 1.23.1 compile is independent
    of the 0.21 that Kubuntu installed for me.

    Let me know if there's anything else I can provide in order to help.

    Cheers,

    Chris.

    On 28 June 2013 13:18, Lex Trotman elextr@users.sf.net wrote:

    Hi,

    I believe the pass problem has been fixed in the symbols distributed with
    1.23. Are you sure you installed it totally independent of 0.21? And you
    ran it with a different config dir eg geany -c
    /tmp/somethingthatdoesnotexist


    Status: open
    Created: Thu Jun 27, 2013 09:26 PM UTC by Chris Reece
    Last Updated: Thu Jun 27, 2013 09:26 PM UTC
    Owner: nobody

    Apologies if this has been covered, I couldn't find a feature request for
    "autocomplete" that looked relevant.

    Symbol autocomplete (which is very useful) offers symbol alternatives as
    expected, but these symbols do not include language keywords. In the very
    specific case of writing Python, using the pass statement, which is
    naturally the end of a line, I'm getting autocompletes on symbols starting
    "pass", which are substituted in when I hit Return. This may be applicable
    under other circumstances, it's just "pass" that's biting me. I've verified
    this behaviour under 0.21 (via apt) and 1.23.1 (compiled just now) on:

    Linux denmark 3.2.45-custom-20130529 #1 SMP Wed May 29 10:43:58 NZST 2013
    x86_64 x86_64 x86_64 GNU/Linux

    running Kubuntu 12.04. Screenshot attached.

    I can work around by bumping the autocomplete length, but I wonder if it'd
    be possible to include keywords when autocompleting symbols?

    Many thanks for Geany -- I fell on it while trying to edit a 20,000 line
    YAML file (three cheers for folding!) and it looks like it might become my
    editor of choice.

    Cheers,

    Chris.

    Sent from sourceforge.net because you indicated interest in
    https://sourceforge.net/p/geany/feature-requests/677/

    To unsubscribe from further messages, please visit
    https://sourceforge.net/auth/subscriptions/

     

    Related

    Feature Requests: #677

  • Lex Trotman
    Lex Trotman
    2013-06-28

    I can confirm via git that the symbols "pass_" and "password" were removed from the Python.tags file between 1.22 and 1.23. I actually complained that I had to disable autocompletion due to the annoyance factor, so I agree with you completely that its a pain.

    What I am struggling to understand is why Geany appears to be using an old tags file. You seem to have built and run the new version correctly.

    Could you just check that /tech/home/car/share/geany/python.tags does not contain "password" at the start of a line (use gedit not Geany, its a partly binary file ).

    If it doesn't exist you could try copying this file over the installed system one and see if that fixes it.

     
  • Chris Reece
    Chris Reece
    2013-06-28

    Hi, Lex.

    It's a pain, but I'm more than willing to wait out a solution.

    I've attached the output from:

    grep -a -i -e 'pass' /tech/home/car/share/geany/python.tags

    for your delight. No lines matching '^password' found. Closest was the
    Pass statement. I took the opportunity to strace a fresh copy og geany
    1.23.1, and the executive summary is attached. TL;DR:

    [pid 23220] 16:30:42.713025 open("/tech/home/car/share/geany/python.tags",
    O_RDONLY) = 14
    ...
    [pid 23220] 16:30:42.719052 close(14) = 0

    So that's the right tags file, I guess. There were no other successful
    file opens matching 'tags'.

    Also, no difference between that file and the one I got from the source
    tarball:

    car@denmark:/tech/home/car/src/geany-1.23.1$ diff data/python.tags
    /tech/home/car/share/geany/python.tags

    And I md5summed the tgz I got that from:

    car@denmark:~$ md5sum geany-1.23.1.tar.gz
    4ddfc1d1ed3b915eeb5797077ac12383 geany-1.23.1.tar.gz

    Is Geany's autocomplete behaviour such that it avoids autocompleting
    symbols until the user's supplied enough text not to match known keywords?
    Just guessing. Otherwise, given that the example I derived from the
    default Python template contains a string variable called "password", it
    seems to me that the symbol autocomplete should be offering me "password",
    just not at the expense of stopping me typing "pass".

    ;)

    Cheers,

    Chris.

     
  • Chris Reece
    Chris Reece
    2013-06-28

    I should also mention that the original problem was as you describe:
    autocompletion offering the symbols "pass_" and "password", which confused
    me because I couldn't find those defined anywhere in the project I was
    working on. Running 1.23.1 with clean (i.e. non-existent) config behaves
    slightly differently than it did before with my 0.21-derived config in play
    -- no offering of "pass_", and it offers "password" because there is a
    variable called "password" in the example.

    Are we maybe conflating a bug, which you've fixed in 1.23.1, and a
    behaviour I've requested a feature to avoid -- that of completing a symbol
    name where I was actually typing a keyword?

    Just clutching at straws.

    Cheers,

    Chris.

    On 28 June 2013 16:22, Lex Trotman elextr@users.sf.net wrote:

    I can confirm via git that the symbols "pass_" and "password" were removed
    from the Python.tags file between 1.22 and 1.23. I actually complained that
    I had to disable autocompletion due to the annoyance factor, so I agree
    with you completely that its a pain.

    What I am struggling to understand is why Geany appears to be using an old
    tags file. You seem to have built and run the new version correctly.

    Could you just check that /tech/home/car/share/geany/python.tags does not
    contain "password" at the start of a line (use gedit not Geany, its a
    partly binary file ).

    If it doesn't exist you could try copying this file over the installed
    system one and see if that fixes it.


    Status: pending
    Created: Thu Jun 27, 2013 09:26 PM UTC by Chris Reece
    Last Updated: Fri Jun 28, 2013 01:24 AM UTC
    Owner: nobody

    Apologies if this has been covered, I couldn't find a feature request for
    "autocomplete" that looked relevant.

    Symbol autocomplete (which is very useful) offers symbol alternatives as
    expected, but these symbols do not include language keywords. In the very
    specific case of writing Python, using the pass statement, which is
    naturally the end of a line, I'm getting autocompletes on symbols starting
    "pass", which are substituted in when I hit Return. This may be applicable
    under other circumstances, it's just "pass" that's biting me. I've verified
    this behaviour under 0.21 (via apt) and 1.23.1 (compiled just now) on:

    Linux denmark 3.2.45-custom-20130529 #1 SMP Wed May 29 10:43:58 NZST 2013
    x86_64 x86_64 x86_64 GNU/Linux

    running Kubuntu 12.04. Screenshot attached.

    I can work around by bumping the autocomplete length, but I wonder if it'd
    be possible to include keywords when autocompleting symbols?

    Many thanks for Geany -- I fell on it while trying to edit a 20,000 line
    YAML file (three cheers for folding!) and it looks like it might become my
    editor of choice.

    Cheers,

    Chris.

    Sent from sourceforge.net because you indicated interest in
    https://sourceforge.net/p/geany/feature-requests/677/

    To unsubscribe from further messages, please visit
    https://sourceforge.net/auth/subscriptions/

     

    Related

    Feature Requests: #677

  • Lex Trotman
    Lex Trotman
    2013-06-28

    I wasn't meaning to ignore the feature request, I was just hoping to solve part of your problem quickly.

    If you have another file open with the symbol "password", then the autocomplete will come from there irrespective of what is in the tags file.

    The autocomplete delay depends on the number of characters typed, default 4, you can set it in menu->edit->preferences->editor->completions.

    So on to the feature request (finally).

    Autocomplete knows nothing about keywords.

    The problem actually has nothing to do with keywords, any identifier that is a prefix of a symbol will, when typed at the end of the line, select the first symbol from the autocomplete list when you press enter.

    I have investigated changing the autocomplete accept character from return/enter but the default value for accepting an item selected on a list appears to be hard coded deep inside GTK and there is no way to change it.

    The problem appears mostly with Python since lines often end with symbols, whereas in C/C++ for example they usually have a semicolon. Some Python users have gotten into the habit of typing a space at the end of the line and letting the "strip space" setting fix it on save, but we don't have any good solution at this time. Suggestions are welcome.

     
  • Chris Reece
    Chris Reece
    2013-06-30

    Sorry about the delay, the weekend arrived not a moment too soon.

    On 28 June 2013 18:20, Lex Trotman elextr@users.sf.net wrote:

    I wasn't meaning to ignore the feature request, I was just hoping to solve
    part of your problem quickly.

    Sorry, my misunderstanding. Updating the python.tags file addresses that
    first problem. Thanks.

    The problem appears mostly with Python since lines often end with symbols,
    whereas in C/C++ for example they usually have a semicolon.

    Good point.

    Some Python users have gotten into the habit of typing a space at the end
    of the line and letting the "strip space" setting fix it on save, but we
    don't have any good solution at this time. Suggestions are welcome.

    Perhaps I'm misunderstanding some more. Wouldn't augmenting the
    autocomplete list with language keywords provide the solution without users
    having to develop this sort of tic? I can understand that some people
    might not want the list bloating; a preference would seem like a reasonable
    compromise.

    Cheers,

    Chris.

     
  • Lex Trotman
    Lex Trotman
    2013-07-01

    You should be able to write Python to generate a tag file in the simpler non-binary format (pipe-format, see the manual) for the keywords (taken from keyword.kwlist), call it say "keywords.python.tags" in your config directory and see how well it works. You can submit it if its useful or put it on the wiki.

    Including it in Geany will need to decide things like if its loaded by default, if its Python 2 or 3 keywords etc. That will need more discussion.