Skip to content
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

Add astro support #360

Merged

Conversation

EliasLeguizamon123
Copy link
Contributor

@EliasLeguizamon123 EliasLeguizamon123 commented May 2, 2024

This PR add astro support: https://astro.build
Mentioned in #34

  • If this language conflicts with another language (same extension), I've added heuristics
  • If this language conflicts with another language, I've linked to the pull request that added the other language here:

@spenserblack
Copy link
Owner

Fantastic! Would you also be able to add a sample to the samples-test/samples/ folder?

@spenserblack
Copy link
Owner

@all-contributors add @EliasLeguizamon123 for data

Copy link
Contributor

@spenserblack

I've put up a pull request to add @EliasLeguizamon123! 🎉

Copy link

codecov bot commented May 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.73%. Comparing base (19e7e64) to head (bac5645).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #360      +/-   ##
==========================================
- Coverage   78.29%   75.73%   -2.56%     
==========================================
  Files          17       17              
  Lines         516      474      -42     
==========================================
- Hits          404      359      -45     
- Misses        112      115       +3     
Flag Coverage Δ
--no-default-features 74.61% <ø> (-2.83%) ⬇️
--no-default-features --features color 75.31% <ø> (-2.60%) ⬇️
macOS-latest ?
ubuntu-latest 75.73% <ø> (ø)
windows-latest ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@spenserblack spenserblack merged commit b143c9f into spenserblack:main May 8, 2024
10 of 11 checks passed
@spenserblack spenserblack added the new-language Requests to add a new language label May 8, 2024
@EliasLeguizamon123
Copy link
Contributor Author

Fantastic! Would you also be able to add a sample to the samples-test/samples/ folder?

Hi @spenserblack, I've been looking through the samples folder and the documentation, but I'm unsure about what kind of sample I could add.

@EliasLeguizamon123 EliasLeguizamon123 deleted the feat-astroSupport branch May 8, 2024 12:05
@spenserblack
Copy link
Owner

The sample can be anything, it just has to be a good representation of the language. For example, if I was making a Python sample:

Not a good sample

print("Hello, World!")

A better sample

from uuid import uuid4
from unittest import TestCase

class Item:
    def __init__(self):
        self.id = uuid4()

class Charcoal(Item):
    pass

class Stick(Item):
    def __add__(self, other):
        return Torch(self, other)

class Torch(Item):
    def __init__(self, stick: Stick, charcoal: Charcoal):
        super().__init__()
        self.stick = stick
        self.charcoal = charcoal

    def components(self):
        return [self.stick, self.charcoal]

class TestMinecraft(TestCase):
    def test_torch(self):
        stick = Stick()
        charcoal = Charcoal()
        torch = stick + charcoal
        components = torch.components()

        self.assertIn(charcoal, components)
        self.assertIn(stick, components)

The second example is better because it showcases language features, like imports, classes, and methods. Right now the samples serve one purpose: to run tests to prove that gengo identifies the correct language for "real world" files.

But in the future the samples may be used to train a classifier, which is why the samples should be more than a "hello world" and contain significant syntax.

Hope this helps! Also, feel free to make a PR to update the docs if they weren't clear enough 🙂

@EliasLeguizamon123
Copy link
Contributor Author

The sample can be anything, it just has to be a good representation of the language. For example, if I was making a Python sample:

Not a good sample

print("Hello, World!")

A better sample

from uuid import uuid4
from unittest import TestCase

class Item:
    def __init__(self):
        self.id = uuid4()

class Charcoal(Item):
    pass

class Stick(Item):
    def __add__(self, other):
        return Torch(self, other)

class Torch(Item):
    def __init__(self, stick: Stick, charcoal: Charcoal):
        super().__init__()
        self.stick = stick
        self.charcoal = charcoal

    def components(self):
        return [self.stick, self.charcoal]

class TestMinecraft(TestCase):
    def test_torch(self):
        stick = Stick()
        charcoal = Charcoal()
        torch = stick + charcoal
        components = torch.components()

        self.assertIn(charcoal, components)
        self.assertIn(stick, components)

The second example is better because it showcases language features, like imports, classes, and methods. Right now the samples serve one purpose: to run tests to prove that gengo identifies the correct language for "real world" files.

But in the future the samples may be used to train a classifier, which is why the samples should be more than a "hello world" and contain significant syntax.

Hope this helps! Also, feel free to make a PR to update the docs if they weren't clear enough 🙂

Sure mate, count on me. Give me a couple of days to finish some personal projects, and I'll add an example for Astro in a new PR 😄 @spenserblack

@spenserblack
Copy link
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-language Requests to add a new language
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants