emacs/web: switch to typescript mode + lsp.

This commit is contained in:
Kevin Baensch 2021-11-25 22:13:28 +01:00
parent 47500b78e3
commit 2d3ca78643
Signed by: derped
GPG key ID: C0F1D326C7626543
2 changed files with 28 additions and 11 deletions

View file

@ -18,6 +18,10 @@ mkIf (elem "emacs::lsp" config.machine.pkgs) {
${optionalString (elem "emacs::rust" config.machine.pkgs) ''
(setq lsp-rust-clippy-preference "on")
''}
${optionalString (elem "emacs::web-mode" config.machine.pkgs) ''
(setq lsp-clients-deno-enable-unstable 't)
(setq lsp-disabled-clients '(ts-ls))
''}
'';
};

View file

@ -28,19 +28,32 @@ mkIf (elem "emacs::web-mode" config.machine.pkgs) {
};
js2-mode = {
enable = true;
};
tide = {
enable = true;
after = [ "typescript-mode" "company" "flycheck" ];
hook = [
"(typescript-mode . tide-setup)"
"(typescript-mode . tide-hl-identifier-mode)"
"(before-save . tide-format-before-save)"
mode = [
''("\\.js\\'" . js2-mode)''
];
config = ''
(setq company-tooltip-align-annotations t)
'';
};
typescript-mode = {
enable = true;
hook = lib.optional (elem "emacs::lsp" config.machine.pkgs)
''(typescript-mode . (lambda () (lsp)))'';
mode = [
''("\\.ts\\'" . typescript-mode)''
];
};
# tide = {
# enable = true;
# after = [ "typescript-mode" "company" "flycheck" ];
# hook = [
# "(typescript-mode . tide-setup)"
# "(typescript-mode . tide-hl-identifier-mode)"
# "(before-save . tide-format-before-save)"
# ];
# config = ''
# (flycheck-mode +1)
# (setq flycheck-check-syntax-automatically '(save mode-enabled))
# (setq company-tooltip-align-annotations t)
# '';
# };
impatient-mode = {
enable = true;
};