Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[preferences] inconsistent formatting when adding a preference through the tree #5052

Closed
vince-fugnitto opened this issue May 1, 2019 · 1 comment · Fixed by #6736
Closed
Labels
bug bugs found in the application preferences issues related to preferences

Comments

@vince-fugnitto
Copy link
Member

Description
If a new preference is added by the preferences-tree the formatting becomes inconsistent with existing preferences.

Steps to reproduce

  1. Start with a settings.json with exisitng preferences (in my case json had 2 spaces).
  2. Add a new preference through the preferences tree.
  3. Notice the inconsistent formatting (in my case the last two preferences are unformatted).

image

@vince-fugnitto vince-fugnitto added bug bugs found in the application preferences issues related to preferences labels May 1, 2019
@vince-fugnitto
Copy link
Member Author

I believe we should be smarter here and get the current configured tabSize instead of hardcoding a value.
https://github.com/theia-ide/theia/blob/a88ef75e2deb5f609c98fe393994c47df6418114/packages/preferences/src/browser/abstract-resource-preference-provider.ts#L76

vince-fugnitto added a commit that referenced this issue Dec 11, 2019
Fixes #5052

- fixes the indentation when updating/setting a preference using the
`preferences-tree` widget.
- the current implementation had a hardcoded value of `tabSize`=3 and `insertSpaces`=true which
meant that if the `settings.json` file had different formatting, it would insert incorrectly.
- added a new method `detectIndentation` which attempts to detect the current indentation
(tabSize and indent type) based on the content of the file.

Signed-off-by: vince-fugnitto <[email protected]>
vince-fugnitto added a commit that referenced this issue Dec 12, 2019
Fixes #5052

- fixes the indentation when updating/setting a preference using the
`preferences-tree` widget.
- the current implementation had a hardcoded value of `tabSize`=3 and `insertSpaces`=true which
meant that if the `settings.json` file had different formatting, it would insert incorrectly.
- added a new method `detectIndentation` which attempts to detect the current indentation
(tabSize and indent type) based on the content of the file.

Signed-off-by: vince-fugnitto <[email protected]>
vince-fugnitto added a commit that referenced this issue Dec 16, 2019
Fixes #5052

- fixes the indentation when updating/setting a preference using the
`preferences-tree` widget.
- the current implementation had a hardcoded value of `tabSize`=3 and `insertSpaces`=true which
meant that if the `settings.json` file had different formatting, it would insert incorrectly.
- added a new method `getFormattingOptions` which gets the preference options for tabSize and indentation type.

Signed-off-by: vince-fugnitto <[email protected]>
vince-fugnitto added a commit that referenced this issue Dec 16, 2019
Fixes #5052

- fixes the indentation when updating/setting a preference using the
`preferences-tree` widget.
- the current implementation had a hardcoded value of `tabSize`=3 and `insertSpaces`=true which
meant that if the `settings.json` file had different formatting, it would insert incorrectly.
- added a new method `getFormattingOptions` which gets the preference options for tabSize and indentation type.
- fixed typings from the `preference-service`. If a default value is provided, the preference should return that
value if the preference initially returns `undefined`.

Signed-off-by: vince-fugnitto <[email protected]>
vince-fugnitto added a commit that referenced this issue Dec 16, 2019
Fixes #5052

- fixes the indentation when updating/setting a preference using the
`preferences-tree` widget.
- the current implementation had a hardcoded value of `tabSize`=3 and `insertSpaces`=true which
meant that if the `settings.json` file had different formatting, it would insert incorrectly.
- added a new method `getFormattingOptions` which gets the preference options for tabSize and indentation type.
- fixed typings from the `preference-service`. If a default value is provided, the preference should return that
value if the preference initially returns `undefined`.

Signed-off-by: vince-fugnitto <[email protected]>
vince-fugnitto added a commit that referenced this issue Dec 16, 2019
Fixes #5052

