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

Simulate intelliJ behavior: do not delete line if whitespace is bigger than the smallest one #9

Open
pietrofxq opened this issue Mar 28, 2019 · 2 comments

Comments

@pietrofxq
Copy link

Hi, thanks for the extension! I was looking for it after getting used to this feature (which is built-in) in intellij. However, there's one thing missing for the extension to match intellij's feature.

Let's say I have this code:

const Component = () => (
    <div>
              <p>Hello!</p>
    </div>
)

The <p> tag has more whitespace than it should in the beggining of the line, but with this extension it's impossible to fix it, because pressing backspace will delete all the whitespace completely.

Intellij is smarter, and it can check that the line with least whitespace is the one holding <div>, so it will only delete the line on <p> if you press backspace until it has exactly the same amount of whitespace as <div>. Would it be possible to achieve the same behavior in vscode?

@Jasonlhy
Copy link
Owner

A robust solution is to get the language configuration of vscode and determine the indentation with IndentationRule. However, this approach is not possible at this moment because vscode doesn't have API to access the language configuration.

A workaround (hack) solution is to do duplicate the language configuration in this extension's configuration, and use that configuration to determine the indentation.

@MggMuggins
Copy link

I would also really like this.

The issue you linked needs 20 upvotes to get moved to the backlog. It has 19 now. Please upvote it if you haven't already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants