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











up vote
1
down vote

favorite












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
    yesterday










  • 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
    yesterday















up vote
1
down vote

favorite












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
    yesterday










  • 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
    yesterday













up vote
1
down vote

favorite









up vote
1
down vote

favorite











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 yesterday









Gratz44

214




214












  • 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
    yesterday










  • 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
    yesterday


















  • 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
    yesterday










  • 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
    yesterday
















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
yesterday




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
yesterday












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
yesterday




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
yesterday












1 Answer
1






active

oldest

votes

















up vote
0
down vote













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',
    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








    up vote
    0
    down vote













    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

























      up vote
      0
      down vote













      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























        up vote
        0
        down vote










        up vote
        0
        down vote









        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 yesterday









        Gratz44

        214




        214






























             

            draft saved


            draft discarded



















































             


            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

            android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

            SQL update select statement

            'app-layout' is not a known element: how to share Component with different Modules