Skip to content

[bug] Custom Language not recognizedΒ #2155

@sebthom

Description

@sebthom

Please read the FAQ for the bug you encountered.

  • I have read the existing FAQ

⏯ Playground Link

not applicable

πŸ’» Code

I am on Windows trying to register the custom dart language from https://www.npmjs.com/package/@ast-grep/lang-dart and use it with the cli tool.

> md D:\ast-grep
> cd D:\ast-grep
> npm install --silent @ast-grep/lang-dart
> dir "node_modules\@ast-grep\lang-dart\prebuilds\prebuild-Windows-X64\
 Volume in drive D is Windows
 Volume Serial Number is 0DC3-13DD

 Directory of D:\ast-grep\node_modules\@ast-grep\lang-dart\prebuilds\prebuild-Windows-X64\parser.so

07.08.2025  16:17           766.976 parser.so
               1 File(s)        766.976 bytes
               0 Dir(s)  183.259.955.200 bytes free

D:\ast-grep\sgconfig.yaml:

ruleDirs: []
customLanguages:
  dart:
    libraryPath: "D:\\ast-grep\\node_modules\\@ast-grep\\lang-dart\\prebuilds\\prebuild-Windows-X64\\parser.so"
    extensions: [dart]
> set AST_GREP_CONFIG=D:\ast-grep-dart\sgconfig.yml
> echo class Foo { } | sg.exe run -l dart -p "class $NAME { }" -
error: invalid value 'dart' for '--lang <LANG>': dart is not supported!

For more information, try '--help'.

πŸ™ Actual behavior

sg.exe ignores the registered custom dart language and fails with error: invalid value 'dart' for '--lang <LANG>': dart is not supported!

πŸ™‚ Expected behavior

sg.exe picks up the config from sgconfig.yml and registers the configured dart customLanguage and allows me to use it.

Additional information about the issue

It would be extremely helpful if sg had a command display it's effective config or a verbose mode where one can see if any config files are loaded and applied.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requestedwontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions