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

feat: press tab inserts language specific num of spaces or default #277

Merged
merged 1 commit into from
Jul 8, 2024

Conversation

divSelector
Copy link

@divSelector divSelector commented Jun 30, 2024

This is addressing the issue posted here

#195

I noticed that there was already this object that wasn't being used

let indents = {
    "default": " ".repeat(4),
    "python": " ".repeat(4),
    "python2": " ".repeat(4),
    "html": " ".repeat(2),
    "css": " ".repeat(2),
    "javascript": " ".repeat(2),
};

So I assumed that someone intended to eventually use it and I just decided to plug it in.

The number of indents is determined like this let indent = indents[lexer.toLowerCase()] || indents["default"];

The logic that checks for Python is taken out since it's already handled above.

I thought about writing a function const f = n => " ".repeat(n) so that the indents object could just contain integers, but I didn't really want to make design decisions for you.

The numbers that are put into the languages are obviously opinionated. You could change the defaults to whatever you preferred.

@supakeen
Copy link
Owner

supakeen commented Jul 8, 2024

Looks good to me, we'll see if anyone gets confused by this :)

@supakeen supakeen merged commit 6e786ae into supakeen:master Jul 8, 2024
9 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants