0

It is great that this extension provides us with the ability to code, compile, and run JXA files:
AppleScript & JXA for Visual Studio Code

Unfortunately, JavaScript code completion is not active for a JXA file, even though JXA uses core JavaScript. Is there some way to enable it for JXA?

I am brand new to VSC, so if you can, please provide detailed instructions.

Thanks.

JMichaelTX
  • 1,659
  • 14
  • 19
  • were you able to find a solution to this? – jim70 Sep 22 '19 at 22:08
  • @jim70 -- see the answer I just posted. – JMichaelTX Sep 23 '19 at 02:08
  • are you referring to an answer here on Stackoverflow or elsewhere? Thanks. – jim70 Sep 23 '19 at 12:20
  • The powers-that-be in this forum did not like that I provide an excellent answer, but did so via a link to long, extensive article. Thus, they DELETED my answer. So, everyone else will suffer because those who want to know the answer are denied it. – JMichaelTX Sep 24 '19 at 00:06

2 Answers2

0

Press Ctrl+K, M or click the language name in the bottom-right corner. Then change the language currently associated with the file.

I expect there's a setting somewhere to do this generally, but I haven't found one.

wizzwizz4
  • 6,140
  • 2
  • 26
  • 62
  • Thanks for your suggestion, but won't that break the JXA feature that compiles and runs a JXA script? Can the JavaScript code completion be added to the JXA extension? – JMichaelTX Apr 12 '18 at 23:14
  • @JMichaelTX Unfortunately, yes. But short of writing an extension or having more knowledge of the program than I do, there's not a lot you can do about that unfortunately. – wizzwizz4 Apr 13 '18 at 07:30
0

Did you try this:

 "files.associations": {
    "*.jxa": "javascript",
    "*.applescript": "javascript"
  },

and any other file extensions you use. See https://code.visualstudio.com/docs/languages/overview#_adding-a-file-extension-to-a-language

Mark
  • 143,421
  • 24
  • 428
  • 436
  • Can you please provide details as to how to change/set the file associations in VSC? – JMichaelTX Sep 23 '19 at 16:49
  • What I wrote in my answer goes into your settings.json and then hopefully you will get javascript syntax completion and theme colors in your `.jxa` files. – Mark Sep 23 '19 at 16:52