From d34ddf36e938d2ccac61f81da95fb42c96000d67 Mon Sep 17 00:00:00 2001 From: Benjamin Streit Date: Fri, 16 Sep 2022 02:51:19 -0500 Subject: [PATCH] fix: Improving JSX and TSX indents (#3853) --- languages.toml | 4 ++-- runtime/queries/jsx/indents.scm | 8 ++++++++ runtime/queries/tsx/indents.scm | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/languages.toml b/languages.toml index 5e563178a189..0b46cc492f3f 100644 --- a/languages.toml +++ b/languages.toml @@ -332,7 +332,7 @@ source = { git = "https://github.com/omertuc/tree-sitter-go-work", rev = "6dd9dd name = "javascript" scope = "source.js" injection-regex = "(js|javascript)" -file-types = ["js", "jsx", "mjs", "cjs"] +file-types = ["js", "mjs", "cjs"] shebangs = ["node"] roots = [] comment-token = "//" @@ -363,7 +363,7 @@ injection-regex = "jsx" file-types = ["jsx"] roots = [] comment-token = "//" -language-server = { command = "typescript-language-server", args = ["--stdio"], language-id = "javascript" } +language-server = { command = "typescript-language-server", args = ["--stdio"], language-id = "javascriptreact" } indent = { tab-width = 2, unit = " " } grammar = "javascript" diff --git a/runtime/queries/jsx/indents.scm b/runtime/queries/jsx/indents.scm index 04328f099e98..6cb82545efd4 100644 --- a/runtime/queries/jsx/indents.scm +++ b/runtime/queries/jsx/indents.scm @@ -1 +1,9 @@ +[ + (jsx_fragment) + (jsx_element) + (jsx_self_closing_element) +] @indent + +(parenthesized_expression) @indent + ; inherits: ecma diff --git a/runtime/queries/tsx/indents.scm b/runtime/queries/tsx/indents.scm index 1b61e36da3ca..07391231c635 100644 --- a/runtime/queries/tsx/indents.scm +++ b/runtime/queries/tsx/indents.scm @@ -1 +1 @@ -; inherits: typescript +; inherits: typescript,jsx