jeudi 17 janvier 2019

How to properly set up Ember auto-imports using VSCode and the Javascript Language Service?

I'm trying to set up auto-imports in VSCode for my Ember project and I'm encountering issues with imports from the Ember library.

I have properly set up imports from within my application, those work just fine, but when trying to import from @ember, it either doesn't find the import at all, or it's imported from a ridiculous relative path, or it's imported just fine, in some cases.

My jsconfig.json looks like this:

{
    "compilerOptions": {
        "target": "es2018",
        "experimentalDecorators": true,
        "allowSyntheticDefaultImports": true,
        "baseUrl": ".",
        "paths": {
            "sbct-web/tests/*": ["./tests/*"],
            "sbct-web/config/*": ["./config/*"],
            "sbct-web/*": ["./app/*"]
        }
    },
    "exclude": [
        "node_modules",
        "bower_components",
        "tmp",
        "vendor",
        ".git",
        "dist",
        "temp",
        "public",
    ]
}

I also tried with a dumbed down version that only had the exclude field, but the results were the same. I also tried to force typeAcquisitions, same results (I suspect the types are fetched just fine, because I can peek definitions of @ember modules).

In order to better understand the issue, here's a short recording of what I'm encountering:

ember auto imports




Aucun commentaire:

Enregistrer un commentaire