'Unresolved variable' about some variable used just one line above (PHPStorm 2018.2.5)












1















I'm struggling with my IDE with a simple code. I'm running under Angular 1.4, ES 5.1.



function myFunction() {
var vm = this;
vm.listResults = null;

SomeService.someFunction()
.then(function (result) {
vm.listResults = result;

if (vm.listResults.length > 0) {
vm.selectCity(vm.listResults[0]);
}
});
}

vm.selectCity = function (city) {};


The last if statement throws a warning and declares the vm.listResults variable unresolved. Same for the call to selectCity and its parameter. I can't CTRL+CLICK on those three and I don't really understand why.



What do I have to enabled in order to link this properly ?



Under Languages & Frameworks > Javascript > Libraries I have angular-DefinitelyTyped, HTML & Node.js Core checked and that's all.



And yes, I could disable the warnings but I'd rather not to, I really want to understand.



Thanks a lot for your help :)










share|improve this question























  • can't recreate using provided code snippet; please share a sample project that can be used to recreate the issue. Note that adding angular-DefinitelyTyped to libraries doesn't enable angular support for your project, you need to include angular.js file (debug version, non-compressed) in your project

    – lena
    Nov 19 '18 at 11:46











  • Adding angular.js file didn't solve the case but the project is kind of a complete library without main entry (just common controllers, directives, services, filters...). Adding the library into its own libraries solved my problem, I never thought about this oO

    – Gratz44
    Nov 19 '18 at 13:18
















1















I'm struggling with my IDE with a simple code. I'm running under Angular 1.4, ES 5.1.



function myFunction() {
var vm = this;
vm.listResults = null;

SomeService.someFunction()
.then(function (result) {
vm.listResults = result;

if (vm.listResults.length > 0) {
vm.selectCity(vm.listResults[0]);
}
});
}

vm.selectCity = function (city) {};


The last if statement throws a warning and declares the vm.listResults variable unresolved. Same for the call to selectCity and its parameter. I can't CTRL+CLICK on those three and I don't really understand why.



What do I have to enabled in order to link this properly ?



Under Languages & Frameworks > Javascript > Libraries I have angular-DefinitelyTyped, HTML & Node.js Core checked and that's all.



And yes, I could disable the warnings but I'd rather not to, I really want to understand.



Thanks a lot for your help :)










share|improve this question























  • can't recreate using provided code snippet; please share a sample project that can be used to recreate the issue. Note that adding angular-DefinitelyTyped to libraries doesn't enable angular support for your project, you need to include angular.js file (debug version, non-compressed) in your project

    – lena
    Nov 19 '18 at 11:46











  • Adding angular.js file didn't solve the case but the project is kind of a complete library without main entry (just common controllers, directives, services, filters...). Adding the library into its own libraries solved my problem, I never thought about this oO

    – Gratz44
    Nov 19 '18 at 13:18














1












1








1








I'm struggling with my IDE with a simple code. I'm running under Angular 1.4, ES 5.1.



function myFunction() {
var vm = this;
vm.listResults = null;

SomeService.someFunction()
.then(function (result) {
vm.listResults = result;

if (vm.listResults.length > 0) {
vm.selectCity(vm.listResults[0]);
}
});
}

vm.selectCity = function (city) {};


The last if statement throws a warning and declares the vm.listResults variable unresolved. Same for the call to selectCity and its parameter. I can't CTRL+CLICK on those three and I don't really understand why.



What do I have to enabled in order to link this properly ?



Under Languages & Frameworks > Javascript > Libraries I have angular-DefinitelyTyped, HTML & Node.js Core checked and that's all.



And yes, I could disable the warnings but I'd rather not to, I really want to understand.



Thanks a lot for your help :)










share|improve this question














I'm struggling with my IDE with a simple code. I'm running under Angular 1.4, ES 5.1.



function myFunction() {
var vm = this;
vm.listResults = null;

SomeService.someFunction()
.then(function (result) {
vm.listResults = result;

if (vm.listResults.length > 0) {
vm.selectCity(vm.listResults[0]);
}
});
}

vm.selectCity = function (city) {};


The last if statement throws a warning and declares the vm.listResults variable unresolved. Same for the call to selectCity and its parameter. I can't CTRL+CLICK on those three and I don't really understand why.



What do I have to enabled in order to link this properly ?



