Skip to content

Only update lines that have changed #26

Open

Description

@neoGeneva

At the moment if there's a single change made by prettier in a file then the whole files text is replaced, that means every line is shown as changed in VS, and for large files the syntax highlighting takes a little while to re-parse the file which can be a little jarring.

It'd be better if only the changed lines were updated, if possible.

Activity

  1. tommck commented on Jan 27, 2019

    @tommck
    Contributor
  2. neoGeneva commented on Jan 27, 2019

    @neoGeneva
    Author

    Well there's certainly plenty of diffing libraries in NuGet, though it might be a bit of work figuring out which one performs the best, and produces the best results. There's lots on NPM as well, it might turn out it's easier to do the diff on the Node side of things.

    I am unsure of how you'd apply the changes back into the VS text editor, I'm no very familiar with it, but I'm assuming there's a cursor you can use to use to select and delete / change code.

    Though maybe I'm oversimplifying the problem, I might give fork this repo and see what happens.

  3. neoGeneva commented on Jan 28, 2019

    @neoGeneva
    Author

    So here's a quick proof on concept, I haven't tested it with many edge cases (single line files or whatever), and I just picked the first NuGet package without any weird dependencies, and I'm guessing doing a bunch of TextBuffer.CreateEdit() / Apply() isn't super efficient.

    But I don't think it'd take much to finish it up if others think there's value in it.

    neoGeneva@df89085

  4. tommck commented on Jan 28, 2019

    @tommck
    Contributor
  5. tommck commented on Jun 10, 2019

    @tommck
    Contributor

    @madskristensen would you be cool adding reference to a 3rd party library like in @neoGeneva's code referenced above?

  6. ruffin-- commented on Aug 27, 2020

    @ruffin--
    Contributor

    Okay, I know bumps aren't kosher, but it's been a year, so @madskristensen whaddya think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions