-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How Do I use Visual Studio Code (VSC) with JXA and Retain JavaScript Code Completion? #26
Comments
Hey @JMichaelTX, No worries I love to discuss this stuff. 👍 I'm guessing that it works properly when you force it to use a Javascript syntax in the language selector in the lower right. I use the idleberg extension too, it's awesome. But I don't use it for JXA anymore - these days I just use it for Applescript. If I'm understanding it right, it's providing two things for JXA files ( recognized by .jxa, .jxainc, or .js extensions ):
You can get both of these, plus the missing JS language support, by treating your JXA scripts as regular Javascript:
The Code Runner extension actually includes support for running AppleScript files (shebang would work too), but we still need the idleberg extension for AS syntax coloring. |
Thanks, John. I really appreciate your help. One question here: Is it possible to associate the ".jxa" extension with JavaScript in VSC? I'd like to continue using it to denote my JXA scripts (vs my pure JavaScripts)? Many thanks. |
hey @JMichaelTX.. node-jxa installation I should have included the npm installation command in addition to the yarn version.. (done just now). The command using npm is : npm install -g node-jxa # ( `-g` can also be `--global`) adding jxa file association for javascript "files.associations": { "*.jxa":"javascript" }, Correction.. see next comment |
Quick update here @JMichaelTX .. It looks like my "file.associations" line in my setting.json was deleted by the settings sync extension that I'm using.. so I put it back permanently. With that bit in my config, it does select Javascript for .jxa files repeatably, even though I still have the idleberg extension installed. I'm editing my last post accordingly. |
First, let me express my tremendous gratitude to John for providing this excellent library/resource.
I look forward to using it.
Now to my question:
How Do I use Visual Studio Code (VSC) with JXA and Retain JavaScript Code Completion?
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.
I realize this is NOT directly related to this repository, but I'm hoping the expertise is here that can answer this question. I've asked elsewhere without finding a solution.
Thanks.
The text was updated successfully, but these errors were encountered: