springeye / vue-for-idea

This is vue plugin for idea
https://plugins.jetbrains.com/plugin/9188
BSD 3-Clause "New" or "Revised" License
321 stars 45 forks source link

ES6 support in <script> block #3

Closed probil closed 8 years ago

probil commented 8 years ago

I have configured ES6 as default JavaScript version, but when I use ES6 syntax inside <script> block WebStorm lint me "error syntax". Error in arrow function

Do you have the same issue? Maybe, this could be fixed by this plugin? There is no such issue when I use arrow function inside *.js files

agileago commented 8 years ago

@probil you can add type="text/babel" to solve it image

probil commented 8 years ago

@agileago Thanks for the advice! Work as expected now.

So, maybe vue-for-idea should add it automatically on File > New > Vue Component?

springeye commented 8 years ago

@probil new version is supported qq 20160112173433

probil commented 8 years ago

After plugin update I have created new Vue File.

Emm

And I don't see type="text/babel in script tag. So, ES6 syntax still not working. There is also error in code.

springeye commented 8 years ago

@probil ES6 the problem may be in the next period of time to be able to deal with. Because at the moment I am not very well aware of the idea plug-in development and syntax analysis. In the learning...

richarddewit commented 8 years ago

@probil - Default it's ES5, if you want to use ES6 you'd have to put type="text/babel there yourself.

@henjue - would be nice if people could choose which type of script/css/template they want by default in the settings

Example (dropdowns): Preferences -> Languages & Frameworks -> Vue

                           ________________
                           |          |   |
Default stylesheet type:   | CSS      | v |
                           |__________|___|
                           |          |
                           | - SASS   |
                           | - Stylus |
                           | - Less   |
                           |__________|

                           ________________________
                           |                  |   |
Default script type:       | JavaScript (ES5) | v |
                           |__________________|___|
                           |                  |
                           | - CoffeeScript   |
                           | - ES6/Babel      |
                           | - TypeScript     |
                           |__________________|

                           ____________________
                           |              |   |
Default template type:     | HTML         | v |
                           |______________|___|
                           |              |
                           | - Jade       |
                           | - Handlebars |
                           |______________|
springeye commented 8 years ago

@richarddewit I want to according to Lang, and then deal with the code in tag

JoshZA commented 8 years ago

:+1: for dropdowns

exotfboy commented 8 years ago

Hi,, event I add the type = text/babel, idea can not recognize the arrow function in the .vue file:

1

However, in a pure .js script, the arrow function can be recognized: 2

What's going on ?

probil commented 8 years ago

@exotfboy What JetBrains IDE do you use? WebStorm/PhpStorm/IntelliJ IDEA? Could you upload example somewhere?

agileago commented 8 years ago

@probil now webstorm eap 12 support inline sass/less . like this image

it is great!

luwenjin commented 8 years ago

@henjue According to lang will be best. es6/coffeescript/less/scss all have workarounds. but <template lang="jade"> has no way to trigger syntax highlight.

springeye commented 8 years ago

Please update version to 1.0.7 1.0.7 support LESS,SASS,SCSS,Stylus,CSS,ES6,CoffeeScript,JavaScript

szkrd commented 8 years ago

No, it doesn't work here either. Webstorm 11.0.4 screen shot 2016-06-30 at 21 52 48 screen shot 2016-06-30 at 21 51 43

probil commented 8 years ago

Yeah. Plugin works strange. So, I have deleted it and use type="text/babel" instead. :disappointed: Plugin rather confuses than helps.

springeye commented 8 years ago

Do not use the type attribute, use the lang,about vue-loader see http://vue-loader.vuejs.org/en/index.html

szkrd commented 8 years ago

Maybe I'm still missing something. Could you attach a screenshot with your settings and fat arrows not underlined? It would be really helpful! Vue-loader is 8.3.0, thank you!

screen shot 2016-07-04 at 20 56 43 screen shot 2016-07-04 at 20 54 19 screen shot 2016-07-04 at 20 53 59

springeye commented 8 years ago

@szkrd use lang="javascript",not use "text/javascript",see http://vue-loader.vuejs.org/en/index.html

szkrd commented 8 years ago

Unfortunately that didn't help :(

16-07-07

rockxsj commented 8 years ago

@szkrd I have the same problem :(

wafs commented 8 years ago

@szkrd @rockxsj @henjue The way to get es6 working is not lang="javascript", but in fact lang="babel" (not sure why this works over your official word of mouth though!)

image

image

http://stackoverflow.com/a/38141782

szkrd commented 8 years ago

@wafs you are my hero

rockxsj commented 8 years ago

@wafs thanks! upgrade webstorm to 2016.2,the bug has fixed. 👍