Giter VIP home page Giter VIP logo

Comments (14)

tweekmonster avatar tweekmonster commented on June 2, 2024

Strange. The old cache should be completely replaced, not updated. I can't reproduce your example, but I also noticed that it sometimes doesn't add [jedi] for some completions until I try completing again.

from deoplete-jedi.

zchee avatar zchee commented on June 2, 2024

@tweekmonster
I was type
c - <BS> - s - <BS> - t
Maybe reproduced it.

I debbuging now.

from deoplete-jedi.

zchee avatar zchee commented on June 2, 2024

@tweekmonster
I found the regularity.
This seems more likely to occur in Python builtins.
but, Sometimes it occurs even otherwise :(

screenshot 2016-03-19 01 08 15

from deoplete-jedi.

tweekmonster avatar tweekmonster commented on June 2, 2024

Hmm. Does deoplete.nvim modify the results dict? If so, that may be the problem.

https://github.com/zchee/deoplete-jedi/blob/master/rplugin/python3/deoplete/sources/deoplete_jedi.py#L183

On L183, try changing it to:

out = cached.get('completions', [])[:]

To return a copy of the cache.

from deoplete-jedi.

zchee avatar zchee commented on June 2, 2024

@tweekmonster Yes! I have found the cause.

If menu is empty, deoplete.nvim will be add self.mark to menu.
https://github.com/Shougo/deoplete.nvim/blob/master/rplugin/python3/deoplete/deoplete.py#L215-L221
It's not a bug. specification of deoplete.nvim.

So, We need a

            out.append({
                '$type': _type,
                'word': word,
                'abbr': abbr,
                'kind': self.format_description(c.description),
                'info': docstring,
                # this line
                'menu': self.mark,
                'dup': 1,
            })

The problem does not occur.

from deoplete-jedi.

tweekmonster avatar tweekmonster commented on June 2, 2024

@zchee Great! Seems strange that it was accumulating marks though. Maybe that accumulation is a bug itself. If deoplete.nvim was adding it, that means it was no longer empty and shouldn't add it again.

from deoplete-jedi.

zchee avatar zchee commented on June 2, 2024

@tweekmonster Hmm...
Is that regex wrong?

re.match(r'\[.*\]', context['candidates'][0].get('menu', ''))):

from deoplete-jedi.

tweekmonster avatar tweekmonster commented on June 2, 2024

@zchee It's not wrong. The only issue I see with it is re.match() vs re.search() which may have unintended results. https://docs.python.org/3.4/library/re.html#search-vs-match
For example, if Base.mark is set to ' [jedi]' it won't match.

The issue I see is here: https://github.com/Shougo/deoplete.nvim/blob/master/rplugin/python3/deoplete/deoplete.py#L215

On that line, it only checks the first completion. If there are multiple sources mixed in the results, and the first one doesn't have menu defined, all of them are updated even if other results already have the menu key:

candidate['menu'] = source.mark + ' ' + candidate.get('menu', '')

from deoplete-jedi.

zchee avatar zchee commented on June 2, 2024

@tweekmonster OK. I understand.
and, Thanks for good reference :)

but, If fix deoplete.nvim behavior to check all candidates['menu'] in context['candidates'] list, will reduce performance.

So, I think a better way is only to add 'menu': self.mark, for now.
WDYT?

from deoplete-jedi.

tweekmonster avatar tweekmonster commented on June 2, 2024

@zchee That will work, but only for this case. If another source comes before Jedi, I think duplicates will happen again. I might be wrong since I don't know deoplete.nvim as well as you do.

For performance concerns, I think deoplete.nvim should not do the menu update on L215. It should do it in merge_results() since there is already a loop occurring there: https://github.com/Shougo/deoplete.nvim/blob/master/rplugin/python3/deoplete/deoplete.py#L248 (and it might need to happen on L238, too)

Actually I read over deoplete.py again, and I think I'm getting the indent scopes confused. Are the results from multiple sources combined before L215?

from deoplete-jedi.

zchee avatar zchee commented on June 2, 2024

@tweekmonster Yes, only for this case. I was known.

but, but... Now deoplete-jedi master branch will occur self.mark duplicate.
It will increase the other issue thread.

So, add 'menu': self.mark, for now.
But, If I or you or Shougo resolved this problem someday, will revert (remove) 'menu': self.mark,.
It's tentative workaround.

How would you like it? πŸ™

from deoplete-jedi.

zchee avatar zchee commented on June 2, 2024

@tweekmonster I also read deoplete.nvim sources.
I will do my best to resolve.

from deoplete-jedi.

tweekmonster avatar tweekmonster commented on June 2, 2024

How would you like it? πŸ™

あγͺγŸγŒδΈŠεΈγ§γ™ πŸ‘Œ

from deoplete-jedi.

zchee avatar zchee commented on June 2, 2024

@tweekmonster lol.
Committed: a5b10f6

To avoid misunderstanding of the other users, close once.
but, We should remember this matter.

from deoplete-jedi.

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.