Theia: Add 'Toggle word wrap' command

Created on 25 Jul 2018  路  9Comments  路  Source: eclipse-theia/theia

There's no menu item / keyboard shortcut / command for toggling line wrapping.

Probably not much used when writing code, but useful, for instance, if you edit a text file (like *.md) on a smaller screen than the author had ... imho it's a basic feature of any text editor and we should have it there.

editor enhancement help wanted

Most helpful comment

You can activate this feature with help workspace or user preferences:

  1. File -> Open Workspace Preferences
  2. In the editor apply to the preference json : editor.wordWrap: "on"
    For example:
{
   "editor.fontSize": "16px",
   "editor.wordWrap": "on"
}

All 9 comments

You can activate this feature with help workspace or user preferences:

  1. File -> Open Workspace Preferences
  2. In the editor apply to the preference json : editor.wordWrap: "on"
    For example:
{
   "editor.fontSize": "16px",
   "editor.wordWrap": "on"
}

Yes, that works, but:

  • this is a setting you want to toggle on and off fast during your editing, it should be per file, not global
  • in the Gitpod case the only option is to set it in the workspace configuration file, which is probably something we don't want for many reasons (for instance, in the best case everybody using Gitpod would have to add '.theia/' configuration directory to .gitignore ... and I expect we don't want to force the users to change the contents of their repositories just because of using Gitpod)

Just checked the terminology ... it seems 'word wrapping' is the correct name: https://en.wikipedia.org/wiki/Line_wrap_and_word_wrap (first paragraph). In VS Code it's 'Toggle word wrap', in Kate 'Word wrap', therefore my suggestion

After a discussion with @akosyakov: I believe such a setting is very similar to other ephemeral settings like Toggle line numbers, Toggle Ins/Overwrite and so on; as such, it should be per editor view, easily triggerable (keyboard shortcut / view menu), and indicated in the bottom status bar (maybe this is not necessary, I suggest getting inspired in some popular editors out there first). Naturally, there should be some sensible default/setting per file type / per user, but that's of secondary priority. For the starters, 'Word wrap: off' in any new editor view is something one can live with - if he can toggle it easily.

I would love to have a way to toggle this by the menu. My specific use case is editing pull-requests via the GitPod chrome extension. Typically I use GitPod for minor touchups or authoring markdown documents. Workspace Preferences isn't a good workflow for me as each github pull-request typically spawns a throwaway instance.

@ghuntley You can configure it in user preferences when it will be applied always.

Good to know. Just out of interest would you take a pull request that added this feature to the menu and a shortcut?

Yes, why not? But then it will be applied only to the current editor, right? For next editor again a value from preferences will be used.

Hmmm, one approach would be to toggle the persisted value in the user preferences. I just checked Visual Studio Code's behavior as a reference and it does _not_ persist the value upon restarting the application. I think adding the menu item would suffice and _not_ persisting the value is the route to go.

Was this page helpful?
0 / 5 - 0 ratings