Questions tagged [javascript]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
10 views

How to use imenu with tsx (typescript and jsx) files?

I would like to use imenu with .tsx files, but it doesn't seem to work. imenu does work with other file types (I have tested with .el, .py, .js), but not with .tsx. How can I get imenu to work with ....
0
votes
0answers
9 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 ...
0
votes
0answers
35 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 ...
1
vote
3answers
207 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 ...
0
votes
0answers
26 views

How to test if flycheck is enabled?

For some of my JavaScript projects I use Flycheck with the javascript-eslint checker to highlight problems. This works great. I disabled many of js2-mode's checks so that they don't overlap with ...
0
votes
1answer
89 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, ...
2
votes
0answers
60 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 /&...
0
votes
0answers
26 views

rjsx-mode can't uncomment c-style block comments

I recently switched from web-mode to rjsx-mode in my react-native project. In my code I have a lot of C-style block comments, like this: /* var a = "a"; * var b = "b"; * var c = &...
0
votes
0answers
7 views

How to fix indent of multiline dotpaths in javascript

I would like my code to look like this: this.imgs.push( $('<img>').attr('src', data.src) .css('position', 'absolute') ); this.imgs[i].css('left', data.x) ....
0
votes
0answers
66 views

Creating a javascript IDE with Indium

I'm trying to setup a working web dev environment. I'm using web-mode and impatient mode with HTML and CSS, which works really well. Now, I'd like to work with Javascript and jquery as part of the ...
2
votes
0answers
33 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 ...
1
vote
1answer
96 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:...
1
vote
1answer
112 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?
0
votes
0answers
34 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 ...
0
votes
1answer
37 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 ...
0
votes
2answers
160 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 ...
0
votes
2answers
393 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 // @...
1
vote
2answers
91 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:/...
1
vote
0answers
541 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 ...
2
votes
1answer
73 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; ...
1
vote
1answer
125 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 ...
0
votes
1answer
110 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 ...
1
vote
1answer
250 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 ...
1
vote
0answers
40 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 ...
0
votes
0answers
407 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 ...
2
votes
2answers
355 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 ...
0
votes
0answers
75 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 ...
1
vote
1answer
461 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 ...
3
votes
1answer
630 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 ...
0
votes
1answer
568 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 `...
1
vote
0answers
25 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 ...
1
vote
1answer
478 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, ...
0
votes
1answer
1k 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 ...
1
vote
1answer
136 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?
3
votes
0answers
325 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' ...
0
votes
1answer
233 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:...
2
votes
1answer
107 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 ...
0
votes
2answers
182 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: ...
4
votes
2answers
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. ...
3
votes
1answer
302 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', () => { ...
0
votes
1answer
90 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 ...
2
votes
1answer
294 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 ...
2
votes
2answers
158 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, "$": ...
0
votes
0answers
151 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?
2
votes
1answer
70 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 ...
4
votes
1answer
647 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?
1
vote
1answer
304 views

Syntax highlighting inside HTML5 <script> tags

I was curious if there was a way to get highlighting/indentation for any JavaScript that's inside of HTML5 tags? I don't frequently use JavaScript but for a class I'm in we're working with it. I ...
1
vote
1answer
48 views

How to make RET insert a blank line and indent and put point on this line when point between `{}`?

In most JavaScript IDEs, there is a feature that pressing RET when point is between {}, results in an indented blank line with point on the end of this blank line, as shown in the following two ...
3
votes
1answer
2k views

Emacs as JavaScript IDE. What is the best package for this?

Windows 10, Emacs 25.1 I want to write many JavaScript files on Emacs. And as result I need comfortable mode to work with javascript. So as result I want to use Emacs as JavaScript IDE. The ...
2
votes
1answer
363 views

How to detect and match indentation size of current buffer

I'm working on a javascript project that has inconsistent tab sizes 2spaces vs 4spaces on the server and client. I'm using web-mode for javascript editing. I'm looking for a feature like SublimeTexts ...