Hi,

On Mon, Nov 15, 2021 at 7:33 AM Boris Staletic <[email protected]>
wrote:

> @brammool <https://github.com/brammool> @yegappan
> <https://github.com/yegappan> Thanks for replying.
>
> How are you using the property dict value returned by prop_list()?
>
> That's over here:
>
>    1. Gathering and filtering:
>    
> https://github.com/ycm-core/YouCompleteMe/blob/master/python/ycm/vimsupport.py#L217-L224
>    2. Skipping the ones we want to keep:
>    
> https://github.com/ycm-core/YouCompleteMe/blob/master/python/ycm/diagnostic_interface.py#L149
>    3. Dropping stale ones:
>    
> https://github.com/ycm-core/YouCompleteMe/blob/master/python/ycm/diagnostic_interface.py#L158-L159
>
> If you have a text property that spans multiple lines, then you cannot
> simply modify the value returned by prop_list_range() and place the text
> properties again.
>
> I'm pretty sure we don't handle multiline properties 100% correctly. Is it
> okay if we ignore them for the sake of this discussion?
>
> What is the overhead caused by? If it's calling prop_list() for every
> line, we could add an entry in the {props} argument "linecount".
>
> The test case was with zero actually placed properties, so there was
> nothing to actually filter. That suggests the repeated calls to
> prop_list() is the slow part.
>
> As for returning (and subsequently filtering) tons of properties belonging
> to a different plugin, that seems like a much more unlikely situation. I'm
> leaning towards ignoring it until a user complains.
>
> Whatever solution we pick, it is likely still slow for a very long file.
>
> Yeah, for really long files we do bail out early and just refuse to even
> try. At least now we do - there was a bug where we tried do update text
> properties even for files where b:ycm_largefile was set.
>
> Still, it feels like there should be a way to optimize the "get all props
> for buffer B placed by me" use case.
>
>
>
Based on Bram's comment, I have modified the prop_list() function to accept
an optional
end_lnum, type and id items in {props}. If end_lnum is specified, then the
function returns
all the text properties between lnum and end_lnum. If 'type' is specified,
then returns only
the text properties with type 'type' (same for 'id').

The changes are available at:

https://github.com/yegappan/vim/tree/textprop

Can you try this out?

Thanks,
Yegappan

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/CAAW7x7mR7m2tuF2egFzdcOKGC9HyCcEFgRAsitH_ZCVL7eyLUw%40mail.gmail.com.

Raspunde prin e-mail lui