Coder Social home page Coder Social logo

Comments (7)

nicoespeon avatar nicoespeon commented on May 25, 2024 3

Great news @automatensalat πŸ‘‰ we have a fix!

Fabien and I did a pair-programming session and we found what the problem was. In short, recast (the library that parses the code on top of Babel) counted 4 characters per tab per default. But VS Code counts one. We fixed that discrepancy and everything works fine now.

I'll ship that fix by tomorrow (need to refactor something, update the changelog and ship) πŸ˜‰

from abracadabra.

nicoespeon avatar nicoespeon commented on May 25, 2024

Hi @automatensalat πŸ‘‹

Thanks for reporting. I'm really curious about this one because I can't reproduce it. I recorded a gif from my editor to show what it looks like with just this code:

CleanShot 2020-03-14 at 17 59 27

So for this specific example, I'm wondering why it doesn't work for you. My main hypothesis is: if it takes time for the editor to trigger the renaming for some reason (it's busy) and you start typing in the meantime, it may mess up the code? Is it what happened?

from abracadabra.

automatensalat avatar automatensalat commented on May 25, 2024

Hey @nicoespeon, that's not what happened, the refactoring executes immediately and I don't do any typing in the meantime. I'm going to look into it today to see what happens.

from abracadabra.

automatensalat avatar automatensalat commented on May 25, 2024

I believe this has to do with indention. As can be seen in your gif, you use two spaces for indention. The tabs from the example code probably get converted to spaces when saving. The refactoring works when used with spaces or no indention at all; it fails if indented with tabs.
I'll look into it and try to find a solution.

Edit: The node.loc seems to be screwed up when used with tabs. But that part is Babel, right?

abracadabra-extract-var

from abracadabra.

nicoespeon avatar nicoespeon commented on May 25, 2024

Edit: The node.loc seems to be screwed up when used with tabs. But that part is Babel, right?

Oooooh, great catch!

Yeah, that's probably Babel since it does the parsing. But IΒ don't get why tabs would screw up the node.loc. If it does, there might be another attribute we could use.

You make me realize we never wrote unit tests with tabs inside. I think I can simulate that easily now. Will see if we can find a fix πŸ‘

from abracadabra.

automatensalat avatar automatensalat commented on May 25, 2024

That's great, thanks! πŸ‘‹

from abracadabra.

nicoespeon avatar nicoespeon commented on May 25, 2024

Fixed in the last release (v3.2.3) πŸ‘

from abracadabra.

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.