Giter Club home page Giter Club logo

vscode-backspace's Introduction

Deprecation Notice

Sad but true - this extension is not required anymore because VS Code alone supports smart backspace'ing.

Backspace++

Erase spaces by multiples of the tab size. When indenting with spaces you often have to hit backspace multiple times to unindent. This extension makes backspace always remove so many spaces that a multiple of the tab size is left, eg from 8 spaces to 4 (when tabSize=4).

vscode-backspace's People

Contributors

chrisdias avatar jrieken avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-backspace's Issues

Suggestion: Handle the case where the caret is placed arbitrarily within a logical soft-tab

Backspace++: v.0.0.12
VS Code: v.0.10.11
Try this with a tab width of n = 4

  1. Create a line with 2 x n = 8 spaces - a perfect multiple of the tab width.
  2. Place the caret after (2 x n) - 1 = 7 of the spaces - leaving one space to the right
  3. Press backspace.

I absolutely love the fact that it removes only n - 1 = 3 characters to the left of the caret, leaving one whole tab. I think it might be awesome if it also removed the space to the right of the caret since it logically belonged to the soft-tab that was removed.

Backspace++ is a life-saver. Thanks for making it!

Relevance according to modern versions of VS Code

Hi, Johannes!

Thank you for this extension. There are a lot of positive reviews on Microsoft Marketpalce about it. However, I don't really sure is it still necessary for modern versions of VS Code. Here are my settings:

(I started to use VS Code only 2 weeks ago).

{
    "editor.autoIndent": true,
    "editor.detectIndentation": true,
    "editor.insertSpaces": true,
    "editor.renderWhitespace": "boundary"
}

When I launch VS Code without any extensions, it works (from my point of view) exactly as shown on animated GIF of Backspace++.

So, in other words, it seems the extension doesn't do anything (from my point of view, but I don't sure).

Probably I missed something? Cheers, John.

erase spaces when tabsize=auto

When tabsize="auto", if i enter two tab, editor will insert eight space. Then, i just want to delete four spaces by hitting backspace once, but it will delete eight spaces by effect of this extension.

Suggested functionality

Hi,

I love your extension. I tried using it but the fact that I couldn't delete soft tabs between two sections of non-whitespace frustrated me so I modified your extension. My method is less elegant than yours but it actually runs quite fast (.032ms)

It allows you to delete soft tabs after non-whitespace

Example:

this.code.run();                        //I don't want to press backspace 16 times to reformat
if (typeof tabSize === 'number') {

        let hasNewSelections = false;
        const newSelections = selections.map(selection => {
            if (!selection.isEmpty) {
                return selection;
            }

            const { start } = selection; // since it's empty start is the same as 'active'
            if (start.character === 0) {
                return selection;
            }

            const line = document.lineAt(start).text;
            let pos = start.character;
            let removeNum = 0;
            for (let i = 0; i < tabSize; i++) {
                pos--;
                //Check for invalid
                if (pos < 0) {
                    break;
                }
                //Check for whitespace
                if (line[pos] == " ") {
                    removeNum++;
                    //If at tab-stop
                    if (pos % tabSize == 0)
                        break;
                //If not whitespace
                } else {
                    break;
                }
            }

            if (removeNum > 0) {
                hasNewSelections = true;
                return new vscode.Selection(start.with(void 0, start.character - removeNum), start);
            }

            return selection;
        });

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.