 ;; php mode supports
 (use-package php-mode :ensure t :pin melpa)
 ;; fsharp mode supports
-(use-package fsharp-mode :ensure t :pin melpa
-  :hook (fsharp . (lambda () (require 'eglot-fsharp))))
+;; (use-package fsharp-mode :ensure t :pin melpa)
+
+;; typescript mode
+(use-package typescript-mode :pin melpa :ensure t)
+
+;; haskell mode
+(use-package haskell-mode :pin melpa :ensure t)
+(use-package lsp-haskell :pin melpa :ensure t :after haskell-mode)
+
+;; meson mode
+(use-package meson-mode :pin melpa :ensure t)
 
 ;; rust supports
 (use-package rust-mode :pin melpa :mode "\\.rs$"

(use-package parchment-theme :pin melpa)
(use-package nord-theme :pin melpa)
(use-package github-theme :pin melpa)
(use-package night-owl-theme :pin melpa)
(use-package github-modern-theme :pin melpa)
;; (use-package almost-mono-theme :pin melpa)
(use-package darktooth-theme :pin melpa)

;; (load-theme 'poet-dark-monochrome t)
;; (load-theme 'nord t)
;; (load-theme 'github-modern t)
;; (load-theme 'misterioso t)
;; (load-theme 'night-owl t)
(load-theme 'hydandata-light t)
(zerodark-setup-modeline-format)

;; multiple major modes in emacs
(use-package polymode :pin melpa)
(use-package poly-markdown :pin melpa :mode "\\.md$")
(use-package poly-rst :pin melpa :mode "\\.rst$")
(use-package poly-slim :pin melpa :mode "\\.slim$")

(use-package markdown-mode :pin melpa
  :init

;; (use-package dap-mode :pin melpa)

;; abandon lsp-mode, let's try eglot
;; (use-package eglot :pin melpa
;;   :config (add-to-list 'eglot-server-programs '((caml-mode tuareg-mode) . ("ocamllsp")
;;                                                 (rust-mode) . ("rust-analyzer"))))

;; (use-package eglot :pin melpa
;;   :config
;;   (add-to-list 'eglot-server-programs `(tuareg-mode . ("ocamllsp"))))

;; (use-package eglot-jl :pin melpa)

(use-package rustic :pin melpa
  :config
  (setq rustic-lsp-server 'rust-analyzer))

;; (setq lsp-keymap-prefix "s-l")

(use-package lsp-mode
    :hook (;; replace XXX-mode with concrete major-mode(e. g. python-mode)
           (python-mode . lsp-deferred)
           (rust-mode . lsp-deffered)
           (go-mode . lsp-deffered)
           (ocaml-mode . lsp-deffered)
           (scala-mode . lsp-deffered)
           (java-mode . lsp-deffered)
           ;; if you want which-key integration
           (lsp-mode . lsp-enable-which-key-integration))
    :commands (lsp lsp-deffered))

;; optionally
(use-package lsp-ui :commands lsp-ui-mode)
;; if you are ivy user
(use-package lsp-ivy :commands lsp-ivy-workspace-symbol)

;; optionally if you want to use debugger
(use-package dap-mode)
;; (use-package dap-LANGUAGE) to load the dap adapter for your language

;; optional if you want which-key integration
(use-package which-key :config (which-key-mode))

;; follow https://github.com/ubolonton/emacs-tree-sitter
(use-package tree-sitter :pin ublt :ensure t
  :demand t
  :config (progn
            (require 'tree-sitter-query)
            (require 'tree-sitter-hl)
            (add-hook 'tree-sitter-after-on-hook #'tree-sitter-hl-mode)
            (add-to-list 'tree-sitter-major-mode-language-alist '(go-mode . go))
            (add-to-list 'tree-sitter-major-mode-language-alist '(scala-mode . scala))
            (add-to-list 'tree-sitter-major-mode-language-alist '(rust-mode . rust))
            (add-to-list 'tree-sitter-major-mode-language-alist '(rustic-mode . rust))
            (add-to-list 'tree-sitter-major-mode-language-alist '(clojure-mode . clojure))
            (add-to-list 'tree-sitter-major-mode-language-alist '(ocaml-mode . ocaml))
            (add-to-list 'tree-sitter-major-mode-language-alist '(tuareg-mode . ocaml))
            (add-to-list 'tree-sitter-major-mode-language-alist '(python-mode . python))
            (add-to-list 'tree-sitter-major-mode-language-alist '(typescript-mode . typescript))
            (add-to-list 'tree-sitter-major-mode-language-alist '(js-mode . javascript))
            (add-hook 'js-mode-hook #'tree-sitter-mode)
            (add-hook 'typescript-mode-hook #'tree-sitter-mode)
            (add-hook 'python-mode-hook #'tree-sitter-mode)
            (add-hook 'rust-mode-hook #'tree-sitter-mode)
            (add-hook 'go-mode-hook #'tree-sitter-mode)
            (add-hook 'scala-mode #'tree-sitter-mode)
            (add-hook 'clojure-mode-hook #'tree-sitter-mode)
            (add-hook 'java-mode-hook #'tree-sitter-mode)
            (add-hook 'ocaml-mode-hook #'tree-sitter-mode)
            (add-hook 'tuareg-mode-hook #'tree-sitter-mode)
            (global-tree-sitter-mode)))

(use-package tree-sitter-langs :pin ublt :ensure t :after tree-sitter)

(use-package gif-screencast :pin melpa :ensure t)
(use-package pass :pin melpa)
