Configure lsp-js for .jsx file in emacs (chatgpt reply unverified)

✅ Step 1: Add jsconfig.json (MOST IMPORTANT)

Create this in your project root:

{
"compilerOptions": {
"target": "ES2020",
"module": "ESNext",
"jsx": "react-jsx",
"allowJs": true,
"checkJs": false
},
"include": ["src"]
}

👉 This alone fixes:

  • random errors
  • unstable suggestions
  • tsserver confusion

✅ Step 2: Clean LSP config (minimal, stable)

Add this in .emacs:

(require 'lsp-mode)

(add-hook 'js-mode-hook #'lsp)
(add-hook 'jsx-mode-hook #'lsp)

;; 🔥 reduce noise (important)
(setq lsp-enable-symbol-highlighting nil)
(setq lsp-modeline-diagnostics-enable nil)
(setq lsp-diagnostics-provider :none)

;; optional: faster performance
(setq lsp-idle-delay 0.5)
(setq lsp-log-io nil)

✅ Step 3: Use correct TS server

Make sure installed:

npm install -g typescript

👉 lsp-mode uses tsserver internally


🔥 Step 4: Stop the blinking permanently

You already suffered this, so disable the noisy UI parts:

(setq lsp-ui-sideline-enable nil)
(setq lsp-ui-doc-enable nil)

If using lsp-ui.


No comments:

Post a Comment

If you have any doubts, please let me know.

Various types of salts effect on health (discussion with gemenie)

Is  rock salt or bitnoon helps in digestion or just a airuvedic nuska This is for informational purposes only. For medical advice or diagnos...