Adds configuration option for large file warning threshold. #12439
Conversation
/cc @nathansobo is this something you're ok with being customizable? |
@50Wliu Yeah I'm cool with it. Makes sense. If someone can verify this works correctly I'm 👍 to merge. |
Like so? |
@remexre I don't think that's quite it. What we need is a test that the limit is configurable. So you would assign a limit to the configuration in the test to a number below the mocked file size and confirm we show the dialog, then reassign the limit to a number above the mocked file size and confirm we don't show the dialog. |
Is this good? |
test 20, false | ||
it "prompts for smaller files with a lower limit", -> | ||
atom.config.set "core.warnOnLargeFileLimit", 5 | ||
test 10, true |
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.
Can you space this stuff out?
Getting close. I left a few more comments. |
First two done, not 100% sure how to do the last one. EDIT Actually, would it just be if shouldPrompt
# ...
else
runs ->
expect(editor).not.toBeUndefined() ? |
You can also do a negative assertion on your mock... expect(atom.applicationDelegate.confirm).not.toHaveBeenCalled() |
I think it's fixed now? For some reason, |
@remexre You can view specs by clicking on the |
This looks good now - thanks! |
⚡️ Thanks @remexre! |
Closes atom/tree-view#810? |
I believe so. |
@remexre does this apply to actually opening files (e.g. double click), or also when previewing files from tree view (single click)? I just had the editor hang on me because I accidentally clicked on a file with 70k+ lines. |
IIRC Previewing, I originally made it because I was annoyed by misclicking a.out instead of asourcefile.c. |
Great, thanks |
See #10086.