Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed company-semantic-annotation, so that it .. #550

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

differentiablef
Copy link

.. can appropriately deal with function pointers in C.

As an example of the original problem, consider the struct

struct blah { int (*hates)(uint8_t, uint32_t); void *blank; }

the annotation returned by company-semantic-annotation for 'hates' would be
(*hates)(uint8_t, uint32_t)
which when coupled with the default value of 'company-semantic-insert-arguments'
yields decidedly annoying results.

This patch fixes the problem. Additionally. I've attached a sequence of screenshots
illustrating the problem.

prepatch
prepatch2
prepatch3
postpatch
postpatch2
postpatch3

The issue with the original code seems to be the implicit assumption that the
type of blah::hates is not seen as a function by semantic. This is incorrect, as
semantic properly designates it a function-pointer which being callable, makes it
a function.

.. can appropriately deal with function pointers in C.

As an example of the original problem, consider the struct

   struct blah {
       int (*hates)(uint8_t, uint32_t);
       void *blank;
   }

the annotation returned by company-semantic-annotation would be
         (*hates)(uint8_t, uint32_t)
which when coupled with the default value of 'company-semantic-insert-arguments'
yields decidedly annoying results. 

This patch fixes the problem. Additionally. you can find a gallery 
of screenshots illustrating the problem http://imgur.com/gallery/pyxwg

The issue with the original code seems to be the implicit assumption that the 
type of blah::hates is not seen as a function by semantic. This is incorrect, as 
semantic properly designates it a function-pointer which being callable, makes it 
a function.
@dgutov
Copy link
Member

dgutov commented Jul 3, 2016

Thanks! This looks good, but a bit nontrivial. Could you add a couple of tests as well?

@differentiablef
Copy link
Author

Will do

@dgutov
Copy link
Member

dgutov commented Feb 28, 2018

@differentiablef Ping?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants