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

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

Question Regarding Indenting With 'LSP Mode' Vs 'aggressive-indent' On M


From: Samuel Banya
Subject: Question Regarding Indenting With 'LSP Mode' Vs 'aggressive-indent' On Mac OS Using Emacs
Date: Wed, 09 Mar 2022 15:47:24 -0500
User-agent: Cyrus-JMAP/3.5.0-alpha0-4778-g14fba9972e-fm-20220217.001-g14fba997

Hey there,

LSP Mode works great.

However, the indenting gets a bit weird at times and fights with 'aggressive 
indent'.

I'm wondering if anyone could help me figure out how to get a better workflow 
that works.

I'm thinking that I might have to just disable aggressive indent, and enable 
LSP everywhere instead to allow it to take precedent.

My major issue is that the indenting gets super weird for any project that has 
LSP Mode enabled.

The one thing I thought of in terms of troubleshooting was to get a list of the 
modes that were enabled while in a TypeScript buffer for example.

*Related Modes Enabled:*
Enabled minor modes: Aggressive-Indent Async-Bytecomp-Package
Auto-Composition Auto-Compression Auto-Encryption Beacon Blink-Cursor
Column-Number Dap Dap-Auto-Configure Dap-Tooltip Dap-Ui
Dap-Ui-Controls Dap-Ui-Many-Windows Display-Time Electric-Indent
Electric-Pair Evil-Collection-Unimpaired File-Name-Shadow Flycheck
Font-Lock Global-Aggressive-Indent Global-Eldoc
Global-Evil-Collection-Unimpaired Global-Flycheck Global-Font-Lock
Global-Hungry-Delete Global-Subword Helm Hl-Line Hungry-Delete
Line-Number Mac-Mouse-Wheel Override-Global Rainbow Rainbow-Delimiters
Recentf Shell-Dirtrack Subword Tooltip Transient-Mark
Treemacs-Filewatch Treemacs-Follow Treemacs-Fringe-Indicator
Treemacs-Git Which-Key
*
*
*Here's my related config regarding LSP Mode:*
`*** 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 'company' Mode for auto-completion in conjunction with 'lsp-mode'
#+begin_src emacs-lisp
  (use-package company
    :ensure t
    :after lsp-mode
    :hook (lsp-mode . company-mode)
    :bind (:map company-active-map
                ("<tab>" . company-complete-selection))
    (:map lsp-mode-map
          ("<tab>" . company-indent-or-complete-common))
    :custom
    (company-minimum-prefix-length 1)
    (company-idle-delay 0.0))
#+end_src
*** Add 'flycheck' for programming syntax checking on-the-fly
#+BEGIN_SRC emacs-lisp
  (use-package flycheck
    :ensure t
    :init
    (global-flycheck-mode t))
#+END_SRC`
`*** Add 'aggressive-indent' to allow to easier indentation for code
#+BEGIN_SRC emacs-lisp
  (use-package aggressive-indent
    :ensure t
    :config
    (global-aggressive-indent-mode 1))
#+END_SRC`
*
*
*CONTINUED:*
 * This was taken from here:
 * https://git.musimatic.xyz/dotfiles/tree/emacs/.emacs.d/configuration.org

Thanks!


reply via email to

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