nuxt-community / typescript-template

Typescript starter for Nuxt 2
https://nuxt-ts-template.netlify.app/
MIT License
643 stars 114 forks source link

What is it the better snippet (highlight extension) for VSC? #5

Closed fortil closed 6 years ago

fortil commented 7 years ago

Hi

I am working with VSC, nuxtjs and typescript, but in the .vue files I can't to see very well the syntax, I installed Vuter, but always it show this error

Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.

also, some any another errors that in .ts files aren't shows

Thanks

This question is available on Nuxt.js community (#c2)
qm3ster commented 6 years ago

I am using only Vetur and the built-in typescript support of Visual Studio Code.

Here's an instruction on how to make code use your project's local tsc version. TL;DR: With a .ts(not .vue) file open click on the TypeScript version number in the bottom status bar.

The error you are showing is caused by not having

    "experimentalDecorators": true,

in your tsconfig.json. It is complaining about the @Component syntax of vue-class-component.

TheAkio commented 6 years ago

I also get this Error. I just installed it from the TypeScript template and i made sure this setting is in my tsconfig.json. I also changed the version of TypeScript to 2.7.1 and updated all packages. Is there something I missed?

qm3ster commented 6 years ago

Does this happen to you after restarting, well, everything? An old config might be still loaded in the mysterious and elusive "TypeScript Language Server"

TheAkio commented 6 years ago

Yes, just restarted my PC... Is there a way that fixes that config you're talking about?

qm3ster commented 6 years ago

I'm at a loss.JPG. It doesn't happen to me with either 2.7.1 or code's 2.6.2, even while/after running the compilation. Maybe you have some weird extension installed?

TheAkio commented 6 years ago

Disabled all extensions except Vetur 0.11.7. Also I'm using Ubuntu 17.10 if that matters.

There are some issues about this in several projects but the only thing it says mostly is that it got fixed by "magic". I have literally no idea.

qm3ster commented 6 years ago

Yup, magic isn't kind to you today. I am on that as well. Bubuntu Gnoum 17.10 Do you have globally installed typescript or tslint? My node -v is v8.7.0

TheAkio commented 6 years ago

Yes, both are globally installed for me. Also I'm using Node 9.5.0 and yarn as package manager but I installed the globals with npm.

qm3ster commented 6 years ago

Because yarn globals are weird with nvm?

TheAkio commented 6 years ago

Probably. And yes i'm also using nvm :D

TheAkio commented 6 years ago

Ok... I've found the Issue. Vetur doesn't like being in a VSCode Workspace. When you open it as single project it works just fine. What also works is adding the tsconfig.json with that property to the Workspace folder as a workaround. Should probably create an issue on the VSCode plugin or the language server. I don't really know how that stuff works tho.

qm3ster commented 6 years ago

Oh. Don't tell anyone, but I've never used workspaces. But I guess it looks in the root folder? I thought it would look upwards from the file.

TheAkio commented 6 years ago

Ye... I commented on this issue here: https://github.com/vuejs/vetur/issues/567

Now they have some more infos and can maybe fix it so people don't need to spend 2 hours of their live setting up a template...