Highlighted

Visual Studio Code: Errors When Using XML Attributes In ExtendScript

Adobe Community Professional ,
May 29, 2020

Copy link to clipboard

Copied

I’ve googled the skin of my fingers, but have not found an answer to my question yet. I have a large ExtendScript project that I want to debug in Visual Studio Code (using Adobe’s ExtendScript extension). It works fairly well (even though I eventually will end up with an “Extension host terminated unexpectedly” error). My main problem is that the syntax checker is complaining about anything that uses an XML attribute. I cannot start a debug session for a file that contains syntax errors. Here is a short sample script:

 

//@ts-nocheck
//@target InDesign
var thisDocument = app.documents.add();
// create some xml and write it to file
var root = new XML(“<root/>”);
var child = new XML(“<child/>”);
//@ts-ignore
child.@attribute = “SomeAttribute”; // << causes errors
root.appendChild(child);

 

And here are the error messages I am getting for the line in question:

  • Identifier expected.
  • Experimental support for decorators is a feature that is subject to change in a future release. Set the ‘experimentalDecorators’ option in your ‘tsconfig’ or ‘jsconfig’ to remove this warning.
  • Declaration expected.
  • Declaration or statement expected.

I’ve tried to use TypeScript and JavaScript as the language, but neither one works. Unfortunately, there is no “ExtendScript” language selection.

 

I can work around that by keeping my scripts in a separate folder, and then running the main script from another script using “app.doScript()”. This way, the editor does not see the files that it claims contain the syntax errors and it will actually allow me to start a debug session.

 

I’ve tried the //@ts-ignore and //@ts-nocheck commands, but without success.

Has anybody gotten these to work in VSC?

 

Thanks,

Karl Heinz

Topics

Scripting

Views

219

Likes

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

Visual Studio Code: Errors When Using XML Attributes In ExtendScript

Adobe Community Professional ,
May 29, 2020

Copy link to clipboard

Copied

I’ve googled the skin of my fingers, but have not found an answer to my question yet. I have a large ExtendScript project that I want to debug in Visual Studio Code (using Adobe’s ExtendScript extension). It works fairly well (even though I eventually will end up with an “Extension host terminated unexpectedly” error). My main problem is that the syntax checker is complaining about anything that uses an XML attribute. I cannot start a debug session for a file that contains syntax errors. Here is a short sample script:

 

//@ts-nocheck
//@target InDesign
var thisDocument = app.documents.add();
// create some xml and write it to file
var root = new XML(“<root/>”);
var child = new XML(“<child/>”);
//@ts-ignore
child.@attribute = “SomeAttribute”; // << causes errors
root.appendChild(child);

 

And here are the error messages I am getting for the line in question:

  • Identifier expected.
  • Experimental support for decorators is a feature that is subject to change in a future release. Set the ‘experimentalDecorators’ option in your ‘tsconfig’ or ‘jsconfig’ to remove this warning.
  • Declaration expected.
  • Declaration or statement expected.

I’ve tried to use TypeScript and JavaScript as the language, but neither one works. Unfortunately, there is no “ExtendScript” language selection.

 

I can work around that by keeping my scripts in a separate folder, and then running the main script from another script using “app.doScript()”. This way, the editor does not see the files that it claims contain the syntax errors and it will actually allow me to start a debug session.

 

I’ve tried the //@ts-ignore and //@ts-nocheck commands, but without success.

Has anybody gotten these to work in VSC?

 

Thanks,

Karl Heinz

Topics

Scripting

Views

220

Likes

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
Adobe Community Professional ,
May 29, 2020

Copy link to clipboard

Copied

Looks like an update to VSC now allows me to run this code. It sill shows four errors, but at least now I can debug. 

Likes

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
Reply
Loading...