[Github-comments] [geany/geany] Enable local variables for C/C++ and improve autocompletion (PR #3185)

elextr notifications at github.com
Tue May 10 03:22:42 UTC 2022


> But @techee whichever state you decide on, please document the intended behaviour so I know what to test.

Many observers will have been astonished that I haven't mentioned my favourite topic (documentation) so far.  Thats because any attempt to describe the behaviour has seemed wordy, complex, and confusing.  But I have had an idea which @techee can use to do the above, and the manual at the same time :smile:

It appears that using tables[^1] in an appendix will make it clearer (I am not sure the contents are right, @techee to fix when he decides the version to be merged):

# Autocompletion behaviour

## C++ Autocompletion[^2]

| category of symbol | autocomplete list | base for scope completion |
| --- | --- | --- |
| function local declared before the cursor | sorted to first group then alphabetically | prioritised first, closest declaration wins |
| function local declared after the cursor | sorted to first group then alphabetically | not considered |
| data member of class parent to function | sorted to second group then alphabetically | prioritised second |
| declaration in header of current file | sorted last group then alphabetically | prioritised third |
| other symbol | sorted last group then alphabetically | prioritised last |

In the Geany manual I would put the tables for each language in an appendix and refer to it from the [autocompletion](https://www.geany.org/manual/current/index.html#autocompletion) section with a sentence like "For some languages the autocompletion list is ordered by heuristics to attempt to show names that are more likely to be what the user wants close to the top of the list.  See [Autocompletion behaviour] for the list ordering used for languages where it is applied."

And in the scope autocompletion section replace the last sentence with "Most languages only parse global definitions and so scope autocompletion will not work for names declared in local scope.  A few languages parse both local and global symbols and this makes it more likely that the base name (eg `this_name->`) occurs more than once in the available symbols meaning possible scope completions from several types could be mixed.  Geany does not have exact symbol scoping and visibility information to resolve which definition is to be used, so to disambiguate this situation Geany uses a heuristic described in [Autocompletion behaviour] to prioritise the possible completions which are most likely to be what the user wants."

[^1]: sorry its markdown not rest, but I wanted it to show in github
[^2]: C++ is not C, so they are different, it is left as an exercise for the reader to make the C table, and in future the Python table

-- 
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/3185#issuecomment-1121843559
You are receiving this because you are subscribed to this thread.

Message ID: <geany/geany/pull/3185/c1121843559 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20220509/37958cf1/attachment.htm>


More information about the Github-comments mailing list