This topic contains 7 replies, has 0 voices, and was last updated by kcng 8 years, 3 months ago.

  • Author
    Posts
  • #4604

    nathanah

    Is there supposed to be code completion for SuiteScript 2.0 in the SuiteCloud IDE? I’ve updated to 2016.1.0.e4 of the SuiteCloud IDE and the code snippets for creating SuiteScript 2.0 files are there but there appears to be no code completion. Unless I’m missing something? We are working on learning 2.0 and it makes it extremely difficult if code completion isn’t coming through. So hopefully it is just something with the IDE that I don’t have set up.

    Any help would be appreciated. Thanks.

    Nathan
    This is a cached copy. Click here to see the original post.

  • #4605

    kcng

    Originally posted by nathanah

    View Post

    Is there supposed to be code completion for SuiteScript 2.0 in the SuiteCloud IDE? I’ve updated to 2016.1.0.e4 of the SuiteCloud IDE and the code snippets for creating SuiteScript 2.0 files are there but there appears to be no code completion. Unless I’m missing something? We are working on learning 2.0 and it makes it extremely difficult if code completion isn’t coming through. So hopefully it is just something with the IDE that I don’t have set up.

    Any help would be appreciated. Thanks.

    Nathan

    Code:
    /**
    * @NApiVersion 2.x
    * @NScriptType Portlet
    * @NModuleScope SameAccount
    */
    define([‘N/email’],
    /**
    * @param {email} email
    */
    function(email) {

    /**
    * Definition of the Portlet script trigger point.
    *
    * @param {Object} params
    * @param {Portlet} params.portlet – The portlet object used for rendering
    * @param {number} params.column – Specifies whether portlet is placed in left (1), center (2) or right (3) column of the dashboard
    * @param {string} params.entity – (For custom portlets only) references the customer ID for the selected customer
    * @Since 2015.2
    */
    function render(params) {

    }

    return {
    render: render
    };

    });
    In the example above, when you try to trigger code completion inside function render(params), it won’t appear. This is a problem with Eclipse.

    Try triggering the code completion outside of the function and it should show up.

    One other way is to write the template in a different way.

    Code:
    /**
    * @NApiVersion 2.x
    * @NScriptType Portlet
    * @NModuleScope SameAccount
    */
    define([‘N/email’],
    /**
    * @param {email} email
    */
    function(email) {

    var obj = {};

    obj.render = function(params) {

    };

    return obj;

    });
    In the case above, triggering the code completion inside function render should work.

  • #4606

    nathanah

    Okay, that’s helpful. Is there any plans to make Eclipse work correctly? When I create a code snippet from the IDE, it formats it like the first example, not the second.

    Another question around this. I’m trying to create a SS2 Suitelet and I reformatted it like you described:

    From this:

    Code:
    /**
    * @NApiVersion 2.x
    * @NScriptType Suitelet
    * @NModuleScope SameAccount
    */
    define([‘N/search’, ‘N/ui/serverWidget’],
    /**
    * @param {search} search
    * @param {serverWidget} serverWidget
    */
    function(search, serverWidget) {

    /**
    * Definition of the Suitelet script trigger point.
    *
    * @param {Object} context
    * @param {ServerRequest} context.request – Encapsulation of the incoming request
    * @param {ServerResponse} context.response – Encapsulation of the Suitelet response
    * @Since 2015.2
    */
    function onRequest(context)
    {
    if (context.request.method === ‘GET’) {

    var form = serverWidget.createForm({
    title: ‘Client Profitability’
    });

    context.response.writePage(form);

    } else {
    // post
    }
    }

    return {
    onRequest: onRequest
    };

    });
    To this:

    Code:
    /**
    * @NApiVersion 2.x
    * @NScriptType Suitelet
    * @NModuleScope SameAccount
    */
    define([‘N/search’, ‘N/ui/serverWidget’],
    /**
    * @param {search} search
    * @param {serverWidget} serverWidget
    */
    function(search, serverWidget) {

    var obj = {};

    obj.onRequest = function(context) {

    };

    return obj;

    });
    Now the code completion for the “search” variables works but the serverWidget doesn’t work at all. And how to do I get the “context” variable to work, too?

    Thanks for the help!

    Nathan

  • #4607

    kcng

    The current version of the SuiteCloud IDE only supports code completion for modules.

    For the context, it currently just provides the JsDoc, so you can make use of that as basis on what properties the context parameter has.

  • #4608

    nathanah

    Okay, but the serverWidget code completion didn’t work either. Any ideas? Is something wrong with my code?

  • #4609

    kcng

    Originally posted by nathanah

    View Post

    Okay, but the serverWidget code completion didn’t work either. Any ideas? Is something wrong with my code?

    Nothing wrong with your code, this is a known bug in the SuiteCloud IDE plugin. An issue has already been filed for this.

  • #4610

    nathanah

    Okay, thanks. Hopefully this gets fixed soon.

  • #4611

    kcng

    Fix will be included in 16.2 release of the IDE.

You must be logged in to reply to this topic.