Comments (7)
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.
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:
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.
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.
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?
from abracadabra.
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.
That's great, thanks! π
from abracadabra.
Fixed in the last release (v3.2.3) π
from abracadabra.
Related Issues (20)
- Automatically "Convert to Template String" if we write ${} in a string HOT 2
- Abracadabra does not play nice with cursorless HOT 29
- Inlining JSX removes curly braces HOT 1
- Extract refactoring runs on JSX attribute HOT 3
- Inline async arrow function misses braces HOT 1
- Abracadabra replaces system key binding HOT 3
- Extract Variable insert position doesn't right HOT 2
- change activationEvent to onLanguage
- Idea: Migrate to TypeScript plugin HOT 4
- "Change Signature" doesn't work on a nested function HOT 3
- "Add explicit type" refactoring HOT 1
- Inline variable if ternary misses parens HOT 5
- split declaration & init when working inside class
- JS and TS code without `;` is broken after refactoring HOT 3
- Abracadabra extension causes performance issues with other extensions (prettier formatting, etc.) HOT 7
- More inline variable missing parentheses edge-cases HOT 1
- Can't move class to an existing file HOT 2
- Move to new file: configure case of the new filename HOT 3
- Upgrade babel/traverse ti eliminate vulnerability. HOT 1
- Convert to Arrow Function: Does not work with a `export default function` HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from abracadabra.