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

Support more languages... #3

Open
cdecompilador opened this issue Nov 19, 2020 · 0 comments
Open

Support more languages... #3

cdecompilador opened this issue Nov 19, 2020 · 0 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed TODO-Priority-High

Comments

@cdecompilador
Copy link
Owner

To do this, two things in the code must be modified:

1. The Function that returns the language name given the extension

fn get_language_name<'a>(extension: &'a str) -> &'a str {
    match extension {
        "rs" => "Rust",
        "c" => "C",
        "cpp" | "cxx" | "c++" => "C++",
        "py" => "Python",
        "js" | "jsx" => "Javascript",
        "ts" => "Typescript",
        _ => {
            println!("Uknown file extension: {}", extension);
            "Uknown"
        },
         // TODO: Add more
    }
}

2. Edit the constant KNWON_EXTENSION_BINDINGS

const KNOWN_EXTENSIONS_BINDINGS: &[(&str, &[&str])] = &[
    ("rs", &["//", "/*", "*/"]),
    ("c", &["//", "/*", "*/"]),
    ("cpp", &["//", "/*", "*/"]),("c++", &["//", "/*", "*/"]),("cxx", &["//", "/*", "*/"]),
    ("py", &["#", "\"\"\"", "\"\"\""]),
    ("js", &["//", "/*", "*/"]),("jsx", &["//", "/*", "*/"]),
    ("ts", &["//", "/*", "*/"]),
    // TODO: Add more...
];

The upgrade of grouping this two things in just one is also allowed, and probably done in the future

@cdecompilador cdecompilador added good first issue Good for newcomers TODO-Priority-High help wanted Extra attention is needed labels Nov 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed TODO-Priority-High
Projects
None yet
Development

No branches or pull requests

1 participant