This commit is contained in:
Andre Henriques 2023-03-25 23:25:38 +00:00
parent df5eed3f28
commit 675d8f21bb
2 changed files with 130 additions and 128 deletions

4
.gitignore vendored
View File

@ -3,4 +3,6 @@ auto-save-list/
projectile-bookmarks.eld projectile-bookmarks.eld
recentf recentf
settings.el settings.el
transient/ transient/
.cache/
straight/

View File

@ -9,12 +9,12 @@
(use-package afternoon-theme (use-package afternoon-theme
:ensure t :ensure t
:config :config
;;(load-theme 'afternoon t) (load-theme 'afternoon t)
) )
(use-package modus-themes (use-package modus-themes
:ensure t :ensure t
:config :config
(load-theme 'modus-operandi t) ;;(load-theme 'modus-operandi t)
) )
#+end_src #+end_src
** UI ** UI
@ -169,30 +169,30 @@ Setup tree sitter based indentation
#+end_src #+end_src
*** tsx *** tsx
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package coverlay ;; (use-package coverlay
:ensure t) ;; :ensure t)
;;
(use-package origami ;; (use-package origami
:ensure t) ;; :ensure t)
;;
(use-package css-in-js-mode ;; (use-package css-in-js-mode
:straight '(css-in-js-mode ;; :straight '(css-in-js-mode
:type git ;; :type git
:host github ;; :host github
:repo "orzechowskid/tree-sitter-css-in-js")) ;; :repo "orzechowskid/tree-sitter-css-in-js"))
;;
(use-package corfu ;; (use-package corfu
:ensure t) ;; :ensure t)
;;
(setq eglot-server-programs '()) ;; (setq eglot-server-programs '())
(use-package tsx-mode ;; (use-package tsx-mode
:straight '(tsx-mode ;; :straight '(tsx-mode
:type git ;; :type git
:host github ;; :host github
:repo "orzechowskid/tsx-mode.el" ;; :repo "orzechowskid/tsx-mode.el"
:branch "emacs29") ;; :branch "emacs29")
:config ;; :config
(add-to-list 'auto-mode-alist '("\\.tsx?\\'" . tsx-mode))) ;; (add-to-list 'auto-mode-alist '("\\.tsx?\\'" . tsx-mode)))
#+end_src #+end_src
*** webmode *** webmode
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -330,23 +330,24 @@ Auto complete
** LSP ** LSP
Set up lsp Set up lsp
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package lsp-mode (use-package lsp-mode
:init :init
(setq lsp-keymap-prefix "C-c l") (setq lsp-keymap-prefix "C-c l")
:ensure t :ensure t
:hook ( :hook (
;;(XXX-mode . lsp-mode) ;;(XXX-mode . lsp-mode)
;;(typescriptreact-mode . lsp-mode) ;;(typescriptreact-mode . lsp-mode)
(typescript-mode . lsp-mode) ;;(tsx-mode . lsp-mode)
(tsx-mode . lsp-mode) ;;(tsx-ts-mode . lsp-mode)
(tsx-ts-mode . lsp-mode) (typescript-mode . lsp-mode)
(web-mode . lsp-mode) (web-mode . lsp-mode)
(lsp-mode . lsp-enable-which-key-integration)) (lsp-mode . lsp-enable-which-key-integration))
:commands lsp :commands lsp
:config :config
(add-hook 'tsx-mode-hook 'lsp-mode)) ;;(add-hook 'tsx-mode-hook 'lsp-mode)
)
#+end_src #+end_src
Set up lsp ui Set up lsp ui
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -374,69 +375,59 @@ Set up ivy
:commands lsp-ivy-workspace-symbol) :commands lsp-ivy-workspace-symbol)
#+end_src #+end_src
** Flycheck ** Flycheck
*** Helper function
#+begin_src emacs-lisp
(defun define-level-info (name severity compilation-level margin-str)
(flycheck-define-error-level name
:severity severity
:compilation-level compilation-level
:overlay-category 'flycheck-info-overlay
:margin-spec (flycheck-make-margin-spec margin-str 'flycheck-fringe-info)
:fringe-bitmap'flycheck-fringe-bitmap-double-arrow
:fringe-face 'flycheck-fringe-info
:error-list-face 'flycheck-error-list-info))
#+end_src
*** Flycheck
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package flycheck (use-package flycheck
:ensure t :ensure t
:init(global-flycheck-mode) :init(global-flycheck-mode)
:config :config
;; Show indicators in the left margin ;; Show indicators in the left margin
(setq flycheck-indication-mode 'left-margin) (setq flycheck-indication-mode 'left-margin)
;; Adjust margins and fringe widths… ;; Adjust margins and fringe widths…
(defun my/set-flycheck-margins () (defun my/set-flycheck-margins ()
(setq left-fringe-width 0 right-fringe-width 0 (setq left-fringe-width 0 right-fringe-width 0
left-margin-width 2 right-margin-width 0) left-margin-width 2 right-margin-width 0)
(setq flycheck-default-margin-str "🆓") (setq flycheck-default-margin-str "🆓")
(flycheck-refresh-fringes-and-margins)) (flycheck-refresh-fringes-and-margins))
(flycheck-define-error-level 'error (flycheck-define-error-level 'error
:severity 100 :severity 100
:compilation-level 2 :compilation-level 2
:overlay-category 'flycheck-error-overlay :overlay-category 'flycheck-error-overlay
:margin-spec (flycheck-make-margin-spec "❤️" 'flycheck-fringe-error) :margin-spec (flycheck-make-margin-spec "❤️" 'flycheck-fringe-error)
:fringe-bitmap 'flycheck-fringe-bitmap-double-arrow :fringe-bitmap 'flycheck-fringe-bitmap-double-arrow
:fringe-face 'flycheck-fringe-error :fringe-face 'flycheck-fringe-error
:error-list-face 'flycheck-error-list-error) :error-list-face 'flycheck-error-list-error)
(flycheck-define-error-level 'warning (flycheck-define-error-level 'warning
:severity 10 :severity 10
:compilation-level 1 :compilation-level 1
:overlay-category 'flycheck-warning-overlay :overlay-category 'flycheck-warning-overlay
:margin-spec (flycheck-make-margin-spec "😞" 'flycheck-fringe-warning) :margin-spec (flycheck-make-margin-spec "😞" 'flycheck-fringe-warning)
:fringe-bitmap'flycheck-fringe-bitmap-double-arrow :fringe-bitmap'flycheck-fringe-bitmap-double-arrow
:fringe-face 'flycheck-fringe-warning :fringe-face 'flycheck-fringe-warning
:error-list-face 'flycheck-error-list-warning) :error-list-face 'flycheck-error-list-warning)
(flycheck-define-error-level 'info (define-level-info 'info -10 0 "🅰")
:severity -10 (define-level-info 'lsp-flycheck-info-unnecessary -10 0 "🅰")
:compilation-level 0 (define-level-info 'hint -20 -1 "🆓")
:overlay-category 'flycheck-info-overlay
:margin-spec (flycheck-make-margin-spec "🅰" 'flycheck-fringe-info)
:fringe-bitmap'flycheck-fringe-bitmap-double-arrow
:fringe-face 'flycheck-fringe-info
:error-list-face 'flycheck-error-list-info)
(flycheck-define-error-level 'lsp-flycheck-info-unnecessary ;; …every time Flycheck is activated in a new buffer
:severity -10 (add-hook 'flycheck-mode-hook #'my/set-flycheck-margins)
:compilation-level 0 )
:overlay-category 'flycheck-info-overlay
:margin-spec (flycheck-make-margin-spec "🅰" 'flycheck-fringe-info)
:fringe-bitmap'flycheck-fringe-bitmap-double-arrow
:fringe-face 'flycheck-fringe-info
:error-list-face 'flycheck-error-list-info)
(flycheck-define-error-level 'hint
:severity -20
:compilation-level -1
:overlay-category 'flycheck-info-overlay
:margin-spec (flycheck-make-margin-spec "🆓" 'flycheck-fringe-info)
:fringe-bitmap'flycheck-fringe-bitmap-double-arrow
:fringe-face 'flycheck-fringe-info
:error-list-face 'flycheck-error-list-info)
;; …every time Flycheck is activated in a new buffer
(add-hook 'flycheck-mode-hook #'my/set-flycheck-margins)
)
#+end_src #+end_src
Fly check post tip Fly check post tip
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -444,36 +435,45 @@ Fly check post tip
;; :ensure t ;; :ensure t
;; :hook (flycheck-mode . flycheck-pos-tip-mode)) ;; :hook (flycheck-mode . flycheck-pos-tip-mode))
#+end_src #+end_src
Fly check inline Fly check inline (disabled because was getting annoyed)
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package flycheck-posframe ;; (use-package flycheck-posframe
:ensure t ;; :ensure t
:after flycheck ;; :after flycheck
:hook (flycheck-mode . flycheck-posframe-mode) ;; :hook (flycheck-mode . flycheck-posframe-mode)
:config ;; :config
(flycheck-posframe-configure-pretty-defaults) ;; (flycheck-posframe-configure-pretty-defaults)
(setq flycheck-posframe-error-prefix "☣️❤️") ;; (setq flycheck-posframe-error-prefix "☣️❤️")
(setq flycheck-posframe-warning-prefix "🅰😞") ;; (setq flycheck-posframe-warning-prefix "🅰😞")
(setq flycheck-posframe-info-prefix "🅰🆓") ;; (setq flycheck-posframe-info-prefix "🅰🆓")
(set-face-attribute 'flycheck-posframe-error-face ;; (set-face-attribute 'flycheck-posframe-error-face
nil ;; nil
:inherit nil ;; :inherit nil
:foreground "#b72c01") ;; :foreground "#b72c01")
(set-face-attribute 'flycheck-posframe-warning-face ;; (set-face-attribute 'flycheck-posframe-warning-face
nil ;; nil
:foreground "#b77401") ;; :foreground "#b77401")
;;
(set-face-attribute 'flycheck-posframe-info-face ;; (set-face-attribute 'flycheck-posframe-info-face
nil ;; nil
:foreground "#0156b7") ;; :foreground "#0156b7")
;;
(setq flycheck-posframe-border-width 3) ;; (setq flycheck-posframe-border-width 1)
(set-face-attribute 'flycheck-posframe-border-face ;; (setq flycheck-posframe-position 'point-top-left-corner)
nil ;;
:foreground "#dc752f") ;; (set-face-attribute 'flycheck-posframe-border-face
(add-to-list 'flycheck-posframe-inhibit-functions #'(lambda () company-backend))) ;; nil
;; :foreground "#dc752f")
;; (add-to-list 'flycheck-posframe-inhibit-functions #'(lambda () company-backend)))
#+end_src #+end_src
** TIDE
#+begin_src emacs-lisp
(use-package tide
:ensure t
:after (typescript-mode company flycheck)
:hook ((typescript-mode . tide-setup)
(typescript-mode . tide-hl-identifier-mode)
(before-save . tide-format-before-save)))
(add-to-list 'auto-mode-alist '("\\.tsx?\\'" . typescript-mode))
#+end_src