minad / corfu

:desert_island: corfu.el - COmpletion in Region FUnction
GNU General Public License v3.0
1.15k stars 43 forks source link

Auto include rust packages. #267

Closed farazshaikh closed 1 year ago

farazshaikh commented 1 year ago

Company LSP for rust can pull in the headers when traits are referenced from completions.

For example. In company

  if let Ok(mut f) = File::create(p) {
        f.seek() <Completion>
    }

Auto inserts the package inclusion directive, along with the completion. i.e the following line is inserted automatically

use std::io::seek;

I am seeing inconsistent behavior with corfu

  1. with (corfu) seek() doesn't show up in completions, (corfu-auto t) With tab completion, seek() shows up under tab-cycle but not in the drop-down.

Probably, Corfu is missing a completion backend. And somehow the company is able to pull in methods/traits outside the ones that are included in the current source file.

But then using for corfu completion is somehow picking up the foreign trait.

minad commented 1 year ago

This is a backend issue (lsp-mode). Therefore I recommend asking on their issue tracker or discussion forum.