• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Cannot find name of a function from //@included file.

Engaged ,
Oct 15, 2020 Oct 15, 2020

Copy link to clipboard

Copied

Sorry if this is not the right place to ask this type of question. If so, please let me know which forum I should post to.
 
I just started using Visual Studio Code with ExtendScript plug-in. Intellisense works most of the time, but ignores functions from the included files.
 
For example, I have a file with commonly used functions called common.jsx. The file contains a function FindCompByName(name). I include the file with
//@include "E:/After Effects Scripting/common.jsx"
The function can be called from the main script just fine, but VSCode shows a "cannot find name FindCompByName' error.
 
Is it possible to fix that?

TOPICS
Developers , ExtendScript

Views

565

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Enthusiast , Oct 22, 2020 Oct 22, 2020

Whoops! The jsonconfig.json file is, well, JSON formatted and I incorrectly transcribed the boolean values. To fix the issues, remove the quotes around "true" for the "checkJs" and "strict" lines. It should look like this:

 

{
  "compilerOptions": {
    "checkJs": true,     // Tells VSCode to type check JavaScript [ExtendScript] files.
    "strict": true,      // Turns on all safety checks.
    "target": "es3",     // ExtendScript is ES3.
    "lib": [             // Turns off web DOM API autocompl
...

Votes

Translate

Translate
Adobe Employee ,
Oct 21, 2020 Oct 21, 2020

Copy link to clipboard

Copied

This is a great place to ask this question. Maybe @sberic is the right person to answer... (and I want to point out that I could '@' him now!)

 

Here's his long ExtendScript Debugger thread, if you haven't seen it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Oct 21, 2020 Oct 21, 2020

Copy link to clipboard

Copied

Yes, this is possible to fix.

 

You need to add either a jsconfig.json or tsconfig.json file to the top folder of your ExtendScript source code directory. I would recommend adding a jsconfig.json file that looks something like this:

 

{
  "compilerOptions": {
    "checkJs": "true",   // Tells VSCode to type check JavaScript [ExtendScript] files.
    "strict": "true",    // Turns on all checks.
    "target": "es3",     // ExtendScript is ES3.
    "lib": [             // Turns off web DOM API autocomplete.
      "es5"
    ]
  },
  "include": ["./**/*"]  // Include all files in this folder and any beneath it.
}

 

Hopefully something like that will get you moving!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Oct 22, 2020 Oct 22, 2020

Copy link to clipboard

Copied

Thank you! The "Cannot find name of a function" error is gone, but I get a couple of errors like this from jsconfig.json:

 

Compiler option 'checkJs' requires a value of type boolean.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Oct 22, 2020 Oct 22, 2020

Copy link to clipboard

Copied

Whoops! The jsonconfig.json file is, well, JSON formatted and I incorrectly transcribed the boolean values. To fix the issues, remove the quotes around "true" for the "checkJs" and "strict" lines. It should look like this:

 

{
  "compilerOptions": {
    "checkJs": true,     // Tells VSCode to type check JavaScript [ExtendScript] files.
    "strict": true,      // Turns on all safety checks.
    "target": "es3",     // ExtendScript is ES3.
    "lib": [             // Turns off web DOM API autocomplete.
      "es5"
    ]
  },
  "include": ["./**/*"]  // Include all files in this folder and any beneath it.
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Oct 22, 2020 Oct 22, 2020

Copy link to clipboard

Copied

LATEST

Thanks again! Works great now.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines