help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Looking For Any Emacs Config Examples That Has LSP Mode With 'aggressive


From: Samuel Banya
Subject: Looking For Any Emacs Config Examples That Has LSP Mode With 'aggressive-indent' Mode
Date: Thu, 28 Apr 2022 12:46:59 -0400
User-agent: Cyrus-JMAP/3.7.0-alpha0-591-gfe6c3a2700-fm-20220427.001-gfe6c3a27

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]