gitlab

How to change tabulation size on code review?


While reviewing the code with gitlab merge request web page, tabulation is 8 spaces.

It makes the code difficult to read. How could I move it to 1 or 2 spaces ?


Solution

  • It seems to be impossible to achieve that by available GitLab settings, but this can be hacked using Greasemonkey/Tampermonkey browser extension:

        // ==UserScript==
        // @name     Custom tab-width
        // @version  1
        // @grant    none
        // @include  https://your.gitlab.server.com/*/diffs*
        // ==/UserScript==
    
        var style = document.createElement("style");
        style.type = "text/css";
        style.innerHTML = "span.line {tab-size:2; -moz-tab-size:2;}";
        document.head.appendChild(style);
    

    or by any other stylish-like extensions which allow you to attach any custom css rules to web pages:

    span.line {tab-size:2; -moz-tab-size:2;}