Code Monkey home page Code Monkey logo

Comments (5)

kbrose avatar kbrose commented on June 19, 2024 3

I'm closing this issue -- I have no intention of supporting indentation with tabs.

from vsc-python-indent.

kbrose avatar kbrose commented on June 19, 2024

How would you want this to work when the indentation for the next line is not an even multiple of your indent size? Example:

like_this = [0, 1, 2,
             3, 4, 5]

The second line is indented 13 spaces.

from vsc-python-indent.

PunnyBoi avatar PunnyBoi commented on June 19, 2024

Right, I now see the problem. When I requested this feature, I only had the conditional-statements indentation in mind.

Looking at your example, suddenly a thought came to my mind that how Matlab do this? So I checked in the Matlab and I observe that regardless of the indentation of the first line (in our example like_this = [0, 1, 2), the indentation from the second line onward (in our example 3, 4, 5]) is always the same and equals to four space (or a tab equal in length to four spaces). I agree that it doesn't look as beautiful as what it is now, but this can be a workaround. (Also, I want to emphasize that I have never used something similar to your example till now. Given the fact that indentation is important in Python, there is a chance what I suggested as a workaround will throw an indentation error. So please correct me if I am wrong.)

from vsc-python-indent.

kbrose avatar kbrose commented on June 19, 2024
like_this = [0, 1, 2,
    3, 4, 5]

is perfectly valid Python, so there's no concern there. I wouldn't be opposed to adding an option for tab-based indentation to this to the extension, using the above style of indentation to continue bracket-style expressions.

However, I want to be clear that I probably will not spend time implementing this option myself. The PEP8 style guide recommends using spaces, and I get the impression that most people who write python nowadays are not using tabs. Not to say that you don't have a valid reason to use tabs, but I never use tabs and don't want to spend too much time on it.

from vsc-python-indent.

jkyeung avatar jkyeung commented on June 19, 2024

How would you want this to work when the indentation for the next line is not an even multiple of your indent size?

I don't use tabs myself, but if I did, I think there are at least three reasonable options:

  1. Don't try to align with anything, just increase indent by one level.

  2. Calculate alignment as though using all spaces, but then replace as many leading spaces as possible using tabs, according to the user's "spaces per indent" setting, and leave the remainder as spaces.

  3. Calculate alignment as though using all spaces, but then replace the current level of semantic indentation with tabs (i.e. same number of tabs as the initial line), and leave the remainder as spaces.

I don't have a strong opinion about which of those is best. I agree it is completely reasonable to leave this as "pull requests welcome".

from vsc-python-indent.

Related Issues (20)

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.