Coder Social home page Coder Social logo

Comments (4)

prabirshrestha avatar prabirshrestha commented on May 18, 2024

This should be easy to implement. Need to update s:python_refresh_completions.

Here is the pseudo code.

for [l:name, l:info] in sort_by_priority(items(s:matches))

from asyncomplete.vim.

lithammer avatar lithammer commented on May 18, 2024

Hmm, I'm bad a Vim script, so this is probably inefficient. But wouldn't this work? Seems to do the trick when I tried it for a minute.

diff --git a/autoload/asyncomplete.vim b/autoload/asyncomplete.vim
index b102471..3fa7e6c 100644
--- a/autoload/asyncomplete.vim
+++ b/autoload/asyncomplete.vim
@@ -326,6 +326,7 @@ function! s:python_refresh_completions(ctx) abort
 
     let l:filtered_matches = []
 
+    let l:matches = filter(copy(l:matches), 'index(l:matches, v:val, v:key+1) == -1')
     let l:sources = sort(keys(s:matches), function('s:sort_sources_by_priority'))
 
     for l:name in l:sources

Mostly stolen from https://stackoverflow.com/a/6630950/1862923

from asyncomplete.vim.

prabirshrestha avatar prabirshrestha commented on May 18, 2024

@Renstrom it works but could slow down if you have lot of items. If we put this behind a flag I'm ok with it. Feel free to send a PR.

Out of curiosity what language are you using? I mainly use typescript and I disable all buffer, syntax and omni sources when in Typescript. If I don't have a proper language server I use omni, followed by syntax and then buffer.

from asyncomplete.vim.

lithammer avatar lithammer commented on May 18, 2024

Feel free to send a PR.

I'll see what I can do.

Out of curiosity what language are you using?

Well mainly Python. But also a bunch of other languages every now and then like C/C++, Markdown, YAML, Go, Rust, Bash, Javascript, etc. But now that you mention it, I could certainly improve my white- and blacklists for my sources! I still think dedupe is a worthy feature though, especially coupled with priority (just noticed a bug in the diff, the dedupe should happen after sorting).

from asyncomplete.vim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.