Giter Site home page Giter Site logo

Comments (2)

roughike avatar roughike commented on May 30, 2024

The problem here is the variable t you have.

Your input looks like this:

String test() {
    return '''
      _FutureBuilderError{
        error: Instance of 'WhatIfGodSmokedCannabisError', 
        stackTrace: 
          123123
123123
      }
    '''.unindent();
}

so the result you get works as expected.

If you control the t variable, try something like this:

    String t = '123123\n123123'.indent(10).trim();

before passing it into your input string. The value is not necessarily 10, so you might have to play around with it a little.

from indent.

0ttik avatar 0ttik commented on May 30, 2024

Yes, you are right. But your soultion actually doesn't work since code indentation can change from time to time but it generally should not make me change code itself. Your solution assumes that I have to change code everytime I change formatting which is not good.

I assumed that it may be in the scope of this package to correctly determine and put right amount of indentation. I think that it would require some kind of placeholders like:

'''
      _FutureBuilderError{
        error: Instance of 'WhatIfGodSmokedCannabisError', 
        stackTrace: 
          ?
      }
    '''.unindent([t]); // Replaces first ? in string prefixing it with right amount of spaces

from indent.

Related Issues (2)

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.