Questions tagged [javascript]

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

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

Disable code autocompletion in JS files

For some reason, my Emacs started autocompleting code. I have noticed this in both web-mode and rjsx-mode. For example, if I type <button></ it will autocomplete it to <button></...
cheryllium's user avatar
0 votes
1 answer
31 views

Tide mode: how do I get it to stop running tide-format-before-save?

I'm at my utter wit's end with this hell-plugin lmao. I've tried (remove-hook 'before-save-hook 'tide-format-before-save t), and it doesn't work. How do I remove tide-format-before-save from the ...
Alexis Purslane's user avatar
0 votes
1 answer
26 views

How to proper install and configure js2-mode via use-package declaration?

I am trying to install this package called js2-mode. This is part of my effort to follow this tutorial. Package documentation and tutorial are using classic installation via package-install as follows:...
Pedro Delfino's user avatar
1 vote
0 answers
11 views

What is the correct way to make js2-next-error available when using js2-mode as major mode?

I'm using js2-mode. It provides js2-next-error, but apparently only when using js2-minor-mode and not when using js2-mode as a major mode. This is clear from the code in js2-mode.el (in version ...
mhucka's user avatar
  • 163
0 votes
1 answer
551 views

Javascript LSP mode in Emacs (using typescript-language-server) uses inconsistent indentation between files

On the first file I created, I had tabs set to 4 spaces and wasn't using the LSP yet. Then I enabled the LSP, and on all subsequently created files tabs are 2 spaces, yet on the original file, it ...
Alexis Purslane's user avatar
0 votes
0 answers
10 views

Can I jump the type of a variable in tide (typescript plugin)?

Emacs typescript tool, tide, can jump to where a variable is defined, but I want to jump to where the type of a variable is defined. This is coming up in the context of writing callbacks. P.S There's ...
Att Righ's user avatar
  • 745
0 votes
0 answers
120 views

How can we make eww use emacs.ng JavaScript support for visiting web pages that require js?

I'd like to use eww for visiting webpages like Gmail so that I can have them inside an emacs buffer. However, that requires JavaScript support. Since, emacs.ng now has a JavaScript engine, I'm ...
intel_chris's user avatar
0 votes
0 answers
19 views

Is Javascript supported by `flyspell-prog-mode`?

Which programming languages are supported by flyspell-prog-mode? Is Javascript? I can get flyspell-prog-mode to spellcheck comments on Python buffers, but it doesn't seem to work on Javascript buffers....
Fergie's user avatar
  • 193
1 vote
1 answer
50 views

Switch Cases's code block doesn't get indented in JavaScript mode

I'm having trouble with the indentation of the cases's code-blocks in my switch statements it looks like this: switch(var) { case "case1": case's code line 1; case's code line 2; ...
Santiago Lerin's user avatar
1 vote
1 answer
152 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 ...
Richard Wheeldon's user avatar
0 votes
1 answer
65 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 ...
mislyde_alfabetisk's user avatar
0 votes
1 answer
275 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/...
lawlist's user avatar
  • 18.9k
4 votes
0 answers
465 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 ...
Croad Langshan's user avatar
1 vote
0 answers
256 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 ...
gburnett's user avatar
  • 165
1 vote
0 answers
45 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('...
eguneys's user avatar
  • 175
4 votes
1 answer
716 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 ...
gburnett's user avatar
  • 165
2 votes
3 answers
763 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 ...
cryptograthor's user avatar
1 vote
0 answers
354 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 ...
Simon's user avatar
  • 231
0 votes
0 answers
106 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 ...
Lucas Myers's user avatar
4 votes
4 answers
1k 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 ...
Navidot's user avatar
  • 762
0 votes
1 answer
755 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, ...
Gauthier's user avatar
  • 499
5 votes
2 answers
280 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 /&...
cjauvin's user avatar
  • 594
2 votes
0 answers
76 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 ...
cammil's user avatar
  • 509
1 vote
1 answer
224 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:...
x-yuri's user avatar
  • 281
1 vote
1 answer
902 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?
eugene's user avatar
  • 489
0 votes
0 answers
79 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 ...
Clarice Bouwer's user avatar
0 votes
1 answer
84 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 ...
emacs drives me nuts's user avatar
0 votes
2 answers
618 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 ...
Lee Richmond's user avatar
0 votes
2 answers
814 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 // @...
Robert Zaremba's user avatar
1 vote
2 answers
171 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:/...
Arry's user avatar
  • 203
1 vote
0 answers
2k 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 ...
kresdjan's user avatar
3 votes
1 answer
153 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; ...
Charlie Martin's user avatar
2 votes
1 answer
397 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 ...
MikeTheTall's user avatar
1 vote
1 answer
215 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 ...
Apocalypse Mystic's user avatar
2 votes
1 answer
366 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 ...
anquegi's user avatar
  • 749
1 vote
0 answers
62 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 ...
anquegi's user avatar
  • 749
0 votes
0 answers
709 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 ...
lebesgue's user avatar
  • 101
2 votes
2 answers
813 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 ...
cammil's user avatar
  • 509
0 votes
0 answers
157 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 ...
kotchwane's user avatar
  • 491
1 vote
1 answer
923 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 ...
palerdot's user avatar
  • 111
3 votes
1 answer
1k 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 ...
Begueradj's user avatar
  • 131
1 vote
1 answer
1k 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 `...
Alex028502's user avatar
1 vote
0 answers
28 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 ...
mihovale's user avatar
1 vote
1 answer
670 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, ...
tom_kp's 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 ...
Rob Dhaliwal's user avatar
1 vote
1 answer
212 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?
Matt's user avatar
  • 43
3 votes
0 answers
525 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' ...
WilliamKF's user avatar
  • 383
0 votes
1 answer
257 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:...
David Maze's user avatar
2 votes
1 answer
127 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 ...
Billal Begueradj's user avatar
1 vote
2 answers
258 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: ...
Billal Begueradj's user avatar