Questions tagged [javascript]

for the use (typically editing) of JavaScript code in Emacs.

Filter by
Sorted by
Tagged with
0 votes
1 answer
37 views

Emacs hangs when saving new file with prettier-mode enabled

I'm editing JavaScript files quite a bit and I have prettier installed and prettier-mode and when I load files and make changes it runs, changes the layout and saves them as expected. However, if I ...
user avatar
0 votes
1 answer
30 views

How can I font-lock JavaScript code?

I find the default syntax highlighting for JavaScript and TypeScript to be lacking slightly. For example, s there a package equivalent to vim-polyglot for Emacs? I have tried Emacs tree-sitter but it ...
user avatar
0 votes
1 answer
72 views

How can I run JavaScript in a browser console?

I am looking for a way to stream data, using Emacs, which is accessible through an API that requires the submission of JavaScript code to a browser console: https://developer.tdameritrade.com/content/...
user avatar
  • 17.6k
1 vote
0 answers
37 views

How to use dap-mode with TypeScript?

https://github.com/emacs-lsp/dap-mode provides DAP debugging for various languages (along the same lines as LSP does for completion, formatting, etc). How can I use that to debug programs written in ...
user avatar
0 votes
0 answers
44 views

No completion found for Cypress company completion in Emacs

Right of the bat I would say that I do not understand most of the stuff when it comes to IDE functionality and I am failing to find any documentation that helps me understand all the tools better so ...
user avatar
  • 1
1 vote
0 answers
58 views

How to configure emacs for use with yarn 3?

The yarn package manager suggests a snippet of elisp to use: Create a .dir-locals.el with the following content to enable Flycheck and LSP support and make sure LSP is loaded after local variables ...
user avatar
  • 155
1 vote
0 answers
26 views

Emacs freezes on javascript mode if I enter a newline after a dot character

