Open a command prompt and run:
npm install -g tern
Note the path where Tern is installed:
Add the tern-command line below to the .spacemacs file in your home directory (but modify the path to be where Tern was installed on your system):
(defun dotspacemacs/user-config ()
"Configuration function for user code.
This function is called at the very end of Spacemacs initialization after
layers configuration. You are free to put any user code."
(setq tern-command '("node" "C:/Users/Jason/AppData/Roaming/npm/node_modules/tern/bin/tern"))
)
Let's open a file containing the JavaScript found in this tutorial and start typing:
It's working great, but it doesn't auto-complete symbols from different files.
We need to create a JSON configuration file for Tern. We can do this by creating a .tern-project file in our project's directory. See the next article below.
Next: How to setup Spacemacs for JavaScript auto-complete and go-to-definition across files
Leave a comment