Sarcasm / company-irony

company-mode completion back-end for irony-mode
119 stars 11 forks source link

Bizarre failure to complete #14

Open luc-j-bourhis opened 9 years ago

luc-j-bourhis commented 9 years ago

I have a file foo.h:

#pragma once

class bar
{
public:
  bar(int x) : x(x) {}
  int val() const { return x; }
private:
  int x;
};

and a file foo.cpp:

#include "foo.h"

double foo() {
  bar xs, *xs1 = xs, xs2 = xs;
  xs.
}

No completion appear after xs. but they do appear after xs1-> and xs2.!!!

This is with company-irony 20150810.239 and irony 20150831.144.

Sarcasm commented 9 years ago

It's not the failure that is bizarre but your code :)

Changing the code to bar xs(1), *xs1 = xs, xs2 = xs; makes the completion work

luc-j-bourhis commented 9 years ago

On 11 Sep 2015, at 10:11, Guillaume Papin notifications@github.com wrote:

It's not the failure that is bizarre but your code :)

bar xs is not a valid declaration/definition. bar constructor takes an int

Thanks for your prompt answer. Highly appreciated.

So first how can I display such diagnostics? Then is that a feature or a deficiency? I mean, first this is autocompletion, not a validation tool. And then if validation we want on the top of autocompletion, then silently failing to complete is not the best idea, is it? Some feedback seems in order, doesn’t it? But I may have missed how to enable such feedback.

Best wishes,

Luc

Sarcasm commented 9 years ago

So first how can I display such diagnostics?

https://github.com/Sarcasm/flycheck-irony

Then is that a feature or a deficiency?

It's expected behavior. libclang is backed by a real compiler, if you provide semantically incorrect information the completion may not work.