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

Generate language meta data #170

Merged
merged 3 commits into from
Jul 12, 2021
Merged

Generate language meta data #170

merged 3 commits into from
Jul 12, 2021

Conversation

msujew
Copy link
Member

@msujew msujew commented Jul 10, 2021

Closes #168

Adds a dedicated LanguageMetaData service to each language.

export interface LanguageMetaData {
    languageId: string;
    extensions: string[];
}

@dhuebner
Copy link
Contributor

Great! Exactly what I need. We need to decide about having a leading . or not.
I tend to prefer the no-dot solution

@pluralia
Copy link
Contributor

Leading . are redundant, however, it's nice to have it to support the association: "if a string starts with ., it's an extension". It highlights extensions over all other metadata.

@msujew
Copy link
Member Author

msujew commented Jul 12, 2021

I prefer the . variation as well, since path.extname will return the ext with a .. So we don't have to do transformations on that.

@msujew msujew merged commit b604b4e into main Jul 12, 2021
@msujew msujew deleted the msujew/language-meta-data branch July 12, 2021 12:10
* DO NOT EDIT MANUALLY!
******************************************************************************/

export class ArithmeticsLanguageMetaData {
Copy link
Contributor

Choose a reason for hiding this comment

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

In this case I'd rather use a plain object than a class.

Copy link
Member Author

Choose a reason for hiding this comment

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

I see, that makes sense. Should the object this be generated into a meta-data.ts file, or should it be build in the generated injection module? like this:

LanguageMetaData: () => ({
    languageId: 'id',
    extensions: ['.id']
})

Copy link
Contributor

Choose a reason for hiding this comment

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

Exporting a const for it could be useful so you can access it directly in your language implementation. But it could be in the generated/module.ts instead of a new file to keep the number of generated files low.

Copy link
Member Author

Choose a reason for hiding this comment

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

Alright, yeah I agree with that.


export interface LanguageMetaData {
languageId: string;
extensions: string[];
Copy link
Contributor

Choose a reason for hiding this comment

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

Shall we name this property fileExtensions for clarity? "extensions" is quite generic.

@spoenemann spoenemann added this to the v0.2.0 milestone Sep 15, 2021
@msujew msujew added the cli CLI related issue label Nov 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli CLI related issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide Language id and file extension information
4 participants