This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Repository navigation
Indentation updates #204
Merged
Merged
Indentation updates #204
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
87c01e2
dedent next line for some keywords
kbrose f0b7a47
Technically right regex, but triggers to soon to be useful
kbrose a039867
Adding indent spec
kbrose 08ba2c7
adding 'pass' as dedent keyword
kbrose 512e0a0
remove extra newline
kbrose File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| describe 'Python settings', -> | ||
| [editor, languageMode] = [] | ||
|
|
||
| afterEach -> | ||
| editor.destroy() | ||
|
|
||
| beforeEach -> | ||
| waitsForPromise -> | ||
| atom.workspace.open('sample.py').then (o) -> | ||
| editor = o | ||
| languageMode = editor.languageMode | ||
|
|
||
| waitsForPromise -> | ||
| atom.packages.activatePackage('language-python') | ||
|
|
||
| it 'matches lines correctly using the increaseIndentPattern', -> | ||
| increaseIndentRegex = languageMode.increaseIndentRegexForScopeDescriptor(['source.python']) | ||
|
|
||
| expect(increaseIndentRegex.testSync('for i in range(n):')).toBeTruthy() | ||
| expect(increaseIndentRegex.testSync(' for i in range(n):')).toBeTruthy() | ||
| expect(increaseIndentRegex.testSync('class TheClass(Object):')).toBeTruthy() | ||
| expect(increaseIndentRegex.testSync(' class TheClass(Object):')).toBeTruthy() | ||
| expect(increaseIndentRegex.testSync('def f(x):')).toBeTruthy() | ||
| expect(increaseIndentRegex.testSync(' def f(x):')).toBeTruthy() | ||
| expect(increaseIndentRegex.testSync('if this_var == that_var:')).toBeTruthy() | ||
| expect(increaseIndentRegex.testSync(' if this_var == that_var:')).toBeTruthy() | ||
| expect(increaseIndentRegex.testSync('elif this_var == that_var:')).toBeTruthy() | ||
| expect(increaseIndentRegex.testSync(' elif this_var == that_var:')).toBeTruthy() | ||
| expect(increaseIndentRegex.testSync('else:')).toBeTruthy() | ||
| expect(increaseIndentRegex.testSync(' else:')).toBeTruthy() | ||
| expect(increaseIndentRegex.testSync('except Exception:')).toBeTruthy() | ||
| expect(increaseIndentRegex.testSync(' except Exception:')).toBeTruthy() | ||
| expect(increaseIndentRegex.testSync('except Exception as e:')).toBeTruthy() | ||
| expect(increaseIndentRegex.testSync(' except Exception as e:')).toBeTruthy() | ||
| expect(increaseIndentRegex.testSync('finally:')).toBeTruthy() | ||
| expect(increaseIndentRegex.testSync(' finally:')).toBeTruthy() | ||
| expect(increaseIndentRegex.testSync('with open("filename") as f:')).toBeTruthy() | ||
| expect(increaseIndentRegex.testSync(' with open("filename") as f:')).toBeTruthy() | ||
| expect(increaseIndentRegex.testSync('while True:')).toBeTruthy() | ||
| expect(increaseIndentRegex.testSync(' while True:')).toBeTruthy() | ||
| expect(increaseIndentRegex.testSync('\t\t while True:')).toBeTruthy() | ||
|
|
||
| it 'does not match lines incorrectly using the increaseIndentPattern', -> | ||
| increaseIndentRegex = languageMode.increaseIndentRegexForScopeDescriptor(['source.python']) | ||
|
|
||
| expect(increaseIndentRegex.testSync('for i in range(n)')).toBeFalsy() | ||
| expect(increaseIndentRegex.testSync('class TheClass(Object)')).toBeFalsy() | ||
| expect(increaseIndentRegex.testSync('def f(x)')).toBeFalsy() | ||
| expect(increaseIndentRegex.testSync('if this_var == that_var')).toBeFalsy() | ||
| expect(increaseIndentRegex.testSync('"for i in range(n):"')).toBeFalsy() | ||
|
|
||
| it 'matches lines correctly using the decreaseIndentPattern', -> | ||
| decreaseIndentRegex = languageMode.decreaseIndentRegexForScopeDescriptor(['source.python']) | ||
|
|
||
| expect(decreaseIndentRegex.testSync('elif this_var == that_var:')).toBeTruthy() | ||
| expect(decreaseIndentRegex.testSync(' elif this_var == that_var:')).toBeTruthy() | ||
| expect(decreaseIndentRegex.testSync('else:')).toBeTruthy() | ||
| expect(decreaseIndentRegex.testSync(' else:')).toBeTruthy() | ||
| expect(decreaseIndentRegex.testSync('except Exception:')).toBeTruthy() | ||
| expect(decreaseIndentRegex.testSync(' except Exception:')).toBeTruthy() | ||
| expect(decreaseIndentRegex.testSync('except Exception as e:')).toBeTruthy() | ||
| expect(decreaseIndentRegex.testSync(' except Exception as e:')).toBeTruthy() | ||
| expect(decreaseIndentRegex.testSync('finally:')).toBeTruthy() | ||
| expect(decreaseIndentRegex.testSync(' finally:')).toBeTruthy() | ||
| expect(decreaseIndentRegex.testSync('\t\t finally:')).toBeTruthy() | ||
|
|
||
| it 'does not match lines incorrectly using the decreaseIndentPattern', -> | ||
| decreaseIndentRegex = languageMode.decreaseIndentRegexForScopeDescriptor(['source.python']) | ||
|
|
||
| # NOTE! This first one is different from most other rote tests here. | ||
| expect(decreaseIndentRegex.testSync('else: expression()')).toBeFalsy() | ||
| expect(decreaseIndentRegex.testSync('elif this_var == that_var')).toBeFalsy() | ||
| expect(decreaseIndentRegex.testSync(' elif this_var == that_var')).toBeFalsy() | ||
| expect(decreaseIndentRegex.testSync('else')).toBeFalsy() | ||
| expect(decreaseIndentRegex.testSync(' "finally:"')).toBeFalsy() | ||
|
|
||
| it 'matches lines correctly using the decreaseNextIndentPattern', -> | ||
| decreaseNextIndentRegex = languageMode.decreaseNextIndentRegexForScopeDescriptor(['source.python']) | ||
|
|
||
| expect(decreaseNextIndentRegex.testSync(' return')).toBeTruthy() | ||
| expect(decreaseNextIndentRegex.testSync(' return')).toBeTruthy() | ||
| expect(decreaseNextIndentRegex.testSync(' return x')).toBeTruthy() | ||
| expect(decreaseNextIndentRegex.testSync(' yield x')).toBeTruthy() | ||
| expect(decreaseNextIndentRegex.testSync(' yield expression()')).toBeTruthy() | ||
| expect(decreaseNextIndentRegex.testSync(' continue')).toBeTruthy() | ||
| expect(decreaseNextIndentRegex.testSync(' break')).toBeTruthy() | ||
| expect(decreaseNextIndentRegex.testSync(' pass')).toBeTruthy() | ||
| expect(decreaseNextIndentRegex.testSync(' raise')).toBeTruthy() | ||
| expect(decreaseNextIndentRegex.testSync(' raise Exception()')).toBeTruthy() | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🔥 empty line
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.
removed