Cursor is on the dot, I press newline, emacs hangs. This happens often to me I kill emacs and restart it. I come to this situation to break long lines at function calls at dot character. situation('...
user avatar
  • 175
3 votes
1 answer
249 views

Evaluate JavaScript source block in org-mode

If I attempt to evaluate a JavaScript source block then I have to return a value to get a result. For example: #+begin_src js return 1 + 2; #+end_src #+RESULTS: : 3 That's a bit unusual. I guess ...
user avatar
  • 155
1 vote
2 answers
212 views

Emacs can't find Node when Node was installed using NVM (again)

My question is similar to this question. I've installed node via nvm. (executable-find "node") returns .nvm/versions/node/v15.11.0/bin/node. Entering node on eshell drops me into a node ...
user avatar
1 vote
0 answers
188 views

dap-mode for nodejs with nodemon

After 5 hours of googling and trying out different configurations i give up. How do i setup dap-mode for debugging nodejs with nodemon so that the debugger restarts when nodemon restarts? Non-solution ...
user avatar
  • 221
0 votes
0 answers
53 views

Uncommenting not working on Javascript file

I am trying to use the block un-comment command C-x C-; but I am getting the error message "Can't find the comment end". I am writing Javascript code in an .html file. The block comment ...
user avatar
1 vote
3 answers
726 views

Emacs Javascript basic code completion

I try to set proper completions/suggestions for Javascript. There is no problem with ES6+ and Typescript types and defined variables but most of the time I work with vanilla JS in browser context, so ...
user avatar
  • 592
0 votes
1 answer
388 views

Javascript mode mixes tabs and spaces for indent

My javascript mode indents with a mix of tabs and spaces. I'm ok with the mix if spaces are used for cosmetic alignment, but this is just wrong: First level of indentation is spaces, second is tab, ...
user avatar
  • 387
4 votes
1 answer
141 views

Commenting out some JSX code section with Emacs 27 js-mode

When I comment out (M-x comment-dwim) some section of JSX code with the new js-mode in Emacs 27, it gives: // <Grid rows={rows} columns={columns}> // <Table /> // <TableHeaderRow /&...
user avatar
  • 574
2 votes
0 answers
50 views

How to move by defun without moving up a level?

I am attempting to navigate methods in a file. Typically these are javascript or python files, which have a classes at the "top level", which in turn have methods nested within those ...
user avatar
  • 509
1 vote
1 answer
185 views

How do I make emacs indent relative to the beginning of the previous line?

Here's how emacs indents e.g. Python code: a = myfun(b, c) I'd like it to be this way: a = myfun(b, c) Reasoning? If I later replace myfun with myfunction, in the first case it becomes:...
user avatar
  • 229
1 vote
1 answer
450 views

automatic prettier for python code? (as in javascript)

https://github.com/prettier/prettier-emacs does formatting for javascript wonder if there's an equivalent for python code?
user avatar
  • 355
0 votes
0 answers
68 views

What doesn't my JavaScript layer automatically automatically format my JavaScript files?

When I open a JavaScript file, the file appears as plain text. When I activate javascript-mode in more (SPC SPC) on a .js file, then the file is correctly formatted. I have the layer installed with ...
user avatar
0 votes
1 answer
68 views

Need help with JavaScript `{` indentation

I'd need some guidance with adjusting my indentation settings for js-mode (JavaScript). It should basically look like C/C++'s Stroustrup mode. Most of it works as expected, however there are some ...
user avatar
0 votes
2 answers
331 views

Emacs acting strangely with indentation

So I've recently come back to working with emacs again I mostly write JavaScript in particular React these days and I'm noticing some strange behaviour when trying to indent my code. it seems the ...
user avatar
0 votes
2 answers
657 views

How to correctly configure Flow backend for LSP mode?

I'm using spacemacs @develop (branch). I can't use lsp and lsp-ui. In vscode everything works (using flow lsp mode). With company-flow I can also make it working. When opening a .js file with // @...
user avatar
1 vote
2 answers
135 views

Setup find-file-at-point to treat tilde as project root

A JavaScript project is setup with webpack path resolver like this: resolve: { alias: { '~': path.resolve(cwd, 'src') } }, This has the effect that a line in c:/...
user avatar
  • 193
1 vote
0 answers
1k views

Emacs configure lsp-mode / lsp-ui

I work mainly with javascript and typescript. And I have enabled lsp-mode in Doom Emacs. But I am not very happy about the descriptions and information shown to me on hover. It is not very useful and ...
user avatar
2 votes
1 answer
121 views

customize js2-mode switch indentation

This is pretty simple but it's thwarting me: this is how a switch statement indents in js2-mode switch(letterGrade){ case "A+": value = 100 ; break; case "A": value = 97 ; break; ...
user avatar
2 votes
1 answer
265 views

How to generate and display tags in treemacs (for JavaScript)?

I'd like to generate a set of tags and then view them in Treemacs, ideally whenever I open a file that I can generate tags for. The docs for Treemacs' tag view say: Treemacs is able to display ...
user avatar
0 votes
1 answer
167 views

How to display js2-mode warnings

I am running Emacs 26.1 on Ubuntu 16.4. I am writing Javascript using js2-mode. When the linter underlines a line of code, I want to know what error or warning it has detected. For example, in this ...
user avatar
1 vote
1 answer
320 views

Cannot add general block header arguments in org mode

While I'm learning javascript following a book, I Like to take notes with org-mode. I use Indium and followed this instructions to handle it working It works well, and I get my work done, interacting ...
user avatar
  • 697
1 vote
0 answers
55 views

tide-mode in org-edit-src-code

I want to activate tide-mode when using Javascript soruce code blocks, following this it works well with indium: https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-js.html But I want to use ...
user avatar
  • 697
0 votes
0 answers
574 views

How to set up Emacs Tide to use auto-complete for completion instead of company-mode?

I installed Tide in Emacs, and found it is pretty useful for writing JavaScript code. But one thing is that Tide has built-in support for company-mode to do completions. Since I am an auto-complete ...
user avatar
  • 101
2 votes
2 answers
633 views

How to show all functions in a javascript file?

How to show all functions in a js file? I am using js2, but any solution will do. Additional info: I am expecting an occur style buffer. This can persist and be edited if necessary. Or searched. This ...
user avatar
  • 509
0 votes
0 answers
110 views

Web-beautify JS code on Windows (js-beautify for unminimifying)

I'm trying to un-minimify JS code on Windows. I've installed web-beautify from MELPA. I also installed Node.js for Windows, which is a dependency of this package. I then ran npm -g install js-beautify ...
user avatar
  • 421
1 vote
1 answer
730 views

ES6 imports auto suggestion

I'm new to emacs and trying to setup emacs for ES6/React developement. I would like to have auto suggestions for es6 imports like lodash similar to vscode (as shown in screenshot). Is there a way to ...
user avatar
  • 111
3 votes
1 answer
966 views

How to control JavaScript indentation?

I am coding in Node.js, each time I want to write something that looks like this: const product = Factory .model('App/Models/Product') .create() I get this as an output: const product = Factory ...
user avatar
  • 131
0 votes
1 answer
792 views

eglot - javascript

I am trying to set up eglot on ubuntu and emacs 26.1. I have installed version 1.4 When I run M-x eglot I get: [eglot] I guess you want to run `javascript-typescript-stdio', but I can't find `...
user avatar
1 vote
0 answers
26 views

Migrate Webstorm Code Highlighting

I am currently using Webstorm as my daily driver but I am trying to look into Emacs and possibly transition. One of the most important things to me that I have spent the last 3 years on was to ...
user avatar
1 vote
1 answer
584 views

ELDoc and company-tern are not working properly in JS2-mode (.js buffer in node) and Javascript, in Emacs

In my Emacs configuration for JavaScript/ JS2-mode, specifically .js buffer in node: (1) company-tern and ELDoc are NOT working properly. For eg. when I type 'console.l', 'log' does not pop up, ...
user avatar
  • 81
0 votes
1 answer
2k views

Configuring Flycheck to use a local ESLint

I was trying to get emacs to point to a version of eslint that isn't installed globally (but located in the node_modules of the directory one level up), so I followed this: Flycheck with file relative ...
user avatar
1 vote
1 answer
168 views

set js-indent-level from .eslintrc?

when I edit javascript, I'm usually actually editing someone else's code. Is there a way to dynamically set the value of js-indent-level from a .eslintrc file?
user avatar
  • 43
3 votes
0 answers
397 views

How to generate TAGS tables for JavaScript with React?

I'd like to create TAGS tables for JavaScript ES6 code using React like the following: import React from 'react' import { observer } from 'mobx-react' import { Formik, Form, Field } from 'formik' ...
user avatar
  • 353
0 votes
1 answer
250 views

flycheck tslint reports no-implicit-dependencies for everything

I'm editing TypeScript using Tide, successfully, except that it complains about every single import statement. For example: import { GraphQLSchema } from 'graphql'; I see an error in the minibuffer:...
user avatar
2 votes
1 answer
120 views

How to prevent Emacs from converting JavaScript symbols to HTML code?

When I insert a portion of JavaScript code within an HTML file, Emacs convert some basic JS symbols to their HTML code. For example when I type >, Emacs convert it automatically to &gt; which ...
user avatar
0 votes
2 answers
224 views

How to prevent losing indentation when editing JavaScript code within HTML files in Emacs?

When I edit JavaScript code which exists in an HTML file, I lose code indentation whenever I press Enter. first line of code: second line of code # Press Enter here Result after pressing Enter: ...
user avatar
4 votes
2 answers
2k views

Javascript ES6, React, and EMACS

So, I'm finding myself writing React a lot, and not finding myself happy doing so in EMACS. I've been resorting to Visual Studio Code, which is a fine editor but suffers seriously by not being EMACS. ...
user avatar
3 votes
1 answer
332 views

Make emacs to use only tabs for JS indentation

I've set my tabs to 4 and haven't changed any JS indent settings. All the indents I found in the "JavaScript group" have values either 0 or 4, yet the following code describe('test Info', () => { ...
user avatar
0 votes
1 answer
111 views

Add a watch statement in Indium?

Is it possible to add a watch statement in Indium like you can in the node debugging utility? from Debugger | Node.js v9.10.1 Documentation: It is possible to watch expression and variable values ...
user avatar
  • 6,794
2 votes
1 answer
315 views

Fixing wrong-type-argument to looking-at in Emacs 25 js-mode on large files

When using js-mode (or js2-mode) on Emacs 25.1 (in Debian 9) to edit some large files, any attempt to insert text after some "random" point in the file fails with an elisp stack trace: Debugger ...
user avatar
2 votes
2 answers
191 views

Adding global variable on flycheck

I tried to add this to my eslint global variable "globals": { "document": false, "navigator": false, "window": false, "rndr": false, "shrd": false, "path": true, "$": ...
user avatar
  • 185
0 votes
0 answers
163 views

Emacs and JSlint

Is there a way to make Emacs flycheck run JSlint (not flymake, not JShint, and not eslint) on the current file?
user avatar
  • 821
2 votes
1 answer
82 views

Align the values of a JavaScript map

Say that you have the following JavaScript map literal {a: 1, aoeu: 2} and want the values aligned for readability like {a: 1, aoeu: 2} Is this possible to do with emacs? I'm currently using ...
user avatar
  • 883
4 votes
1 answer
798 views

What's the relationship between js-mode and js2-mode?

I saw there is a js-mode bundled in Emacs. I've also seen a js2-mode. However, I have also seen Emacs git log on js-mode refers to js2-mode bug reports. What is the relationship between them?
user avatar
  • 1,709