JXA-userland / JXA

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

Need Install Instructions for Visual Studio Code (VSC) #4

Closed JMichaelTX closed 5 years ago

JMichaelTX commented 6 years ago

First, thanks for building and sharing a terrific tool! ๐Ÿ‘ I can't wait to start using it.

However, I need help. Can you please provide detailed, step-by-step, instructions on how to install your JXA autocomplete into Visual Studio Code?

Thanks.

azu commented 6 years ago

Thanks for feedback.

@jxa/global-type's approach is same with Cypress that is a E2E framework.

There are serveral pattern of usage.

TypeScript user

If you write JXA script as TypeScript project, you just import @jxa/global-type

file.ts:

import("@jxa/global-type");

JavaScript user

If you write JXA as JavaScript, you should do following steps:

  1. Create package.json
    • $ npm init --yes
  2. Install @jxa/global-type
    • $ npm install -D @jxa/global-type
  3. Adding tsconfig.json file with the following configuration should get intelligent code completion working.

tsconfig.json:

{
  "compilerOptions": {
    "allowJs": true,
    "types": [
      "@jxa/global-type"
    ]
  },
  "include": [
    "**/*.js" // <= this scope is integrated with @jxa/global-type
  ]
}
  1. Write JXA code as JavaScript like file.js

Also, I've created starter repository for JavaScript user.

git clone https://github.com/JXA-userland/editor-integrate-example
cd editor-integrate-example
vscode .

image

JMichaelTX commented 4 years ago

Thanks again for all the information you have provided.
I've tried many things but still can not get autocomplete of my JXA code to work. Would it be possible to do a screen share some time, where you could walk me through this process? If you would do that, then I would be happy to create a YouTube video showing users like me how to get this done.