This repository was archived by the owner on Apr 1, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -191,9 +191,13 @@ someASTParser :: Language -> Maybe SomeASTParser
191191someASTParser Go = Just (SomeASTParser (ASTParser tree_sitter_go :: Parser (AST [] Go. Grammar )))
192192someASTParser Haskell = Just (SomeASTParser (ASTParser tree_sitter_haskell :: Parser (AST [] Haskell. Grammar )))
193193someASTParser Java = Just (SomeASTParser (ASTParser tree_sitter_java :: Parser (AST [] Java. Grammar )))
194- someASTParser JavaScript = Just (SomeASTParser (ASTParser tree_sitter_tsx :: Parser (AST [] TSX. Grammar )))
195194someASTParser JSON = Just (SomeASTParser (ASTParser tree_sitter_json :: Parser (AST [] JSON. Grammar )))
195+
196+ -- Use the TSX parser for `.js` and `.jsx` files in case they use Flow type-annotation syntax.
197+ -- The TSX and Flow syntaxes are the same, whereas the normal TypeScript syntax is different.
198+ someASTParser JavaScript = Just (SomeASTParser (ASTParser tree_sitter_tsx :: Parser (AST [] TSX. Grammar )))
196199someASTParser JSX = Just (SomeASTParser (ASTParser tree_sitter_tsx :: Parser (AST [] TSX. Grammar )))
200+
197201someASTParser Python = Just (SomeASTParser (ASTParser tree_sitter_python :: Parser (AST [] Python. Grammar )))
198202someASTParser Ruby = Just (SomeASTParser (ASTParser tree_sitter_ruby :: Parser (AST [] Ruby. Grammar )))
199203someASTParser TypeScript = Just (SomeASTParser (ASTParser tree_sitter_typescript :: Parser (AST [] TypeScript. Grammar )))
You can’t perform that action at this time.
0 commit comments