Under Languages & Frameworks > Javascript > Libraries I have angular-DefinitelyTyped, HTML & Node.js Core checked and that's all.



And yes, I could disable the warnings but I'd rather not to, I really want to understand.



Thanks a lot for your help :)







javascript angularjs intellij-idea ide ecmascript-5






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 19 '18 at 9:48









Gratz44Gratz44

234




234













  • can't recreate using provided code snippet; please share a sample project that can be used to recreate the issue. Note that adding angular-DefinitelyTyped to libraries doesn't enable angular support for your project, you need to include angular.js file (debug version, non-compressed) in your project

    – lena
    Nov 19 '18 at 11:46











  • Adding angular.js file didn't solve the case but the project is kind of a complete library without main entry (just common controllers, directives, services, filters...). Adding the library into its own libraries solved my problem, I never thought about this oO

    – Gratz44
    Nov 19 '18 at 13:18



















  • can't recreate using provided code snippet; please share a sample project that can be used to recreate the issue. Note that adding angular-DefinitelyTyped to libraries doesn't enable angular support for your project, you need to include angular.js file (debug version, non-compressed) in your project

    – lena
    Nov 19 '18 at 11:46











  • Adding angular.js file didn't solve the case but the project is kind of a complete library without main entry (just common controllers, directives, services, filters...). Adding the library into its own libraries solved my problem, I never thought about this oO

    – Gratz44
    Nov 19 '18 at 13:18

















can't recreate using provided code snippet; please share a sample project that can be used to recreate the issue. Note that adding angular-DefinitelyTyped to libraries doesn't enable angular support for your project, you need to include angular.js file (debug version, non-compressed) in your project

– lena
Nov 19 '18 at 11:46





can't recreate using provided code snippet; please share a sample project that can be used to recreate the issue. Note that adding angular-DefinitelyTyped to libraries doesn't enable angular support for your project, you need to include angular.js file (debug version, non-compressed) in your project

– lena
Nov 19 '18 at 11:46













Adding angular.js file didn't solve the case but the project is kind of a complete library without main entry (just common controllers, directives, services, filters...). Adding the library into its own libraries solved my problem, I never thought about this oO

– Gratz44
Nov 19 '18 at 13:18





Adding angular.js file didn't solve the case but the project is kind of a complete library without main entry (just common controllers, directives, services, filters...). Adding the library into its own libraries solved my problem, I never thought about this oO

– Gratz44
Nov 19 '18 at 13:18












1 Answer
1






active

oldest

votes


















0














So basically as I just replied, my project is like a big library commonly used by many of our other projects (common controllers / directives / services / filters...). It doesn't include angularjs in its package.json because this lib is just imported into projects that already load it, so I guess that's why it didn't work.



Adding this same library into its own libraries just solved my problems :)






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53371987%2funresolved-variable-about-some-variable-used-just-one-line-above-phpstorm-201%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    So basically as I just replied, my project is like a big library commonly used by many of our other projects (common controllers / directives / services / filters...). It doesn't include angularjs in its package.json because this lib is just imported into projects that already load it, so I guess that's why it didn't work.



    Adding this same library into its own libraries just solved my problems :)






    share|improve this answer




























      0














      So basically as I just replied, my project is like a big library commonly used by many of our other projects (common controllers / directives / services / filters...). It doesn't include angularjs in its package.json because this lib is just imported into projects that already load it, so I guess that's why it didn't work.



      Adding this same library into its own libraries just solved my problems :)






      share|improve this answer


























        0












        0








        0







        So basically as I just replied, my project is like a big library commonly used by many of our other projects (common controllers / directives / services / filters...). It doesn't include angularjs in its package.json because this lib is just imported into projects that already load it, so I guess that's why it didn't work.



        Adding this same library into its own libraries just solved my problems :)






        share|improve this answer













        So basically as I just replied, my project is like a big library commonly used by many of our other projects (common controllers / directives / services / filters...). It doesn't include angularjs in its package.json because this lib is just imported into projects that already load it, so I guess that's why it didn't work.



        Adding this same library into its own libraries just solved my problems :)







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 19 '18 at 13:22









        Gratz44Gratz44

        234




        234






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53371987%2funresolved-variable-about-some-variable-used-just-one-line-above-phpstorm-201%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to change which sound is reproduced for terminal bell?

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

            Can I use Tabulator js library in my java Spring + Thymeleaf project?