forcedotcom / salesforcedx-vscode

Salesforce Extensions for VS Code
https://developer.salesforce.com/tools/vscode
BSD 3-Clause "New" or "Revised" License
947 stars 404 forks source link

Cannot read property 'charCodeAt' of undefined at isInteger #1356

Open sc5148 opened 5 years ago

sc5148 commented 5 years ago

I am facing an issue on my lightning component in the part which dynamically creates another component based on

$A.createComponent("<component_name>",{
"SObjectName": "f42_Signup__c"
}, function (content, status) {});

Whenever I hover the mouse over SObjectName the output panel opens up and shows this error message: Cannot read property 'charCodeAt' of undefined at isInteger

Same thing happens for this piece of code:

component.find('notifLib').showToast({
                    "variant": "error",
                    "title": "Error",
                    "message": "Incomplete"
                });

Hovering mouse over any of the variant,title or message opens the output panel and shows the error. I have recorded a video for the same.

jprichter commented 5 years ago

Happens to me also on v46.5.0. Whenever my mouse goes over the code for creating a force:createRecord event, this error shows in the Output

[Error - 1:18:49 PM] TypeError: Cannot read property 'charCodeAt' of undefined
    at isInteger (/my_file_path/.vscode/extensions/salesforce.salesforcedx-vscode-lightning-46.5.0/node_modules/aura-language-server/lib/tern/lib/infer.js:547:18)
    at exports.Obj.hasProp (/my_file_path/.vscode/extensions/salesforce.salesforcedx-vscode-lightning-46.5.0/node_modules/aura-language-server/lib/tern/lib/infer.js:581:11)
    at findExprType (/my_file_path/.vscode/extensions/salesforce.salesforcedx-vscode-lightning-46.5.0/node_modules/aura-language-server/lib/tern/lib/tern.js:914:28)
    at findTypeAtExpr (/my_file_path/.vscode/extensions/salesforce.salesforcedx-vscode-lightning-46.5.0/node_modules/aura-language-server/lib/tern/lib/tern.js:927:16)
    at Object.findTypeAt [as run] (/my_file_path/.vscode/extensions/salesforce.salesforcedx-vscode-lightning-46.5.0/node_modules/aura-language-server/lib/tern/lib/tern.js:951:22)
    at run (/my_file_path/.vscode/extensions/salesforce.salesforcedx-vscode-lightning-46.5.0/node_modules/aura-language-server/lib/tern/lib/tern.js:275:59)
    at /my_file_path/.vscode/extensions/salesforce.salesforcedx-vscode-lightning-46.5.0/node_modules/aura-language-server/lib/tern/lib/tern.js:278:16
    at Object.exports.withContext (/my_file_path/.vscode/extensions/salesforce.salesforcedx-vscode-lightning-46.5.0/node_modules/aura-language-server/lib/tern/lib/infer.js:883:18)
    at /my_file_path/.vscode/extensions/salesforce.salesforcedx-vscode-lightning-46.5.0/node_modules/aura-language-server/lib/tern/lib/tern.js:274:13
    at analyzeAll (/my_file_path/.vscode/extensions/salesforce.salesforcedx-vscode-lightning-46.5.0/node_modules/aura-language-server/lib/tern/lib/tern.js:404:15)
TypeError: Cannot read property 'charCodeAt' of undefined
    at isInteger (/my_file_path/.vscode/extensions/salesforce.salesforcedx-vscode-lightning-46.5.0/node_modules/aura-language-server/lib/tern/lib/infer.js:547:18)
    at exports.Obj.hasProp (/my_file_path/.vscode/extensions/salesforce.salesforcedx-vscode-lightning-46.5.0/node_modules/aura-language-server/lib/tern/lib/infer.js:581:11)
    at findExprType (/my_file_path/.vscode/extensions/salesforce.salesforcedx-vscode-lightning-46.5.0/node_modules/aura-language-server/lib/tern/lib/tern.js:914:28)
    at findTypeAtExpr (/my_file_path/.vscode/extensions/salesforce.salesforcedx-vscode-lightning-46.5.0/node_modules/aura-language-server/lib/tern/lib/tern.js:927:16)
    at Object.findTypeAt [as run] (/my_file_path/.vscode/extensions/salesforce.salesforcedx-vscode-lightning-46.5.0/node_modules/aura-language-server/lib/tern/lib/tern.js:951:22)
    at run (/my_file_path/.vscode/extensions/salesforce.salesforcedx-vscode-lightning-46.5.0/node_modules/aura-language-server/lib/tern/lib/tern.js:275:59)
    at /my_file_path/.vscode/extensions/salesforce.salesforcedx-vscode-lightning-46.5.0/node_modules/aura-language-server/lib/tern/lib/tern.js:278:16
    at Object.exports.withContext (/my_file_path/.vscode/extensions/salesforce.salesforcedx-vscode-lightning-46.5.0/node_modules/aura-language-server/lib/tern/lib/infer.js:883:18)
    at /my_file_path/.vscode/extensions/salesforce.salesforcedx-vscode-lightning-46.5.0/node_modules/aura-language-server/lib/tern/lib/tern.js:274:13
    at analyzeAll (/my_file_path/.vscode/extensions/salesforce.salesforcedx-vscode-lightning-46.5.0/node_modules/aura-language-server/lib/tern/lib/tern.js:404:15)
sc5148 commented 4 years ago

@ntotten Hey any ETA for this bug fix?

seanu13 commented 4 years ago

@ntotten I've been experiencing the same bug for a while now and have come across this issue, but don't want to open another for the same. Is this being looked into? There was no response to @sc5148 for an ETA.

klampert commented 4 years ago

In case it's helpful to anyone else while we're waiting on a fix, I updated the isInteger function in infer.js to the following and it seems to have suppressed the error:

function isInteger(str)
{
  if (typeof str !== "undefined")
  {
    var c0 = str.charCodeAt(0);
    if (c0 >= 48 && c0 <= 57) return !/\D/.test(str);
  }

  return false;
}
jeffb-sfdc commented 2 years ago

The associated work item is W-6161498