From: "Samuel Banya" <sbanya@fastmail.com>
To: "Emanuel Berg" <help-gnu-emacs@gnu.org>
Subject: Looking For Any Emacs Config Examples That Has LSP Mode With 'aggressive-indent' Mode
Date: Thu, 28 Apr 2022 12:46:59 -0400 [thread overview]
Message-ID: <6f6d11c1-d2f0-48b8-992b-5687804132ea@www.fastmail.com> (raw)
Hey there,
I'm vamping up my Emacs config so that I can make it handle web dev related projects, specifically anything related to HTML, CSS, JS, Typescript, Python, Ruby, etc.
However, I'm not having the best time with automatic indentation for Emacs so far, even after really trying to take some deep dives with my config and some of the 'System Crafters' based LSP mode based videos.
I'm wondering if anyone could help me figure out why 'aggressive-indent' and 'LSP Mode' in my config just do not get along with each other, or could offer their config examples to help me figure out how to solve that issue.
As much as I despise VS Code and how ironic it is that LSP wouldn't exist without VS Code, I do envy the fact that it 'just works' out of the box when it comes to this indentation stuff.
Here's my Emacs config itself:
https://github.com/SamuelBanya/dotfiles
Here's my config snippets that contain LSP Mode and various web mode stuff:
```
*** Add 'lsp-mode' for better autocompletion for many programming languages (python, ruby, java, C++)
#+begin_src emacs-lisp
(defun ef/lsp-mode-setup ()
;; Taken from this 'System Crafters' video:
;; https://www.youtube.com/watch?v=E-NAM9U5JYE
;; This allows breadcrumb segments to appear in projects
(setq lsp-headerline-breadcrumb-segments '(path-up-to-project file symbols))
(lsp-headerline-breadcrumb-mode))
(use-package lsp-mode
:ensure t
:commands (lsp lsp-deferred)
;; Taken from this page:
;; https://www.mattduck.com/lsp-python-getting-started.html
:init
(setq lsp-keymap-prefix "C-c l")
:config
(lsp-enable-which-key-integration t)
;; Set 'lsp-idle-delay' to 0.5 seconds for quick autocompletion
(setq lsp-idle-delay 0.5))
#+end_src
*** Add 'typescript-mode' for Typescript support for 'lsp-mode'
#+begin_src emacs-lisp
(use-package typescript-mode
:ensure t
:mode ("\\.ts\\'" "\\.tsx\\'")
:hook (typescript-mode . lsp-deferred)
:config
(setq typescript-indent-level 2))
#+end_src
*** Add 'web-mode' for support for .html, .ejs, .tsx, and .jsx files
#+begin_src emacs-lisp
(use-package web-mode
:mode "(\\.\\(html?\\|ejs\\|tsx\\|jsx\\)\\'"
:config
(setq-default web-mode-code-indent-offset 2)
(setq-default web-mode-markup-indent-offset 2)
(setq-default web-mode-attribute-indent-offset 2))
#+end_src
```
Thanks,
Sam
next reply other threads:[~2022-04-28 16:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-28 16:46 Samuel Banya [this message]
2022-04-28 20:36 ` Looking For Any Emacs Config Examples That Has LSP Mode With 'aggressive-indent' Mode Óscar Fuentes
2022-04-28 21:53 ` Samuel Banya
2022-04-28 23:44 ` Óscar Fuentes
2022-04-30 1:42 ` Samuel Banya
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6f6d11c1-d2f0-48b8-992b-5687804132ea@www.fastmail.com \
--to=sbanya@fastmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).