Microsoft/monaco-editor

JavaScript folding ranges are not semantic

Open

#1,847 opened on Feb 24, 2020

View on GitHub
 (1 comment) (0 reactions) (0 assignees)JavaScript (14,836 stars) (1,283 forks)batch import
feature-requesthelp wantedopen for PRtypescript

Description

monaco-editor version: 0.20.0 Browser: Chrome OS: Windows Playground code that reproduces the issue:: https://microsoft.github.io/monaco-editor/playground.html#creating-the-editor-hello-world

Playground code

monaco.editor.create(document.getElementById("container"), {
	value: "function double(x) {\nreturn 2*x\n}\n\nfunction double2(x) {\n\treturn 2*x;\n}",
	language: "javascript",
    showFoldingControls: "always",	
});

image

I realized that the folding icon is hidden when all the lines of a Javascript function have no indentation. Using the same code but with tabs/spaces, the folding icon is shown.

In Visual Studio Code for Web Playground, I am also able to repro this issue.

Contributor guide