From 656d2c5f8c5e0cbe6f3dff30d01d6cf857a298fa Mon Sep 17 00:00:00 2001 From: mgmarlow Date: Sun, 20 Aug 2023 21:39:53 -0700 Subject: [PATCH] Update README --- README.md | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3776478..2cd6f88 100644 --- a/README.md +++ b/README.md @@ -12,17 +12,33 @@ Requires Emacs 29+ with tree-sitter installed. ### Installing tree-sitter parsers -`deno-ts-mode` depends on tree-sitter. You need the following parsers: +`deno-ts-mode` depends on tree-sitter. You will probably want both the +`typescript` and `tsx` parsers installed: ```elisp (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)) ``` -Run `treesit-install-language-grammer` for both `typescript` and `tsx`. +### Project detection + +When `deno-setup-auto-mode-alist` is used, `deno-ts-mode` will detect +whether the currently visited TypeScript file (`.ts` or `.tsx`) is a +Deno project by looking at its project root for a `deno.json` file. If +successful, that TypeScript file is considered a Deno file for the +purposes of `deno-ts-mode`. Otherwise, `deno-setup-auto-mode-alist` +will fallback to `typescript-ts-mode`. + +This all means that the default Deno file detection is based on the +presence of a `deno.json` file in an [Emacs +Project](https://www.gnu.org/software/emacs/manual/html_node/emacs/Projects.html). Generally +speaking, projects are only detectable if they are under version +control. -## Eglot example +## Eglot usage example ```elisp (use-package deno-ts-mode -- 2.45.2