Hot answers tagged

8

I would absolutely recommend tern. I discovered it halfway through my internship (working in Node.js) last summer, and it worked wonderfully with company-mode and js2-mode. js2-mode by itself is quite powerful. It can handle the usual M-. jumping within a file most of the time, and tern complements it nicely with inter-file/module jumping (esp. in the node ...


5

Perhaps there is a dot-file that I can add to my project's root folder where I can configure settings? Yes. It is called "Per-Directory Local Variables" aka ".dir-locals.el". Create a file named .dir-locals.el in the project root directory and have project specific configurations in it. More info (https://www.emacswiki.org/emacs/DirectoryVariables) You ...


5

Thanks to @Dmitry's comment above, I was able to resolve this issue by configuring the default plugins for Tern. In the tern file from the repo under bin/tern, I edited the default plugins here: var defaultConfig = { libs: [], loadEagerly: false, plugins: {"commonjs":{}, "node":{}, "requirejs":{}, "node_resolve":{}}, ecmaScript: true, ecmaVersion:...


3

I had the same issue. Tern was installed in /usr/local/bin, but emacs was not looking for it there. I added this to my init file to add /usr/local/bin to the path. (setenv "PATH" (concat (getenv "PATH") ":/usr/local/bin")) (setq exec-path (append exec-path '("/usr/local/bin")))


3

Maybe you could try to use SPC p R which runs the command projectile-replace this might not be exactly what you want (a specific js refactor tool) but it gets the job done and is language agnostic. Another more advanced option would be to search the name of that function with helm, once you are in the helm buffer C-c C-e runs helm-ag-edit, this will give ...


2

I had the same problem and what helped me was this config proposal from the Readme of the prettier-emacs mode: https://github.com/prettier/prettier-emacs#usage-with-web-mode You can declare a function "enable-minor-mode" in your .emacs-file: (defun enable-minor-mode (my-pair) "Enable minor mode if filename match the regexp. MY-PAIR is a cons cell (...


1

ElDoc When eldoc-mode is enabled it checks whether eldoc-documentation-function is defined in current buffer. If not - it messages "There is no ElDoc support in this buffer" and exits. Neither of these modes supports ElDoc, i.e. doesn't implement eldoc-documentation-function. Company When new characters are typed, company after each command checks for a ...


1

There's the js2-refactor package which does many things but doesn't rename functions. Perhaps you could extend it.


1

Just found out you can use set-key-for-mode. Seems to be just what I wanted. (evil-leader/set-key-for-mode 'clojure-mode "." 'cider-find-dwim "," 'cider-pop-back "<SPC>j" 'cider-jack-in "<SPC&...


1

The canonical answer here is: (add-hook 'js2-mode-hook 'tern-mode) This line of code is in my emacs config and works fine. When I open a .js file, tern-mode is enabled. If that doesn't work, there are other things to debug, such as what package manager you're using, which files you're opening, whether tern has any prerequirements you're not fulfilling (...


1

I believe the window object is provided by the browser lib, so you'll need something like: { "libs": [ "browser" ], "plugins": { "node": {}, "angular": {} } } }


Only top voted, non community-wiki answers of a minimum length are eligible