royqh1979 / RedPanda-CPP

A light-weight C/C++ IDE based on Qt
GNU General Public License v3.0
938 stars 102 forks source link

在有后缀调用的括号中,编辑器不显示局部变量的补全提示 #388

Closed West-Pavilion closed 4 months ago

West-Pavilion commented 4 months ago

在有后缀调用的括号中,编辑器不显示局部变量的补全提示

这是在修改 std::thread 构造函数参数时发现的现象

请考虑如下的 C++ 代码:

#include <thread>
#include <iostream>

/* 在有后缀调用的括号中,编辑器不显示局部变量的补全提示 */

int main() {
    static int counter = 3000;
    auto buy = [] {
        while (counter > 0) {
            std::cout << std::this_thread::get_id() << ": " << --counter << std::endl;
        }
    };
    /* 将光标放到 thread 构造函数的括号中,尝试输入 buy 会发现编辑器不显示其补全提示 */
    std::thread().join();
    std::thread(buy).join();
}

如下图所示,编辑器不显示局部变量 buy 的补全提示 屏幕截图(372)

下面是对应的测试代码:

在有后缀调用的括号中,编辑器不显示局部变量的补全提示.zip