Comments (8)
That's fair. It's an important issue to tackle if we want to keep the extension useful.
Fabien and I weren't available to work on this in the last few weeks for personal reasons (+ conferences on my side). I'm still busy next week but we might find some time to tackle this next Thursday!
Otherwise we will tackle it in 2 weeks. Not ideal, but it will do.
From what you said, we should upgrade the version and fix the compiler errors that happens (because some function we use have changed their signatures, hopefully just a few of them).
from abracadabra.
Released in version 3.2.2.
Thank you @David-Else 👍
from abracadabra.
@David-Else thanks for being on top of the latest features and letting us know, that really helps 👍
Yes, I guess upgrading the dependency should do the work. Maybe there's a new plugin to use here:
abracadabra/src/ast/transformation.ts
Lines 74 to 97 in 4981bfb
Hopefully, any regression should be caught by our unit tests, so it's a safe move to make.
Can you take care of it? Otherwise, @fabien0102 and I will likely do it next week 😉
from abracadabra.
This article goes deep on what needs to be done:
https://www.infoq.com/news/2020/01/babel-typescript-await/
I spent a while reading about how Babel works, and it seems I would need a few days to really get a grip on things. Would be cool is fabian sorted it :)
In my reading I found https://github.com/alangpierce/sucrase which is 20x faster than babel and a drop in replacement. VS Code runs a fixed version of V8/Electron for long periods of time, so abracadabra
should not need all the extra babel baggage?
I don't quite know how babel stays updated with the latest typescript features, but 3.8 has import type
coming too https://www.infoworld.com/article/3513938/typescript-38-unveils-new-syntax-for-type-only-imports.html
from abracadabra.
Just as an update, VS Code 1.42 came out yesterday. It has support built in for TS 3.8 new features for JS and TS, but ships with TS 3.7.5. To use the new feature (inc top level await and JS private properties) you need to either:
-
Install https://marketplace.visualstudio.com/items?itemName=ms-vscode.vscode-typescript-next
-
or if you prefer the more stable 3.81rc version that also came out yesterday:
npm install -g typescript@rc
settings.json (main global file, link will be different depending on your package manager)
"typescript.tsdk": "/home/user/.nvm/versions/node/v12.15.0/pnpm-global/3/node_modules/typescript/lib"
- or just install
typescript@rc
in your project and select to use it in the VS Code interface bottom right.
from abracadabra.
I had a go at updating babel to the latest, so this was the only change I made:
"@babel/parser": "^7.8.4",
"@babel/traverse": "^7.8.4",
"@babel/types": "^7.8.3",
On running the tests I get many failure which all relate to this function in convert-to-template-literal.ts
function createTemplateLiteral(template: Template): t.TemplateLiteral {
return t.templateLiteral(
// Intermediate interpolated quasis shouldn't be part of the final template.
template.quasis.filter(quasi => !isInterpolated(quasi) || quasi.tail),
template.expressions
);
}
Here is the first error of many, I am afraid I don't know how to fix this problem.
FAIL src/refactorings/convert-to-template-literal/convert-to-template-literal.test.ts
● Convert To Template Literal › should convert to template literal › concatenation with number, cursor on string
TypeError: Property value of TemplateElement expected to have the following:
Property raw expected type of string but got number
Property cooked expected type of string but got number
61 | */
62 | function templateElement(value: string | number | boolean): t.TemplateElement {
> 63 | return t.templateElement({
| ^
64 | raw: value,
65 | cooked: value
66 | });
at Object.validate (node_modules/.pnpm/registry.npmjs.org/@babel/types/7.8.3/node_modules/@babel/types/lib/definitions/utils.js:185:13)
at validateField (node_modules/.pnpm/registry.npmjs.org/@babel/types/7.8.3/node_modules/@babel/types/lib/validators/validate.js:24:9)
at validate (node_modules/.pnpm/registry.npmjs.org/@babel/types/7.8.3/node_modules/@babel/types/lib/validators/validate.js:17:3)
at builder (node_modules/.pnpm/registry.npmjs.org/@babel/types/7.8.3/node_modules/@babel/types/lib/builders/builder.js:38:27)
at Object.TemplateElement (node_modules/.pnpm/registry.npmjs.org/@babel/types/7.8.3/node_modules/@babel/types/lib/builders/generated/index.js:538:31)
at Object.templateElement (src/ast/domain.ts:63:12)
at PrimitiveTemplate.get quasis [as quasis] (src/refactorings/convert-to-template-literal/convert-to-template-literal.ts:186:15)
at CompositeTemplate.get quasis [as quasis] (src/refactorings/convert-to-template-literal/convert-to-template-literal.ts:135:48)
at createTemplateLiteral (src/refactorings/convert-to-template-literal/convert-to-template-literal.ts:113:14)
at BinaryExpression (src/refactorings/convert-to-template-literal/convert-to-template-literal.ts:64:24)
from abracadabra.
The signature of templateElement()
probably changed. We'll need to double check the changelog to see if the differences are documented =)
from abracadabra.
VS Code with TypeScript 3.8 built in is out tomorrow... No pressure :) abracadabra is currently not working with any new TypeScript language features, TS 3.8 has been out a couple of weeks now:
https://devblogs.microsoft.com/typescript/announcing-typescript-3-8/
@David-Else thanks for being on top of the latest features and letting us know, that really helps +1
As well as full support for top level await/private fields there is now a built in convert-to-template-string-refactoring
refactoring, so maybe the abracadabra one is not needed now?
I won't keep hassling you I promise, this will be the last reminder. I don't think the next TS 3.9 will have any new language features, you should not have to deal with any out-dating for quite a long time :)
from abracadabra.
Related Issues (20)
- Automatically "Convert to Template String" if we write ${} in a string HOT 2
- Convert getter / setter to member functions
- 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.