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

Default behavior from nvim-cmp #1

Open
zjp-CN opened this issue Mar 30, 2024 · 3 comments
Open

Default behavior from nvim-cmp #1

zjp-CN opened this issue Mar 30, 2024 · 3 comments

Comments

@zjp-CN
Copy link
Owner

zjp-CN commented Mar 30, 2024

[package]
name = "xxx"
version = "0.1.0"
edition = "2021"

[dependencies]
color-eyre = "0.6.3"
ratatui = "0.26"
#![allow(unused)]
use ratatui::prelude::*;

fn main() {
    let s = S {
        s: String::from("hello"),
    };
    // type `s.` and you'll see random completion list
}

struct S {
    s: String,
}

impl S {
    pub fn render(&self, buf: &mut Buffer) {}

    pub fn zzzz(&self) {}
}

impl Widget for &S {
    fn render(self, area: Rect, buf: &mut Buffer) {}
}

Radomness here means you'll see very puzzling, unpredictable and counterintuitive list when somthing changes, when you even add a method without closing the current file!

@zjp-CN
Copy link
Owner Author

zjp-CN commented Mar 30, 2024

Better Sorting For Methods

截图_20240330165010

截图_20240330165304

@zjp-CN
Copy link
Owner Author

zjp-CN commented Mar 30, 2024

Better Sorting for Modules

截图_20240331011435

@zjp-CN
Copy link
Owner Author

zjp-CN commented Apr 1, 2024

Toggle Between Comparators

toggle-combo

Rust code in this picture: add some inherent methods and a blanket trait method in scope to see more completion behavior
// deps: ratatui and color-eyre
#![allow(unused)]
use ratatui::prelude::*;

fn main() {
    let s = S {
        s: String::from("hello"),
    };
    s.f();
    s.zzzz();
    // s.
}

struct S {
    s: String,
}

impl S {
    pub fn render(&self, buf: &mut Buffer) {}

    pub fn zzzz(&self) {}
}

impl Widget for &S {
    fn render(self, area: Rect, buf: &mut Buffer) {}
}

trait AAA {
    fn f(&self) {}
    fn z(&self) {}
}

impl AAA for S {}

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

No branches or pull requests

1 participant