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

Custom Grit Pattern Not Recognized by VS Code Extension #3

@viveknair

Description

@viveknair

Custom Grit Pattern Not Recognized by VS Code Extension

Hey there, I'm running into an issue with Gentrace in VS Code. I was wondering if you could provide any help @morgante.

Describe the bug

A custom Grit pattern defined in a .grit file within the workspace's .grit directory is not being recognized or listed by the GritQL VS Code extension. Standard library patterns might be visible, but local patterns are not.

To Reproduce

Steps to reproduce the behavior:

  1. Create a directory named .grit at the root of the VS Code workspace.
  2. Create a pattern file inside .grit, for example, .grit/my_remove_comments.grit.
  3. Add content to the pattern file (see example below).
  4. Optionally, create a grit.yaml file at the workspace root (see example below).
  5. Restart VS Code.
  6. Attempt to run a Grit pattern using the extension (e.g., via the command palette).
  7. Observe that the custom pattern (my_remove_comments in this case) is not listed as an option.

Expected behavior

The custom pattern (my_remove_comments) defined in the .grit directory should be listed and executable via the GritQL VS Code extension interface.

Screenshots

Image

Environment:

  • OS: macOS (Darwin 24.3.0)

Workspace Setup:

  • .grit/my_remove_comments.grit:

    engine marzano(0.1)
    language js
    
    // Match any node identified as a comment by the parser
    comment() => .
    
  • grit.yaml:

    version: 0.0.1
    patterns:
      # Include patterns from the local .grit directory
      - directory: .grit

Troubleshooting Steps Taken:

  • Confirmed the .grit directory is located at the absolute root of the VS Code workspace (/Users/vivek/Code/gentrace-node-stainless).
  • Restarted VS Code multiple times after changes.
  • Created the grit.yaml file shown above to explicitly configure the pattern directory.
  • Tried renaming the pattern file (initially remove_comments.grit, then my_remove_comments.grit).
  • Initially encountered a VS Code error "Unable to find language for document...".
  • Confirmed the GritQL extension is installed and enabled.
  • Added/verified the following entry in VS Code's settings.json under files.associations:
    "*.grit": "grit"
  • Despite these steps, the local pattern is still not recognized by the extension.

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