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?
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
...
Copy link to clipboard
Copied
This is a great place to ask this question. Maybe @good_Miracle0101 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.
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!
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.
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.
}
Copy link to clipboard
Copied
Thanks again! Works great now.