asciidoctor / asciidoctor-vscode

AsciiDoc support for Visual Studio Code using Asciidoctor
Other
333 stars 97 forks source link

Extension uses a specific word wrap setting on AsciiDoc files #800

Open jeffrey-chongsathien-oxinst opened 1 year ago

jeffrey-chongsathien-oxinst commented 1 year ago

When editing an .adoc file, the settings mentioned in the title are ignored by the editor. Is this intended behaviour? If so, why is it desirable?

Ascidoc > Preview: Use Editor Style is set to Yes.

ggrossetie commented 1 year ago

It seems to be working as intended:

wordwrap

toggle-word-wrap

Could you please provide details about:

amckibben commented 10 months ago

I absolutely could not my global user settings for word wrap to apply to asciidoc files 🤷 Worked flawlessly for any other type of file I typically edit (json, yaml, go, python, markdown, etc.).

I figured there must be something overriding / blocking those settings at the workspace level, but could not find any evidence of that.

Finally I just added word wrap settings specifically for the asciidoc language to my global user settings with a block like the following, and that worked like a charm:

  "[asciidoc]": {
    "editor.wordWrap": "bounded",
    "editor.wordWrapColumn": 100
  }
ggrossetie commented 9 months ago

@amckibben I guess global user settings have a lower precedence than:

https://github.com/asciidoctor/asciidoctor-vscode/blob/e190123fa2cfcf5f168fc9bb0ab406caf82fb2b1/package.json#L574-L579

The Markdown extension is using more or less the same settings: https://github.com/microsoft/vscode/blob/f88bce8fe6a6d2ccd27cbd64bb26853cd8779afa/extensions/markdown-language-features/package.json#L692-L701

So I'm not really sure why it does not work the same... 🤔

ggrossetie commented 7 months ago

I guess this is more a debate about if we should define a specific wordWrap and, if so, which default value we should use. Any opinion on this matter @mojavelinux @ahus1? I guess wordWrap: on is a good default value when reading/writing documentation no?

ggrossetie commented 7 months ago

And also a documentation issue to explain how to override it using:

  "[asciidoc]": {
    "editor.wordWrap": "bounded",
    "editor.wordWrapColumn": 100
  }

(as mentioned by Alex)

mojavelinux commented 7 months ago

I'm not entirely sure what the question is. I would expect that the text would soft wrap when it overflows the visible area. Is that the feature being discussed?

ggrossetie commented 7 months ago

Yes that's correct:

  // Controls how lines should wrap.
  //  - off: Lines will never wrap.
  //  - on: Lines will wrap at the viewport width.
  //  - wordWrapColumn: Lines will wrap at `editor.wordWrapColumn`.
  //  - bounded: Lines will wrap at the minimum of viewport and `editor.wordWrapColumn`.
  "editor.wordWrap": "off",

You can control word wrap through the editor.wordWrap setting. By default, editor.wordWrap is off but if you set to it to on, text will wrap on the editor's viewport width.

https://code.visualstudio.com/docs/editor/codebasics#_how-do-i-turn-on-word-wrap

We are using "editor.wordWrap": "on" on AsciiDoc files. So, the text will soft wrap at the viewport width.

mojavelinux commented 7 months ago

We are using "editor.wordWrap": "on" on AsciiDoc files. So, the text will soft wrap at the viewport width.

That seems like a reasonable default to me.

ahus1 commented 6 months ago

Same here, it is a reasonable default.

The AsciiDoc plugin for IntelliJ choses a different way: In IntelliJ, there is a global setting for enabling this by file extension. When using the AsciiDoc plugin for IntelliJ for the first time, it show a notification and tries to guide the user to this setting to change it there, as I didn't want to have a plugin-specific setting when there is a global one.