Giter Site home page Giter Site logo

Comments (7)

thijsdezoete avatar thijsdezoete commented on May 14, 2024

This is only possible if you're not running the thing after just opening a file, what is the extra value by doing this(other than saving a few cpu cycles)?

from isort.

timothycrosley avatar timothycrosley commented on May 14, 2024

This is really specific to the kate plugin, as I was informed by another kate plugin writer that replacing all text can lead to worse then expected performance degredation. Even so i may not implement it as it seems to me something that should be optimized in kate itself

from isort.

thijsdezoete avatar thijsdezoete commented on May 14, 2024

Ah, ok.. Perhaps something to share with the kate development team. :)

from isort.

timothycrosley avatar timothycrosley commented on May 14, 2024

Agreed changing this to wontfix and will notify them :)

from isort.

zaufi avatar zaufi commented on May 14, 2024

there is nothing to notify about...

from isort.

timothycrosley avatar timothycrosley commented on May 14, 2024

@zaufi does your old comment about Kate having to reparse, highlight, setup undo action, & etc no longer apply? I suppose an undo action is actually the desired behavior (as if something happens undesired when sorting I do want the user to be able to undo it). However, when initially writing the plugin I assumed Kate was smart enough to not re-parse / repaint everything if only a small portion of the file had changed (ie it shouldn't be faster to diff the changes that smartly reinsert - then just for me to reinsert the text) but your comment made me believe otherwise? Did I misunderstand the issue?

from isort.

zaufi avatar zaufi commented on May 14, 2024

@timothycrosley yes, it is -- if u r going to setText() kate will do a lot of work... but there is no other way to do so: if u tell to a KTextEditor::Document to replace whole text w/ smth else, kate do not care about what it contains before... it just clear() internal buffer (setting undo action, and remembering line marks) and do everything from the beginning (starting from lines split and finishing w/ restoring marks). Thanx to fast CPUs we have nowadays it happens fast enough, but resetting whole document is a bad practise anyway.
And I bet nobody in the kate team will take care about "what if 99% of the reinserted text is the same as it was before" and handle this case... Kate's internals are complicated enough already even w/o this "feature"... and kate team work hard to make it faster (for example having too much RegExps in a syntax file also considered as a bad practise :) -- not talking about resetting a whole document... so it is a matter of plugin writer to make it as fast as he can... If u can't -- don't worry. Just hope users w/ fast CPUs will notice nothing ;-)

from isort.

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.