microsoft / microsoft/monaco-editor
[Bug] Folding button is not active enough
Open
@aeschli is already working on this.
Since Apr 5, 2023.
bug
folding
- Dominant language
- JavaScript
- Stars
- 46.8k
- Forks
- 4.1k
- Avg merge
- 17h 58m
- Merged PRs (30d)
- 1
Description
Reproducible in vscode.dev or in VS Code Desktop?
- Not reproducible in vscode.dev or VS Code Desktop
Reproducible in the monaco editor playground?
- Not reproducible in the monaco editor playground
Monaco Editor Playground Link
Monaco Editor Playground Code
const text = `2023-03-31 05:37:34,941 INFO TokenLibraryConfigurationManager$ [Thread-98]: Configuration from files was sufficient. Validation completed.
2023-03-31 05:37:34,941 INFO TokenLibrary [Thread-98]: InMemory Cache hit! Returning cached token for pbi. TimeTaken in ms: 0
2023-03-31 05:37:36,110 INFO TokenLibraryConfigurationManager$ [Thread-98]: Loading configuration from files
2023-03-31 05:37:36,111 INFO TokenLibraryConfigurationManager$ [Thread-98]: Configuration from files was sufficient. Validation completed.
2023-03-31 05:37:36,112 INFO TokenLibrary [Thread-98]: InMemory Cache hit! Returning cached token for storage. TimeTaken in ms: 1
2023-03-31 05:37:36,278 INFO notebookUtils [Thread-98]: [enable mlflow autolog]: cost 4.571210861206055s
2023-03-31 05:37:36,279 INFO notebookUtils [Thread-98]: [telemetry][info][funcName:prepare|cost:5152|language:python] done
2023-03-31 05:37:36,297 INFO notebookUtils [Thread-78]: Shutting down process
2023-03-31 05:37:37,382 INFO notebookUtils [Thread-78]: Process has been shut down
2023-03-31 05:37:37,382 INFO notebookUtils [Thread-78]: Close ipython repl with id 392eeb9e-5afa-497a-86d7-43afa188bc3d successfully.
2023-03-31 05:37:37,387 INFO notebookUtils [Thread-78]: [Start] Get a pbi aadToken via TokenLibrary
2023-03-31 05:37:37,387 INFO TokenLibraryConfigurationManager$ [Thread-78]: Loading configuration from files
2023-03-31 05:37:37,388 INFO TokenLibraryConfigurationManager$ [Thread-78]: Configuration from files was sufficient. Validation completed.
2023-03-31 05:37:37,389 INFO TokenLibrary [Thread-78]: InMemory Cache hit! Returning cached token for pbi. TimeTaken in ms: 1
2023-03-31 05:37:37,389 INFO notebookUtils [Thread-78]: [End] Done to get pbi aadToken via TokenLibrary, costs - 2ms
2023-03-31 05:37:37,426 INFO notebookUtils [Thread-78]: [NotebookSnapshotStore] request to save snapshot - runId: e780c9d8-d1e1-4bea-aba4-94ae48465b57 : notebookName: Notebook 5-1
2023-03-31 05:37:37,427 INFO notebookUtils [Thread-78]: start execute request saveSnapshot - /runNotebookApi/versions/1/productTypes/trident/capacities/7154B5FE-441F-4BB2-B727-78B59BC3BDF9/workspaces/3b7394c3-4e1b-4076-8444-3273f071c6ae/artifacts/24429d93-7353-4b5b-83af-4e0ac3a42851/nbreferencerun/e780c9d8-d1e1-4bea-aba4-94ae48465b57/snapshot attempt 1/3
2023-03-31 05:37:37,428 INFO notebookUtils [Thread-78]: [NotebookServiceClient] request url - https://tokenservice2.southcentralus.azuresynapse-dogfood.net/api/v1/proxy/runNotebookApi/versions/1/productTypes/trident/capacities/7154B5FE-441F-4BB2-B727-78B59BC3BDF9/workspaces/3b7394c3-4e1b-4076-8444-3273f071c6ae/artifacts/24429d93-7353-4b5b-83af-4e0ac3a42851/nbreferencerun/e780c9d8-d1e1-4bea-aba4-94ae48465b57/snapshot with correlation id 9c48d068-b731-4332-92c4-0d5db026d402
2023-03-31 05:37:37,429 INFO notebookUtils [Thread-78]: [Start] Get a pbi aadToken via TokenLibrary
2023-03-31 05:37:37,429 INFO TokenLibraryConfigurationManager$ [Thread-78]: Loading configuration from files
2023-03-31 05:37:37,430 INFO TokenLibraryConfigurationManager$ [Thread-78]: Configuration from files was sufficient. Validation completed.
2023-03-31 05:37:37,431 INFO TokenLibrary [Thread-78]: InMemory Cache hit! Returning cached token for pbi. TimeTaken in ms: 1
2023-03-31 05:37:37,431 INFO notebookUtils [Thread-78]: [End] Done to get pbi aadToken via TokenLibrary, costs - 2ms
2023-03-31 05:37:37,431 INFO notebookUtils [Thread-78]: [Start] Get a pbi aadToken via TokenLibrary
2023-03-31 05:37:37,432 INFO TokenLibraryConfigurationManager$ [Thread-78]: Loading configuration from files
2023-03-31 05:37:37,432 INFO TokenLibraryConfigurationManager$ [Thread-78]: Configuration from files was sufficient. Validation completed.
2023-03-31 05:37:37,433 INFO TokenLibrary [Thread-78]: InMemory Cache hit! Returning cached token for pbi. TimeTaken in ms: 1
2023-03-31 05:37:37,433 INFO notebookUtils [Thread-78]: [End] Done to get pbi aadToken via TokenLibrary, costs - 2ms
2023-03-31 05:37:37,433 INFO notebookUtils [Thread-78]: NBS endpoint is https://exec.nbs-int.southcentralus.azuresynapse-dogfood.net
2023-03-31 05:37:38,270 INFO notebookUtils [Thread-78]: execute request successfully for saveSnapshot - /runNotebookApi/versions/1/productTypes/trident/capacities/7154B5FE-441F-4BB2-B727-78B59BC3BDF9/workspaces/3b7394c3-4e1b-4076-8444-3273f071c6ae/artifacts/24429d93-7353-4b5b-83af-4e0ac3a42851/nbreferencerun/e780c9d8-d1e1-4bea-aba4-94ae48465b57/snapshot.
2023-03-31 05:37:38,271 INFO notebookUtils [Thread-78]: umount notebook resource for reference run e780c9d8-d1e1-4bea-aba4-94ae48465b57
2023-03-31 05:37:38,274 INFO notebookUtils [Thread-78]: [unmount operation] start unmount /e780c9d8-d1e1-4bea-aba4-94ae48465b57/nb_resource
2023-03-31 05:37:38,308 INFO MasterPubSubConnectionPool [redisson-netty-8-5]: 1 connections initialized for 10.11.192.5/10.11.192.5:6379
2023-03-31 05:37:38,322 INFO MasterConnectionPool [redisson-netty-8-11]: 4 connections initialized for 10.11.192.5/10.11.192.5:6379
2023-03-31 05:37:38,355 INFO notebookUtils [Thread-78]: Redisson client has been shutdown successfully.
2023-03-31 05:37:38,355 INFO notebookUtils [Thread-78]: [mount operation] unmount /e780c9d8-d1e1-4bea-aba4-94ae48465b57/nb_resource
2023-03-31 05:37:38,415 INFO MasterPubSubConnectionPool [redisson-netty-11-8]: 1 connections initialized for 10.11.192.5/10.11.192.5:6379
2023-03-31 05:37:38,420 INFO MasterConnectionPool [redisson-netty-11-11]: 4 connections initialized for 10.11.192.5/10.11.192.5:6379
2023-03-31 05:37:38,456 INFO notebookUtils [Thread-78]: Redisson client has been shutdown successfully.
End of LogType:stderr-active
******************************************************************************`;
// Hover on each property to see its docs!
const editor = monaco.editor.create(document.getElementById("container"), {
value: text,
automaticLayout: true,
readOnly: true,
lineNumbers: 'off',
glyphMargin: false,
folding: true,
showFoldingControls: 'always',
lineDecorationsWidth: 0,
lineNumbersMinChars: 0,
scrollBeyondLastLine: false,
contextmenu: false,
minimap: {
enabled: false,
},
scrollbar: {
verticalScrollbarSize: 5,
horizontalScrollbarSize: 10,
},
});
const model = editor.getModel();
monaco.languages.registerFoldingRangeProvider('driverlog', {
provideFoldingRanges: driverLogFoldingRangeProvider
});
editor.revealLine(model ? model.getLineCount() : 0);
function driverLogFoldingRangeProvider(model) {
const foldings = [];
console.log('testing~~~~')
if (model) {
let preTime = null;
let foldingRange = {
start: 0,
end: 0,
};
for (let i = 1; i <= model.getLineCount(); i++) {
const lineContent = model.getLineContent(i);
const matchedResult = lineContent.match(/^\d{2,4}[\/-]\d{2}[\/-]\d{2}\s+\d{2}:\d{2}:\d{2}(\,\d{3})?/);
if (matchedResult) {
const time = matchedResult[0];
if (time !== preTime) {
if (preTime === null) {
foldingRange.start = i;
} else {
foldingRange.end = i - 1;
foldings.push(foldingRange);
foldingRange = {
start: i,
end: i,
};
}
preTime = time;
}
}
}
foldingRange.end = model.getLineCount();
foldings.push(foldingRange);
}
return foldings;
}
Reproduction Steps
No response
Actual (Problematic) Behavior

Hover on the red rect to fold the log. In lots of space, the cursor will turn to pointer while click doesn't work at all.

Expected Behavior
When folding/unfolding the item, once the cursor turns to pointer, the click should work
Additional Context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.