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

[Feature Request] Support word wrapping only selected ranges, or not wrapping selected ranges

Open fabiospampinato opened this issue 1 year ago • 6 comments

Context

  • [X] This issue is not a bug report. (please use a different template for reporting a bug)
  • [X] This issue is not a duplicate of an existing issue. (please use the search to find existing issues)

Description

When using Monaco to edit Markdown it's often desirable to turn on word wrapping, but there are scenarios where word wrapping is never useful, for example you basically never want to word-wrap a Markdown table because it would be completely unreadable.

So what one would really want is the ability to wrap anything except Markdown tables, for example, but that's not currently implementable because word-wrapping it's an all or nothing kind of setting.

Monaco Editor Playground Link

No response

Monaco Editor Playground Code

No response

fabiospampinato avatar Apr 14 '23 15:04 fabiospampinato

Interesting problem. Unsure how a clean implementation/ux would look like though. Maybe decorations can be used to indicate ranges that should be excluded for wrapping. But what if some users actually want to wrap everything?

hediet avatar Apr 17 '23 09:04 hediet

But what if some users actually want to wrap everything?

There could be a setting for that I suppose, but really when is wrapping a Markdown table useful? 🤔 It looks to me like the answer might be "never".

fabiospampinato avatar Apr 17 '23 11:04 fabiospampinato

Could restricting the width of all non-table elements in the editor to the width of the editor achieve the same effect ? This would be applied without any of the current word wrapping, and could most likely be simulated by js+jquery ; it would require a computed pixel width, as I don't believe there may be a way to contain all elements parent of div.view-line within the editor frame, unless we instead made tables overflow and be the exception.

D-Maxwell avatar Apr 17 '23 12:04 D-Maxwell

Looks pretty dead here, but I came here to suggest this very thing -- and for the same reason, Markdown tables. Certain kinds of block comments in code might make sense to treat this way as well. Ideally, one could pass a regex/function of "should this line be wrapped or not," and the horizontal scrollbar would continue to appear, but would only be useful for those rows that aren't wrapped.

richardtallent-erm avatar Dec 07 '23 19:12 richardtallent-erm

Can you file this as feature request for VS Code? That could make it more likely to get it implemented.

hediet avatar Dec 14 '23 14:12 hediet

Hi @hediet , can you provide more specific info? This Issue is both flagged as a feature request and has a prefix on the title. The CONTRIBUTING and README files don't mention a separate place for feature requests.

richardtallent-erm avatar Dec 14 '23 21:12 richardtallent-erm