Skip to content
This repository was archived by the owner on Jul 11, 2025. It is now read-only.
This repository was archived by the owner on Jul 11, 2025. It is now read-only.

Does not work in another languages than english #4

Closed as not planned
Closed as not planned

Description

@gbprod

Hi!
I'm trying to make this parser works in Neovim but I'm having an issue because I'm using git in french :/
Your parser seems to look for english text and does not works and does not works...

I think it's not a good idea to include all possible translations into this parser but maybe there is another way to do that ?

Eg:

Introduce git-commit parser

This commit...

# Veuillez saisir le message de validation pour vos modifications. Les lignes
# commençant par '#' seront ignorées, et un message vide abandonne la validation.
#
# Sur la branche main
# Votre branche est à jour avec 'origin/main'.
#
# Modifications qui seront validées :
#	modifié :         lua/usr/treesitter.lua
#
# ------------------------ >8 ------------------------
# Ne touchez pas à la ligne ci-dessus.
# Tout ce qui suit sera éliminé.
diff --git a/lua/usr/treesitter.lua b/lua/usr/treesitter.lua
index 2962f73..04abaab 100644
--- a/lua/usr/treesitter.lua
+++ b/lua/usr/treesitter.lua
@@ -9,6 +9,16 @@ function treesitter.plugins(use)
   use("nvim-treesitter/playground")
   use("JoosepAlviste/nvim-ts-context-commentstring")
   use("windwp/nvim-ts-autotag")
+  local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
+  parser_config.git_commit = {
+    install_info = {
+      url = "https://github.com/the-mikedavis/tree-sitter-git-commit",
+      files = { "src/parser.c" },
+      branch = "main",
+    },
+    filetype = "gitcommit",
+  }
 end
 
 function treesitter.setup()
@@ -33,6 +43,7 @@ function treesitter.setup()
       "markdown",
       "diff",
       "bash",
+      "gitcommit",
     },
     textobjects = {
       select = {

I'll try something but I'd like to have your advice on what you think it should be done ?
Thanks

Activity

  1. the-mikedavis commented on Oct 19, 2022

    @the-mikedavis
    Owner

    Oh hmm, this may be tough to handle nicely. I think the cleanest way to support it would be to have per-language forks that replace the hard-coded English words with the appropriate translation. That way the queries could be re-used between each language fork and the grammar wouldn't need to become larger and more complex.

  2. gbprod commented on Oct 20, 2022

    @gbprod
    Author

    Thanks for your feedback, maybe I'll work on a parser more "generic".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions