vscode icon indicating copy to clipboard operation
vscode copied to clipboard

ES6 support does not work

Open AndrewRayCode opened this issue 11 years ago • 28 comments

When I open any file in my ES6 Javascript project, every single line is underlined in red, with errors like:

screen shot 2015-11-18 at 12 03 09 pm

In my project's root, I have a jsconfig.json file with the following contents:

{
    "compilerOptions": {
        "target": "ES6",
        "module": "commonjs"
    },
    "files": [
        "app/"
    ]
}

The file in question lives inside the app folder.

AndrewRayCode avatar Nov 18 '15 20:11 AndrewRayCode

Furthermore, could you please edit this blog post to make the images of text into actual text? http://blogs.msdn.com/b/vscode/archive/2015/07/06/vs-code-es6.aspx Classic Microsoft :)

AndrewRayCode avatar Nov 18 '15 20:11 AndrewRayCode

You need to use the filesGlob property with a wildcard expression if you want to find all *.js files inside of your app folder. Change your jsconfig.json to this:

{
    "compilerOptions": {
        "target": "ES6",
        "module": "commonjs"
    },
    "filesGlob": [
        "app/**/*.js"
    ]
}

jalipert avatar Nov 18 '15 21:11 jalipert

Where is this documented?

AndrewRayCode avatar Nov 18 '15 21:11 AndrewRayCode

Also this doesn't work. It works if I specify the full path in "files" but with the globbing config my file still shows pure errors.

AndrewRayCode avatar Nov 18 '15 21:11 AndrewRayCode

for me, removing the whole "files" section altogether seems to cause the errors to go away, indicating that ES6 applies to the entire project. Not sure if that helps your situation. The filesGlob wasn't actually the fix. (FYI, I got the filesGlob idea from tsconfig.json which is a superset of jsconfig.json, and it seemed to fix the issue, as simply removing the 'files' section fixes it for me... but then you're stuck with ES6 for your whole project)

jalipert avatar Nov 18 '15 21:11 jalipert

If my jsconfig.json file is just:

{
    "compilerOptions": {
        "target": "ES6",
        "module": "commonjs"
    }
}

It still doesn't work, my file is highlighted as syntax errors. The only thing that's worked so far is specifying the absolute file path.

AndrewRayCode avatar Nov 18 '15 21:11 AndrewRayCode

Also "filesGlob" doesn't autocomplete, only "files", with a strangely bad doc message:

screen shot 2015-11-18 at 1 32 52 pm

making it seem like filesGlob isn't supportd?

AndrewRayCode avatar Nov 18 '15 21:11 AndrewRayCode

https://github.com/TypeStrong/atom-typescript/blob/master/docs/tsconfig.md#filesglob

filesGlob is specific to atom-typescript

glen-84 avatar Nov 18 '15 21:11 glen-84

Duplicate of #54?

glen-84 avatar Nov 18 '15 22:11 glen-84

filesGlob can be used outside of Atom by using a file watcher with the tsconfig-glob package on npm.

rob3c avatar Nov 19 '15 00:11 rob3c

+1 There really is a very weird bug here. When placing the file in the root folder, on some projects, it works, on others it doesn't. Moving the file to the src folder does the trick. I have no resorted to stripping down the jsconfig.json completely... and no go.

{
  "compilerOptions": {
    "target": "ES6"
  }
}

To say the least, this is quite irritating and actually standing in the way on my team using this.

No, we are no going to place a jsconfig.json file in each root source folder, e.g. src/, specs, etc.

jacogr avatar Nov 21 '15 05:11 jacogr

Related to #337

joaomoreno avatar Nov 21 '15 13:11 joaomoreno

I think i found a way arround by putting a exclude instead of files:

{
    "compilerOptions": {
        "target": "ES6",
        "module": "commonjs"
    },
    "exclude": [
        "node_modules"
    ]
}

wcastand avatar Nov 21 '15 19:11 wcastand

Only using excludes here, some projects it works, others it doesn't.

Am not using "files" in any of the jsconfig.json project files.

jacogr avatar Nov 22 '15 06:11 jacogr

duplicate of #703

jrieken avatar Dec 04 '15 11:12 jrieken

@jrieken my ticket is a dupe of a ticket made 8 days after mine?

AndrewRayCode avatar Dec 04 '15 19:12 AndrewRayCode

Having a garbage experience with typescript and vscode, just give up man. This thread has made up my mind.

Arebee88 avatar Dec 04 '15 23:12 Arebee88

Having a garbage experience with typescript and vscode, just give up man. This thread has made up my mind. @Arebee88

:+1: it was crippled from launch, and instead of providing any kind of community support or hiring a community advocate, the devs just keep saying "VS code fully supports ES6." Not documented in any way!

A Microsoft product that has trouble with the filesystem?! Who would have guessed!

AndrewRayCode avatar Dec 05 '15 00:12 AndrewRayCode

@DelvarWorld , sorry, that you had an unhappy experience. We are about to close Issue #703. It wasn't a single issue but there were several issues behind the same symptom (and no, it wasn't a file system issue). The fix will be in the December update (pls see #917).

Not documented in any way!

We are always interested in improving our documentation. Please let us know what you would like to see in the JS documentation: https://code.visualstudio.com/Docs/languages/javascript.

Furthermore, could you please edit this blog post to make the images of text into actual text? >http://blogs.msdn.com/b/vscode/archive/2015/07/06/vs-code-es6.aspx Classic Microsoft :)

I was about to do it, but then there is a link to a repository with full source code at the end,

egamma avatar Dec 07 '15 10:12 egamma

I was about to do it, but then there is a link to a repository with full source code at the end,

Do you think that when coming across a blog and seeing the block of text one needs embedded in an image, the first thing a developer is going to do is scroll to the end of the blog post looking for an unlabeled, obfuscated link to an unrelated part of a codebase? If you have the ability to do, please edit the blog post (and the documentation) to show text instead of an image. I don't see the point of intentionally making every developer have to scour for an external link they don't know exists, to a repository not obviously related to jsconfig.json, following it, losing context of the blog post, assuming they know exactly where to look for the file in the directory structure, then clicking on it.

Pushback against saving time for every single developer who comes to the blog and documentation because "there is a link" is disheartening. Please think of how newcomers approach your docs and tools.

AndrewRayCode avatar Dec 07 '15 19:12 AndrewRayCode