-
Notifications
You must be signed in to change notification settings - Fork 87
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
feat: 570 kotlin support #573
base: main
Are you sure you want to change the base?
feat: 570 kotlin support #573
Conversation
ALL_LANGUAGES = re.compile( | ||
r"""\/{51} | ||
\/\/ Constants | ||
\/{51} | ||
const allLanguages = (?P<all_languages>\[ | ||
(\s*"[\w\-]+",\n?)+ | ||
(?P<last_language>\s*"[\w\-]+",) | ||
\])""", | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use GritQL for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I don't really know GritQL well enough, yet. Whereas regex, I know all too well 🤣
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thankfully this one is very simple:
`const allLanguages = [$langs]` where { $langs += `"foo"`}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice. Thanks. Might be worthwhile for me to spend a bit of time learning GritQL after this PR then!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm just going to add "At least 10 test cases, including rewrites and metavariables." as you mentioned on the issue description. From your perspective, once I do that (assuming they all pass or are fixed as needed) would this PR be ready to merge? Or have I missed something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd opt to remove this file, since it will potentially require maintenance and doesn't really make things much faster/easier as-is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Alex-ley-scrub Can you remove this file? It's better to not point people in the wrong direction with a script for something that will probably become outdated quickly.
Please also add at least one binary/CLI test in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
61 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
… add `simple_kotlin()` test fixes getgrit#570
…ariable-grammar.js' fixes getgrit#570
…ch of places to enable metavariable substitution fixes getgrit#570
…ources/language-metavariables/tree-sitter-kotlin/" fixes getgrit#570
…s/edit_grammars.mjs' script fixes getgrit#570
…PatternLanguage::Kotlin` fixes getgrit#570
…uct and add it to all match statements fixes getgrit#570
…es/lsp and crates/wasm-bindings fixes getgrit#570
…n tests as examples of GritQL syntax see https://docs.grit.io/language/syntax
…e some parsing it not happening correctly
…ython-metavariable-grammar with fewer $.grit_metavariable but at 'higher' level fixes getgrit#570
9855620
to
3b99c9c
Compare
a95e62e
to
5da1d43
Compare
@morgante I finally got the time to debug this properly and figure out why the patterns weren't matching and make progress! But there are a bunch of clippy errors for code I didn't write: https://github.com/getgrit/gritql/actions/runs/12643182239/job/35228763160?pr=573 Do you want me to fix them? Are they new errors with a new compiler version or something? How else are they only just showing up now in my PR? I had done a |
Thanks @Alex-ley-scrub for following up here - excited to see this land.
Since they don't show up on main it would be good if you fix them.
Don't worry about that, I always just squash changes once we merge. |
ALL_LANGUAGES = re.compile( | ||
r"""\/{51} | ||
\/\/ Constants | ||
\/{51} | ||
const allLanguages = (?P<all_languages>\[ | ||
(\s*"[\w\-]+",\n?)+ | ||
(?P<last_language>\s*"[\w\-]+",) | ||
\])""", | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Alex-ley-scrub Can you remove this file? It's better to not point people in the wrong direction with a script for something that will probably become outdated quickly.
Actually feel free to ignore the clippy errors, I think they're related to an untracked upstream change. |
/claim #570
fixes #570
todo:
resources/add_language.py
and run it withpython resources/add_language.py --lang kotlin
edit_grammars.mjs
node ./resources/edit_grammars.mjs kotlin
crates/core/languages/src/kotlin.rs
cargo test --package marzano-language --lib -- kotlin::tests --show-output
PatternsDirectory
struct in crates/gritmodule/src/patterns_directory.rs add it to all match statementscargo test --package marzano-core --lib -- test::simple_kotlin --exact --show-output
Greptile Summary
This is an auto-generated summary
Hi! Looks like you've reached your API usage limit. You can increase it from your account settings page here: app.greptile.com/settings/usage