Skip to content

Instantly share code, notes, and snippets.

@AgrYpn1a
Created June 26, 2024 16:42
Show Gist options
  • Save AgrYpn1a/5ed03b47b945ee9aec775889e8623821 to your computer and use it in GitHub Desktop.
Save AgrYpn1a/5ed03b47b945ee9aec775889e8623821 to your computer and use it in GitHub Desktop.
;; Eglot ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(use-package eglot
:after
(project projectile)
:config
;; Scala
(add-to-list 'eglot-server-programs '(scala-mode . ("metals-emacs")))
;; React
(add-to-list 'eglot-server-programs
'((rjsx-mode) "typescript-language-server" "--stdio"))
;; TODO: Testing out this configuration
;; Define workspace configuration for typescript-language-server
;; (setq-local eglot-workspace-configuration
;; '((:typescript . (:preferences
;; (:disableSuggestions false)
;; :diagnostics
;; (:noSemanticValidation true)))))
;; React + Typescript
(add-to-list 'eglot-server-programs
'((typescriptreact-mode) "typescript-language-server" "--stdio"))
;; Haskell
(add-hook 'haskell-mode-hook 'eglot-ensure)
(setq-default eglot-workspace-configuration
'((haskell
(plugin
(stan
(globalOn . :json-false))))
)) ;; disable stan
(setq eglot-confirm-server-edits nil)
;; Ensure Flymake is disabled after Eglot is initialized
;; we want to use Flycheck instead
(add-hook 'eglot-managed-mode-hook (lambda ()
(flymake-mode -1)
(flycheck-mode 1)))
(put 'eglot-node 'flymake-overlay-control nil)
(put 'eglot-warning 'flymake-overlay-control nil)
(put 'eglot-error 'flymake-overlay-control nil)
:hook
(typescript-ts-base-mode . eglot-ensure)
(rjsx-mode . eglot-ensure)
:custom
(eglot-autoshutdown t)
)
;; Flycheck ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(use-package flycheck
:ensure t
:init
(global-flycheck-mode)
:config
(flymake-mode -1)
(advice-add 'flycheck-eslint-config-exists-p :override (lambda() t))
(flycheck-add-mode 'javascript-eslint 'rjsx-mode)
(setq flycheck-javascript-eslint-executable "eslint_d"))
(use-package flycheck-eglot
:ensure t
:after (flycheck eglot)
:custom (flycheck-eglot-exclusive nil)
:config
(global-flycheck-eglot-mode 1))
(add-hook 'after-init-hook #'global-flycheck-mode)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment