haskell-ts-mode.el
changeset 2 9272314a1c65
parent 1 27f2627e9f2f
equal deleted inserted replaced
1:27f2627e9f2f 2:9272314a1c65
   356     (setq-local indent-tabs-mode nil))
   356     (setq-local indent-tabs-mode nil))
   357   ;; Comment
   357   ;; Comment
   358   (setq-local comment-start "-- ")
   358   (setq-local comment-start "-- ")
   359   (setq-local comment-use-syntax t)
   359   (setq-local comment-use-syntax t)
   360   (setq-local comment-start-skip "\\(?: \\|^\\)-+")
   360   (setq-local comment-start-skip "\\(?: \\|^\\)-+")
   361   ;; Elecric
   361   ;; Electric
   362   (setq-local electric-pair-pairs
   362   (setq-local electric-pair-pairs
   363 	      '((?` . ?`) (?\( . ?\)) (?{ . ?}) (?\" . ?\") (?\[ . ?\])))
   363 	      '((?` . ?`) (?\( . ?\)) (?{ . ?}) (?\" . ?\") (?\[ . ?\])))
   364   ;; Nav
   364   ;; Navigation
   365   (setq-local treesit-defun-name-function 'haskell-ts-defun-name)
   365   (setq-local treesit-defun-name-function 'haskell-ts-defun-name)
   366   (setq-local treesit-defun-type-regexp
   366   (setq-local treesit-defun-type-regexp
   367 	      ;; Since haskell is strict functional, any 2nd level
   367 	      ;; Since haskell is strict functional, any 2nd level
   368 	      ;; entity is defintion
   368 	      ;; entity is defintion
   369 	      (cons ".+"
   369 	      (cons ".+"
   436      (make-comint "haskell" "ghci" nil buffer-file-name))))
   436      (make-comint "haskell" "ghci" nil buffer-file-name))))
   437 
   437 
   438 (defun haskell-ts-haskell-session ()
   438 (defun haskell-ts-haskell-session ()
   439   (get-buffer-process "*haskell*"))
   439   (get-buffer-process "*haskell*"))
   440 
   440 
   441 (defvar eglot-server-programs)
       
   442 
       
   443 (defun haskell-ts-setup-eglot()
       
   444   (interactive)
       
   445   (add-to-list 'eglot-server-programs
       
   446 	       '(haskell-ts-mode . ("haskell-language-server-wrapper" "--lsp"))))
       
   447 
       
   448 (when (treesit-ready-p 'haskell)
   441 (when (treesit-ready-p 'haskell)
   449   (add-to-list 'auto-mode-alist '("\\.hs\\'" . haskell-ts-mode)))
   442   (add-to-list 'auto-mode-alist '("\\.hs\\'" . haskell-ts-mode)))
   450 
   443 
   451 (provide 'haskell-ts-mode)
   444 (provide 'haskell-ts-mode)
   452 
   445