all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Looking For Any Emacs Config Examples That Has LSP Mode With 'aggressive-indent' Mode
@ 2022-04-28 16:46 Samuel Banya
  2022-04-28 20:36 ` Óscar Fuentes
  0 siblings, 1 reply; 5+ messages in thread
From: Samuel Banya @ 2022-04-28 16:46 UTC (permalink / raw)
  To: Emanuel Berg

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-04-30  1:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-28 16:46 Looking For Any Emacs Config Examples That Has LSP Mode With 'aggressive-indent' Mode Samuel Banya
2022-04-28 20:36 ` Óscar Fuentes
2022-04-28 21:53   ` Samuel Banya
2022-04-28 23:44     ` Óscar Fuentes
2022-04-30  1:42       ` Samuel Banya

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.