tcbrindle / flux

A C++20 library for sequence-orientated programming
https://tristanbrindle.com/flux/
Boost Software License 1.0
484 stars 29 forks source link

Visual studio\code intellisense experience #187

Open Chrys4lisfag opened 4 months ago

Chrys4lisfag commented 4 months ago

Decided to take a look at the framework and experienced some issues with VisualStudio (both MSVC\Clang) and Visual Code IDE.

After the first adapter intellisense has issues in guessing the return type which makes developing inconvenient or mostly impossible. The code compiles just fine but no type guessing, so not possible to look for methods etc.

As I understand this is purely intellisense issue but does anyone know of a way to fix this? image

tcbrindle commented 4 months ago

Hi, thanks for the bug report.

I've just been playing with Flux in VS Code (I normally use CLion), and unfortunately you're absolutely right. From what I can tell, VS's Intellisense doesn't like any use of the CRTP "derived" class name in constraints on base class member functions.

For example, the declaration of filter in inline_sequence_base is:

template <typename Derived>
struct inline_sequence_base {
    template <typename Pred>
        requires std::predicate<Pred&, element_t<Derived>> // <- Here
    auto filter(Pred pred) &&;

    /* ...many other functions... */
}

It seems like it's the use of the name Derived in the constraint here that is tripping things up. Other methods which don't have constraints in this style (e.g. stride() or take()) seem to work okay.

This looks like a bug in VS's Intellisense rather than anything we're doing wrong in Flux, but it's quite an annoying one! Hopefully it will be sorted at some point but in the mean time I'll leave this open in case anyone else knows of a workaround.