doomemacs / doomemacs/core

JavaScript +lsp (TypeScript) not displaying errors correctly/not jumping to the correct definitions

Open
#7,198 2 comments 0 reactions 0 assignees View on GitHub
is:bug needs-triage
Dominant language
Emacs Lisp
Stars
22.7k
Forks
3.1k
Avg merge
10h 46m
Merged PRs (30d)
4

Description

### I confirm that...

- [X] I have searched the [issue tracker](https://github.com/doomemacs/doomemacs/issues), [documentation](https://docs.doomemacs.org), [FAQ](https://docs.doomemacs.org/-/faq), [Discourse](https://discourse.doomemacs.org), and [Google](https://google.com), in case this issue has already been reported/resolved.

- [X] I have read "[How to Debug Issues](https://doomemacs.org/d/how2debug)", and will use it to provide as much information about this issue as possible.

- [X] The issue can be reproduced on the **latest** available commit of Doom.

- [X] The issue can be reproduced on a stable release of Emacs, such as 27 or 28. *(Doom does not support development builds like 29+ or any version ending in .50 or .9x)*

### Expected behavior

I love Doom! Thank you so much for making and maintaining this terrific application. I have scoured the internet for solutions and I can't seem to configure TypeScript and/or React in a way that is comparable to VSCode's language support. The amount of options and package combinations makes this particularly confusing to set up.

I would like Doom to replicate LSP/ESLint functionality found in VSCode, particularly the following:

1. Show/highlight/underline errors as determined by my ESLint configuration
2. Perform lookup on functions, variables, etc. on all files in the project, including source code contained in `node_modules`

I would also like to ask, in lieu of a specific fix, if you know of any configuration that emulates VSCode's functionality more closely.

And more generally, what is the preferred language server, tide, typescript-mode, etc. that should be used at the time of writing this.

### Current behavior

1. One example of Doom being inconsistent with VSCode's error highlighting is as follows:
```javascript
let x;
x['stuff'] = 0;
```
VSCode correctly reports "'x' is possibly 'undefined'.ts(18048)" here and red-underlines "x" (I have a separate keybinding, `spc-e-e` in VSCode for displaying the error message box):
![Screenshot from 2023-04-13 13-53-03](https://user-images.githubusercontent.com/64985192/231843534-d1bae61f-cdca-4ba7-b037-80582b9e9b43.png)
Doom fails to produce any warning or error at all in this example:
![Screenshot from 2023-04-13 13-51-35](https://user-images.githubusercontent.com/64985192/231843081-167baa44-e28e-4473-9447-c1f06ee9db31.png)
2. Performing `g-d` or `spc-c-d` (jump to definition) on this statement, whose source is contained in a `node_modules` directory, doesn't jump to or display the definition. Rather, it displays/jumps to usage of it within my own project:
![Screenshot from 2023-04-13 13-36-42](https://user-images.githubusercontent.com/64985192/231841382-f24d4c41-48e1-49a0-b038-3076bcf6fd40.png)
Trying `spc-c-D` (jump to references) produces this:
![Screenshot from 2023-04-13 13-37-26](https://user-images.githubusercontent.com/64985192/231841706-b2eea539-5754-4dd6-9e03-27a0d73067dc.png)
And `spc-c-l` for LSP mode shows no options:

![Screenshot from 2023-04-13 13-38-13](https://user-images.githubusercontent.com/64985192/231840959-d8b7496b-5cbc-40b7-adee-1d95d685d618.png)

Ideally one of these commands would replicate VSCode's `g-d`functionality, opening a new buffer and taking me straight to the definition like this:
![Screenshot from 2023-04-13 13-48-57](https://user-images.githubusercontent.com/64985192/231842824-d8681a6a-2a9c-4e90-960a-b28b1d8ed370.png)

### Steps to reproduce

See above. In the pastebin, I've included system info as well as my project's `eslintrc, package.json, tsconfig.json` files.

I apologize in advance if I've missed something obvious with setting all this up. I'm quite a novice with Emacs, but I've managed to setup language features for other languages with relative ease.

### System Information

https://pastebin.com/i7USf6Q6

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.