- fixes the indentation when updating/setting a preference using the
`preferences-tree` widget.
- the current implementation had a hardcoded value of `tabSize`=3 and `insertSpaces`=true which
meant that if the `settings.json` file had different formatting, it would insert incorrectly.
- added a new method `getFormattingOptions` which gets the preference options for tabSize and indentation type.
- fixed typings from the `preference-service`. If a default value is provided, the preference should return that
value if the preference initially returns `undefined`.

Signed-off-by: vince-fugnitto <[email protected]>
vince-fugnitto added a commit that referenced this issue Dec 16, 2019
Fixes #5052

- fixes the indentation when updating/setting a preference using the
`preferences-tree` widget.
- the current implementation had a hardcoded value of `tabSize`=3 and `insertSpaces`=true which
meant that if the `settings.json` file had different formatting, it would insert incorrectly.
- added a new method `getFormattingOptions` which gets the preference options for tabSize and indentation type.
- fixed typings from the `preference-service`. If a default value is provided, the preference should return that
value if the preference initially returns `undefined`.

Signed-off-by: vince-fugnitto <[email protected]>
vince-fugnitto added a commit that referenced this issue Dec 17, 2019
Fixes #5052

- fixes the indentation when updating/setting a preference using the
`preferences-tree` widget.
- the current implementation had a hardcoded value of `tabSize`=3 and `insertSpaces`=true which
meant that if the `settings.json` file had different formatting, it would insert incorrectly.
- added a new method `getFormattingOptions` which gets the preference options for tabSize and indentation type.
- fixed typings from the `preference-service`. If a default value is provided, the preference should return that
value if the preference initially returns `undefined`.

Signed-off-by: vince-fugnitto <[email protected]>
vince-fugnitto added a commit that referenced this issue Dec 17, 2019
Fixes #5052

- fixes the indentation when updating/setting a preference using the
`preferences-tree` widget.
- the current implementation had a hardcoded value of `tabSize`=3 and `insertSpaces`=true which
meant that if the `settings.json` file had different formatting, it would insert incorrectly.
- added a new method `getFormattingOptions` which gets the preference options for tabSize and indentation type.
- fixed typings from the `preference-service`. If a default value is provided, the preference should return that
value if the preference initially returns `undefined`.

Signed-off-by: vince-fugnitto <[email protected]>
vince-fugnitto added a commit that referenced this issue Dec 19, 2019
Fixes #5052

- fixes the indentation when updating/setting a preference using the
`preferences-tree` widget.
- the current implementation had a hardcoded value of `tabSize`=3 and `insertSpaces`=true which
meant that if the `settings.json` file had different formatting, it would insert incorrectly.
- added a new method `getFormattingOptions` which gets the preference options for tabSize and indentation type.
- fixed typings from the `preference-service`. If a default value is provided, the preference should return that
value if the preference initially returns `undefined`.

Signed-off-by: vince-fugnitto <[email protected]>
vince-fugnitto added a commit that referenced this issue Dec 20, 2019
Fixes #5052

- fixes the indentation when updating/setting a preference using the
`preferences-tree` widget.
- the current implementation had a hardcoded value of `tabSize`=3 and `insertSpaces`=true which
meant that if the `settings.json` file had different formatting, it would insert incorrectly.
- added a new method `getFormattingOptions` which gets the preference options for tabSize and indentation type.
- fixed typings from the `preference-service`. If a default value is provided, the preference should return that
value if the preference initially returns `undefined`.

Signed-off-by: vince-fugnitto <[email protected]>
akosyakov pushed a commit to akosyakov/theia that referenced this issue Feb 24, 2020
Fixes eclipse-theia#5052

- fixes the indentation when updating/setting a preference using the
`preferences-tree` widget.
- the current implementation had a hardcoded value of `tabSize`=3 and `insertSpaces`=true which
meant that if the `settings.json` file had different formatting, it would insert incorrectly.
- added a new method `getFormattingOptions` which gets the preference options for tabSize and indentation type.
- fixed typings from the `preference-service`. If a default value is provided, the preference should return that
value if the preference initially returns `undefined`.

Signed-off-by: vince-fugnitto <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug bugs found in the application preferences issues related to preferences
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant