-
-
Notifications
You must be signed in to change notification settings - Fork 84
Force tab size on test run #731
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
Conversation
- This fixes problems related to different local configurations - Tests expect tabSize to be 4
This will only force tab size to be for when re-running the tests. I think we need to add the same to the test recorder otherwise every test will be recorded with the user tab setting, but run with a fixed setting. |
I'll second what @AndreasArvidsson says here. I think if we detect that the extension is running in debug mode, we should make the same |
Not important, but I'm still a little curious about why this didn't break for me, with other tests that I've recorded. @pokey — I'll likely add the setting here as well rather than in the actual extension. |
did you record tests that include snippet wrapping? I think those are the ones that will break
Sorry not sure I follow—that won't impact recording right? |
Nope, you're right. One other indent and fold test broke as well though
Multi-tasking between emails, sorry. You're right. |
- Check if we're in debug mode and set tabSize if so - Move tabSize to constants file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good with minor tweak
if (vscode.window.activeTextEditor) { | ||
vscode.window.activeTextEditor.options.tabSize = | ||
DEFAULT_TAB_SIZE_FOR_TESTS; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm maybe we should only do this if they're recording a test? Otherwise we'll clobber their tab size if they have cursorless debug mode on
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heyo @pokey — I moved this entire step into the TestCaseRecorder
since we have state there about whether we should or should not set the tabs. That also bring the code out of the CommandRunner
loop. We clean up at the end and reset to the original tab setting, if a user stops recording their test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should do this one in the preCommandHook
/ errorHook
/ postCommandHook
so that
- The code should be simpler, I think, because we don't need to set / unset it in so many places
- We can properly handle splits in the future. Your current code will break with multiple splits
I would a keep list of visible editors and their original tab stops in preCommandHook
, and reset them on those editors in postCommandHook
/ errorHook
Does that make sense?
Alternately, you can just do activeTextEditor
, if the visible editors thing looks painful. I am considering adding split testing support in #721; debating whether it's worth supporting recording tests this way. So if it looks painful to do all visible editors, active is prob fine, but I still think it's simpler to do it in pre
/ postCommandHook
.
But I don't feel too strongly if you think it's going to be better this way 😊
@pokey I think you can have a look at this one now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Needed to make some tweaks because the restore code was broken
Fixes: #598
Checklist