Skip to content

[feat] Vertical rulers/guidelines for line char limit ux #1237

@abose

Description

@abose

Describe the problem

There should be a way to set a vertical grid line as in the picture below for better UX in char limits. This should be available out of the box.

image

Describe the solution you'd like

It is currently supported with the rulers add-on in codemirror. Minimal code:

in brackets.js

require("thirdparty/CodeMirror/addon/display/rulers");

in Editor.js

...
this._codeMirror = new CodeMirror(container, {
            rulers: [{color: "#f5f577", column: 110, lineStyle: "solid !important"}],
...

Docs:

  1. https://codemirror.net/5/doc/manual.html#addon_rulers
  2. sample code: https://github.com/codemirror/codemirror5/blob/master/demo/rulers.html

Activation

  1. Should have a setting to disable/enable/Auto mode.
  2. Should be in Auto mode by default.
  3. In Auto Mode, If ESLint/prettier rc/ any style-related JSON is present in the project, we will draw gridlines based on the project config. If there are no such prefs, we don't draw grid lines.

Alternatives considered

The Guidelines extension in the extension store does similar thing, but it does not correctly draw the line on the character position expected on zoom. This is because it manually does the line placement calculation based on font sizes and that can be wrong. Best to use the above in build CM5 add-on that takes care of everything.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Feature RequestFeature requests from customersUXUX related issues

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions