~mgmarlow/deno-ts-mode

Major mode for deno, based on typescript-ts-mode
Add deno-tsx-ts-mode and automatically configure Eglot
Update docs and bump to 0.2.0

clone

read-only
https://git.sr.ht/~mgmarlow/deno-ts-mode
read/write
git@git.sr.ht:~mgmarlow/deno-ts-mode

You can also use your local clone with git send-email.

#deno-ts-mode

MELPA

A major mode for Deno, based on typescript-ts-mode.

#Features

  • Syntax highlighting (based on typescript-ts-mode)
  • Task automation
  • Eglot configuration
  • auto-mode-alist resolution for ".ts" and ".tsx" files

#Installation

Requires Emacs 29+ with tree-sitter installed.

Available on MELPA:

(use-package deno-ts-mode
  :ensure t)

#Installing tree-sitter parsers

deno-ts-mode depends on tree-sitter. You will probably want both the typescript and tsx parsers installed:

(setq treesit-language-source-alist
      '((typescript "https://github.com/tree-sitter/tree-sitter-typescript" "master" "typescript/src")
        (tsx "https://github.com/tree-sitter/tree-sitter-typescript" "master" "tsx/src")))

(mapc #'treesit-install-language-grammar (mapcar #'car treesit-language-source-alist))

#Project detection

deno-ts-mode will automatically configure auto-mode-alist to check for Deno projects when resolving the ".ts" and ".tsx" file extensions. Whether or not a project is considered a Deno project is based on the existence of a Deno configuration file at the project root. Both deno.json and deno.jsonc are considered valid configuration files.

If a ".ts" or ".tsx" file is not in a project with a Deno configuration file, deno-ts-mode-maybe will fallback to either typescript-ts-mode or tsx-ts-mode depending on the extension.

#Task automation

If your project's deno configuration file contains tasks you can run them directly from Emacs.

M-x deno-ts-run-task

#Eglot setup example

(use-package deno-ts-mode
  :ensure t)

(use-package eglot
  :ensure t
  :hook ((deno-ts-mode . eglot-ensure)
         (deno-tsx-ts-mode . eglot-ensure)))

#Contributing

Please direct bug reports or patches to the mailing list.

#License

Licensed under GPL-3.0.