JXA-userland / JXA

JavaScript for Automation(JXA) packages for TypeScript/Node.js.
MIT License
429 stars 22 forks source link

Need Instructions for Installing in Visual Studio Code #22

Open JMichaelTX opened 4 years ago

JMichaelTX commented 4 years ago

Hi, your system looks great, but I can't get it work in Visual Studio Code.

I did the following:

  1. npm install @jxa/global-type -- successful
  2. Open VSC, and enter your sample code:
import "@jxa/global-type";

// your JXA application
var userName = Application("System Events").currentUser().name();

But as I type "App" I do not see the autocomplete as shown in your GIF, nor do I see it when I type "Application("Sys"

Can you please help me get your system running in VSC?

Thanks.

XYShaoKang commented 4 years ago

Run the following command

mkdir jxa-demo
cd jxa-demo
npm init -y
npm i @jxa/global-type
touch index.js

Then open the index.js editor invscode, you can get intellisense normally

demo

I suspect that some of your extensions or settings have prevented IntelliSense from functioning properly.

You can try to disable all extensions and settings, and edit to see if there will be intellisense?

My environment

vscode: 1.43.2
Node.js: 12.8.1

I am not an expert, I just hope I can help you.