Questions tagged [javascript]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
3 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) ....
1
vote
1answer
124 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?
0
votes
0answers
15 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 ...
1
vote
1answer
67 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:...
2
votes
0answers
31 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 ...
0
votes
2answers
222 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
1answer
38 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?
20
votes
4answers
7k views

How to edit jsx (react) files in emacs?

I've use js2-mode but it don't indent html in javascript properly. I've found this repo https://github.com/jsx/jsx-mode.el but it's not for react, it's for some other jsx. What do you use for editing ...
1
vote
1answer
218 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 ...
0
votes
1answer
85 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 ...
0
votes
0answers
22 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
18 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
72 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 ...
1
vote
2answers
62 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
350 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 ...
0
votes
0answers
267 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 ...
1
vote
1answer
38 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
70 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
85 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 ...
10
votes
1answer
3k views

How to get org-babel source block working with ES6-7?

I'm having difficulty getting org-babel to evaluate this block of code with emacs v24.5 node v5.0.0 babel-node v.6.6.5 #+BEGIN_SRC js :cmd "babel-node" let arr = [1, 2]; let [x, y] = ...
1
vote
0answers
25 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 ...
2
votes
2answers
243 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 ...
1
vote
1answer
484 views

Unable to Set Javascript Indent on Spacemacs

I have a vanilla Spacemacs setup, and in my .spacemacs file, the dotspacemacs/user-config definition I have added (setq js2-basic-offset 2) which should be sufficient to set the indent length as 2. I ...
0
votes
0answers
55 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
297 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
386 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 ...
1
vote
2answers
828 views

Embbed html/javascript in org-mode html export

Is it possible to embed an html file within an html exported from org-mode? I don't mean to "quote" the source of the file (which is possible with #+INCLUDE: "someFile.html" src html). My use case ...
1
vote
1answer
399 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
412 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
24 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 ...
0
votes
1answer
991 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 ...
0
votes
1answer
527 views

Enable JSX folding in web-mode

I'm using web-mode to edit jsx files and I'm wondering what minor-mode can I use to add folding support. Is there anything out there that works? Thanks
3
votes
0answers
289 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' ...
5
votes
1answer
699 views

Indent javascript arrow functions like regular anonymous functions

Using Emacs 25.1 and js-mode for javascript editing. Is it possible to change the indention rules in js-mode to customize the indention of arrow functions? Example of anonymous function indention: ...
21
votes
3answers
6k views

How to use skewer-mode?

I am currently struggling to use skewer-mode in Emacs. I downloaded and installed skewer-mode via MELPA, so all the dependencies should be inplace. For testing purposes I even downloaded the boidsjs ...
0
votes
1answer
218 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:...
0
votes
2answers
152 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: ...
2
votes
1answer
303 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 ...
2
votes
1answer
97 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 ...
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
278 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', () => { ...
1
vote
2answers
140 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, "$": ...
3
votes
2answers
651 views

Stop javascript-mode from lining up function parameters after newline

Using javascript-mode, functions are indented like this: console.log('Example', var1, var2); test('Example2', var1, var2); I'd like to change this so that ...
2
votes
2answers
397 views

Can't get a Node REPL with swank-js

I have followed the instructions on Github for setting up swank-js. I installed slime and slime-js from github and have the following in my .emacs file: (add-to-list 'load-path "~/slime/") (...
2
votes
1answer
274 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 ...
0
votes
0answers
139 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
63 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
563 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
257 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 ...
9
votes
2answers
4k views

How prettify (newlines and indentation) an optimized HTML/JS file?

For example, I have the following bunch of characters (HTML): http://pastebin.com/pwTPp8wd I thought everyone stumbled it upon a processed file, especially when someone would speed up the processing ...