Skip to content

Add 'gel' extension and alias to EdgeQL #7401

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

1st1
Copy link

@1st1 1st1 commented May 22, 2025

Description

EdgeDB got recently renamed to Gel [1]. The schema language extension changed from .esdl to .gel. This PR adds .gel as a recognized file extension and gel as a recognized code-block language selector.

[1] https://www.geldata.com/blog/edgedb-is-now-gel-and-postgres-is-the-future

Checklist:

  • I am adding a new extension to a language.
    • The new extension is used in hundreds of repositories on GitHub.com
    • I have included a real-world usage sample for all extensions added in this PR:
      • Sample source(s):
        • Self-written
      • Sample license(s):
        • MIT
    • I have included a change to the heuristics to distinguish my language from others using the same extension.

@1st1 1st1 requested a review from a team as a code owner May 22, 2025 17:48
Copy link
Member

@lildude lildude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow the instructions in CONTRIBUTING.md for adding a new extension. Please also use and correctly complete the PR template… it's there for a reason.

@1st1
Copy link
Author

1st1 commented May 23, 2025

@lildude, sincere apologies for not following the process. As an open source maintainer myself I should have had better judgement.

We've updated the commit / PR message, please take another look.

@1st1 1st1 changed the title Add 'gel' alias for 'esdl' (existing grammar update!) Add 'gel' alias for 'esdl' (existing grammar update) May 28, 2025
Copy link
Member

@lildude lildude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend replacing your one-liner samples with more representative examples as they're used to train the classifier and very small samples are known to cause incorrect results.

Comment on lines +320 to +341
- extensions: ['.gel']
rules:
- language: EdgeQL
pattern:
# We definitely want the match unicode characters as part of the \w
- '(?i:^\s*using\s+(extension|future)[^\n]*?;)'
- '(?iu:^\s*module\s+(\w+|`.+?`)\s*\{)'
- '(?iu:^\s*abstract\s+(inheritable\s+)?annotation\s+(\w+|`.+?`)::(\w+|`.+?`))'
- '(?iu:^\s*abstract\s+(constraint|index|link|property)\s+(\w+|`.+?`)::(\w+|`.+?`))'
- '(?iu:^\s*(alias|function)\s+(\w+|`.+?`)::(\w+|`.+?`))'
- '(?iu:^\s*(optional|required|single|multi)?\s*global\s+(\w+|`.+?`)::(\w+|`.+?`))'
- '(?iu:^\s*(abstract\s+)?(scalar\s+)?type\s+(\w+|`.+?`)::(\w+|`.+?`))'
negative_pattern:
# Check for common comments that are invalid in EdgeQL.
#
# The caveat is that they technically would be legal inside string
# literals, but it is extremely unlikely to have such string literals in
# the Gel schema (i.e. appearing as defaults or annotations). However, to
# reduce the possibility of false positives here we also restrict illegal
# comment detection to the beginning of a line.
- '^\/\/.+$'
- '^\/\*.*?\*\/'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unnecessary as this is the only language associated with the .gel extension so we'll never get to the heuristics.

Suggested change
- extensions: ['.gel']
rules:
- language: EdgeQL
pattern:
# We definitely want the match unicode characters as part of the \w
- '(?i:^\s*using\s+(extension|future)[^\n]*?;)'
- '(?iu:^\s*module\s+(\w+|`.+?`)\s*\{)'
- '(?iu:^\s*abstract\s+(inheritable\s+)?annotation\s+(\w+|`.+?`)::(\w+|`.+?`))'
- '(?iu:^\s*abstract\s+(constraint|index|link|property)\s+(\w+|`.+?`)::(\w+|`.+?`))'
- '(?iu:^\s*(alias|function)\s+(\w+|`.+?`)::(\w+|`.+?`))'
- '(?iu:^\s*(optional|required|single|multi)?\s*global\s+(\w+|`.+?`)::(\w+|`.+?`))'
- '(?iu:^\s*(abstract\s+)?(scalar\s+)?type\s+(\w+|`.+?`)::(\w+|`.+?`))'
negative_pattern:
# Check for common comments that are invalid in EdgeQL.
#
# The caveat is that they technically would be legal inside string
# literals, but it is extremely unlikely to have such string literals in
# the Gel schema (i.e. appearing as defaults or annotations). However, to
# reduce the possibility of false positives here we also restrict illegal
# comment detection to the beginning of a line.
- '^\/\/.+$'
- '^\/\*.*?\*\/'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've included the heuristics largely because we've found a lot of .gel files that have nothing to do with our database schema (https://github.com/search?type=code&q=NOT+is%3Afork+path%3A*.gel has ~1.8K code hits). So we didn't think it would be appropriate to target all .gel files indiscriminately.

If you're saying that regardless of that intent, this is not how the heuristics work and would not help there, we can remove them, of course.

@lildude lildude changed the title Add 'gel' alias for 'esdl' (existing grammar update) Add 'gel' extension and alias to EdgeQL Jun 16, 2025
EdgeDB got recently renamed to Gel [1]. The schema language extension
changed from `.esdl` to `.gel`. This PR adds `.gel` as a recognized
file extension and `gel` as a recognized code-block language selector.

[1] https://www.geldata.com/blog/edgedb-is-now-gel-and-postgres-is-the-future
@vpetrovykh
Copy link

I've added a more representative example. It's still synthetic, but it's based much more closely on actual real schema files.

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

Successfully merging this pull request may close these issues.

3 participants