monaco-editor icon indicating copy to clipboard operation
monaco-editor copied to clipboard

feature-request: getValue without comments

Open Lor-Saba opened this issue 7 years ago • 4 comments

Could you add a parameter to the .getValue(); which returns back the editor content without comments? something like editor.getValue({ trimComments: true });

For example, if I have this content:

/*
    old sum function
    function sum(_a, _b){
        return _a + _b;
    }
*/

var a, b;

// add function
function add(_a, _b){
    return _b + _a;
}

the editor.getValue({ trimComments: true }); should return back:


var a, b;

function add(_a, _b){
    return _b + _a;
}

Same for the other languages (css, html, ...)

My use case: I need to know if the editor contains actual code, not just content.

Lor-Saba avatar Jul 04 '17 10:07 Lor-Saba

+1

yize avatar Jan 10 '18 10:01 yize

+1

codeStryke avatar Jun 25 '20 09:06 codeStryke

+1

vicke4 avatar Feb 21 '21 18:02 vicke4

++1

jasmine-song avatar Jun 15 '22 08:06 jasmine-song

+1

samirzubi-db avatar Feb 22 '23 19:02 samirzubi-db

We closed this issue because we don't plan to address it in the foreseeable future. If you disagree and feel that this issue is crucial: we are happy to listen and to reconsider.

If you wonder what we are up to, please see our roadmap and issue reporting guidelines.

Thanks for your understanding, and happy coding!

hediet avatar Feb 24 '23 10:02 hediet