commit 2b2668d8e78199ae39c2022a458d5b8c96e034b2
parent 072a1857b0ebaae707af594205692a8dc90679ea
Author: Vincent Demeester <vincent@sbr.pm>
Date: Thu, 9 Nov 2023 16:15:18 +0100
Add some typescript/javascript support in emacs
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Diffstat:
4 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/tools/emacs/config/programming-eglot.el b/tools/emacs/config/programming-eglot.el
@@ -30,6 +30,10 @@
(cc-mode . eglot-ensure)
(go-mode . eglot-ensure)
(go-ts-mode . eglot-ensure)
+ (js-mode . eglot-ensure)
+ (js2-mode . eglot-ensure)
+ (typescript-mode . eglot-ensure)
+ (typescript-ts-mode . eglot-ensure)
:custom
rustic-lsp-client 'eglot)
diff --git a/tools/emacs/config/programming-js.el b/tools/emacs/config/programming-js.el
@@ -0,0 +1,23 @@
+;;; programming-js.el --- -*- lexical-binding: t; -*-
+;;; Commentary:
+;;; Javascript and Typescript programming language configuration
+;;; Code:
+
+(use-package js2-mode
+ :hook
+ (js2-mode . js-ts-mode-hook))
+
+(use-package typescript-mode
+ :hook
+ (typescript-mode . typescript-ts-mode-hook))
+
+(use-package typescript-ts-mode
+ :mode (("\\.ts\\'" . typescript-ts-mode)
+ ("\\.tsx\\'" . tsx-ts-mode)))
+
+(use-package json-mode
+ :hook
+ (json-mode . json-ts-mode-hook))
+
+(provide 'programming-go)
+;;; programming-go.el ends here
diff --git a/users/vincent/dev/emacs.nix b/users/vincent/dev/emacs.nix
@@ -127,6 +127,7 @@ let
trashed
treesit-auto
try
+ typescript-mode
undo-tree
use-package
visual-fill-column
diff --git a/users/vincent/dev/js.nix b/users/vincent/dev/js.nix
@@ -3,4 +3,9 @@
home.file.".npmrc".text = ''
prefix = ${config.home.homeDirectory}/.local/npm
'';
+
+ home.packages = with pkgs; [
+ javascript-typescript-langserver
+ vscode-langservers-extracted
+ ];
}