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
recentf
settings.el
transient/
transient/
.cache/
straight/

View File

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