Skip to content

Configure long line length #65137

Merged
alexdima merged 1 commit intomicrosoft:masterfrom
ColCh:63639-add-long-line-config-entry
Feb 15, 2019
Merged

Configure long line length #65137
alexdima merged 1 commit intomicrosoft:masterfrom
ColCh:63639-add-long-line-config-entry

Conversation

@ColCh
Copy link
Contributor

@ColCh ColCh commented Dec 15, 2018

closes #63639

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is contribInfo a right place for this setting?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would go better as EDITOR_DEFAULTS.longLineLength. @alexandrudima, can you confirm?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed option name to maxTokenizationLineLength

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

god job!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a bit about how this can be configured now? "The length of a long line can be set by configuring editor.longLineLength in settings."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added 👍

Copy link
Member

@alexdima alexdima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


1. Don't parse/validate the option in editorOptions.ts

Editor options can be a bit tricky because each editor instance can be configured differently. e.g. it would be possible to have an editor with word wrap enabled while another one with word wrap not enabled. That is the reason why all these editorOptions.ts classes/interfaces exist. This is typically done by having someone on the outside reading the IConfigurationService and applying it partly or fully to an editor instance, and then all the code in the editor goes through these editorOptions.ts interfaces to read the effective setting.

However, in this case, this new option is not editor instance specific. This can be spotted by the reading side, in TMSyntax.ts, where reading is done through the IConfigurationService directly (a singleton). So, I suggest we remove all the additions from editorOptions.ts. It is still possible to have an option editor.something and for it to not be parsed/validated/etc. in editorOptions.ts if it is being read straight through the IConfigurationService.


2. Find a better name

I think editor.longLineLength is too fuzzy. For example, we have another built-in constant for rendering lines. Lines longer than 10k chars will be painted with a '...' in the view (again to prevent freezes). If we were to make that configurable we would have a name clash. I therefore suggest we come up with a better name here, something that contains one of the following (or a synonym if you have a better one): tokenization, grammars, colorization, syntax highlighting.

@alexdima alexdima self-assigned this Dec 17, 2018
Copy link
Member

@alexr00 alexr00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments

@ColCh
Copy link
Contributor Author

ColCh commented Feb 2, 2019

Thank you for such detailed review comments!

Updated the code, please take a look again @alexandrudima @alexr00
Build seems to pass in CI

TL;DR; changes

  • removed changes from editorOptions.ts. Didn't knew that, thanks.
  • renamed option name to maxTokenizationLineLength to be more specific
  • added note on how to change it

@alexdima alexdima force-pushed the 63639-add-long-line-config-entry branch from 32290d6 to 8a04f8f Compare February 15, 2019 15:55
@alexdima
Copy link
Member

👍 Thank you!

@alexdima alexdima merged commit e4b6b5b into microsoft:master Feb 15, 2019
@alexdima alexdima added this to the February 2019 milestone Feb 15, 2019
@ColCh
Copy link
Contributor Author

ColCh commented Feb 15, 2019

Thank you too! 👍

alexdima added a commit that referenced this pull request Feb 15, 2019
@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Configure long lines length

4 participants