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

feat(code-editor): support custom tabSize #4014

Merged
merged 4 commits into from
Feb 21, 2025

Conversation

aboissinot-coveo
Copy link
Contributor

@aboissinot-coveo aboissinot-coveo commented Feb 19, 2025

Proposed Changes

Allow setting a custom tabSize in the CodeEditor component.

Previously, it was hardcoded to 2 but let's say for example you use the editor to write Python code and want to follow the PEP8 guidelines, you need to set 4.

Demo here. 🧪

Documentation

📖 This prop is supported by the Monaco Editor and documented here.

⚠️ Note: According to the Monaco Editor's documentation on tabSize:

This setting is overridden based on the file contents when detectIndentation is on.

So this means that if you set a tabSize of 4, but the content of the editor is using 2 spaces, it will enforce a tabSize of 2. However, if you erase everything and start from scratch, it will fallback on the tabSize property.

Potential Breaking Changes

None. The new prop is optional and the default behaviour with a tabSize of 2 is preserved.

Acceptance Criteria

  • The proposed changes are covered by unit tests
  • The potential breaking changes are clearly identified
  • README.md is adjusted to reflect the proposed changes (if relevant)

Copy link

@aboissinot-coveo aboissinot-coveo marked this pull request as ready for review February 19, 2025 21:24
@aboissinot-coveo aboissinot-coveo requested a review from a team as a code owner February 19, 2025 21:24
@aboissinot-coveo aboissinot-coveo requested review from GermainBergeron and FelixBlaisThon and removed request for a team February 19, 2025 21:24
@GermainBergeron GermainBergeron merged commit a4483fa into master Feb 21, 2025
7 checks passed
@GermainBergeron GermainBergeron deleted the SEARCHAPI-11667/code-editor-tabs branch February 21, 2025 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants