forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Format on type fixes #1798
Merged
Merged
Format on type fixes #1798
Changes from 103 commits
Commits
Show all changes
104 commits
Select commit
Hold shift + click to select a range
a764bc9
Undo changes
9d1b2cc
Test fixes
a91291a
Increase timeout
bf266af
Remove double event listening
7bc6bd6
Remove test
8ce8b48
Revert "Remove test"
e3a549e
Revert "Remove double event listening"
92e8c1e
#1096 The if statement is automatically formatted incorrectly
b540a1d
Merge fix
7b0573e
Add more tests
facb106
More tests
f113881
Typo
3e76718
Test
6e85dc6
Also better handle multiline arguments
99e037c
Add a couple missing periods
brettcannon 3caeab7
Undo changes
eeb1f11
Test fixes
f5f78c7
Increase timeout
88744da
Remove double event listening
65dde44
Remove test
c513f71
Revert "Remove test"
ccb3886
Revert "Remove double event listening"
106f4db
Merge fix
9e5cb43
Merge branch 'master' of https://github.com/MikhailArkhipov/vscode-py…
e1da6a6
#1257 On type formatting errors for args and kwargs
e78f0fb
Handle f-strings
725cf71
Stop importing from test code
5cd6d45
#1308 Single line statements leading to an indentation on the next line
27613db
#726 editing python after inline if statement invalid indent
8061a20
Undo change
17dc292
Move constant
65964b9
Harden LS startup error checks
4bf5a4c
#1364 Intellisense doesn't work after specific const string
6f7212c
Merge branch 'master' of https://github.com/Microsoft/vscode-python
ddbd295
Telemetry for the analysis enging
ffd1d3f
Merge branch 'master' of https://github.com/Microsoft/vscode-python
d4afb6c
PR feedback
12186b8
Fix typo
ca90529
Test baseline update
a7267b5
Jedi 0.12
cfee109
Priority to goto_defition
1285789
Merge branch 'master' of https://github.com/Microsoft/vscode-python i…
d1ff1d9
News
1bd1651
Replace unzip
a69b6fd
Merge branch 'master' of https://github.com/Microsoft/vscode-python i…
f916ace
Linux flavors + test
28ca25f
Grammar check
ad9a3c9
Grammar test
ff8dd35
Test baselines
26726f8
Merge branch 'master' of https://github.com/Microsoft/vscode-python i…
d7806ca
Add news
0b3f316
Pin dependency
brettcannon 28a8950
Merge branch 'grammar' of https://github.com/MikhailArkhipov/vscode-p…
1804617
Merge branch 'master' of https://github.com/Microsoft/vscode-python i…
f000e5d
Specify markdown as preferable format
a06fd79
Merge branch 'master' of https://github.com/Microsoft/vscode-python
ef7c5c7
Improve function argument detection
f4e88c0
Specify markdown
d420c34
Merge branch 'master' of https://github.com/Microsoft/vscode-python
b819d57
Merge branch 'master' into analysis
abff213
Pythia setting
d140b3a
Baseline updates
4b394d9
Baseline update
a397b11
Improve startup
e54eaf8
Handle missing interpreter better
3b8ddd5
Handle interpreter change
9a4500d
Merge branch 'master' of https://github.com/Microsoft/vscode-python i…
41f9624
Delete old file
3627b85
Fix LS startup time reporting
486d11d
Remove Async suffix from IFileSystem
cf5cf9c
Merge branch 'master' of https://github.com/Microsoft/vscode-python i…
4913e28
Merge branch 'master' of https://github.com/Microsoft/vscode-python i…
84214e1
Remove Pythia
9c1adb1
Remove pre-packaged MSIL
5a6e546
Exe name on Unix
1f2ae09
Plain linux
f972614
Fix casing
e0021a9
Merge branch 'analysis' of https://github.com/MikhailArkhipov/vscode-…
d2721cd
Fix message
b8bc0a2
Merge branch 'analysis' of https://github.com/MikhailArkhipov/vscode-…
56d34f7
Update PTVS engine activation steps
9aab160
Merge branch 'analysis' of https://github.com/MikhailArkhipov/vscode-…
981290f
Type formatter eats space in from .
d279e96
fIX CASING
6b466a9
Remove flag
d8c6193
Merge branch 'master' of https://github.com/Microsoft/vscode-python i…
2904f3b
Don't wait for LS
c7d34c9
Small test fixes
17775bd
Update hover baselines
2edeb3c
Merge branch 'master' of https://github.com/Microsoft/vscode-python i…
2fd5387
Rename the engine
a06b993
Merge branch 'master' of https://github.com/Microsoft/vscode-python i…
0190078
Formatting 1
5b93e34
Add support for 'rf' strings
781e6b1
Add two spaces before comment per PEP
e795309
Fix @ operator spacing
d300d0c
Handle module and unary ops
dd09087
Type hints
46b6dfd
Fix typo
cf264b8
Trailing comma
3e341e9
Require space after if
e5a588e
Merge branch 'master' of https://github.com/Microsoft/vscode-python i…
06e7140
Update list of keywords
c597d82
PR feedback
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 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 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 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 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 |
---|---|---|
|
@@ -59,7 +59,7 @@ suite('Formatting - line formatter', () => { | |
testFormatLine('[ 1 :[2: (x,),y]]{1}', '[1:[2:(x,), y]]{1}'); | ||
}); | ||
test('Trailing comment', () => { | ||
testFormatLine('x=1 # comment', 'x = 1 # comment'); | ||
testFormatLine('x=1 # comment', 'x = 1 # comment'); | ||
}); | ||
test('Single comment', () => { | ||
testFormatLine('# comment', '# comment'); | ||
|
@@ -87,9 +87,15 @@ suite('Formatting - line formatter', () => { | |
}); | ||
test('Brace after keyword', () => { | ||
testFormatLine('for x in(1,2,3)', 'for x in (1, 2, 3)'); | ||
testFormatLine('assert(1,2,3)', 'assert (1, 2, 3)'); | ||
testFormatLine('if (True|False)and(False/True)not (! x )', 'if (True | False) and (False / True) not (!x)'); | ||
testFormatLine('while (True|False)', 'while (True | False)'); | ||
testFormatLine('yield(a%b)', 'yield (a % b)'); | ||
}); | ||
test('Dot operator', () => { | ||
testFormatLine('x.y', 'x.y'); | ||
testFormatLine('5 .y', '5.y'); | ||
//testFormatLine('- 135 .bit_length()', '-135.bit_length()'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any particular reason why this test is commented out? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am yet to get to #1784, quite an edge case. The |
||
}); | ||
test('Unknown tokens no space', () => { | ||
testFormatLine('abc\\n\\', 'abc\\n\\'); | ||
|
@@ -121,6 +127,32 @@ suite('Formatting - line formatter', () => { | |
test('from..x import', () => { | ||
testFormatLine('from..x import', 'from ..x import'); | ||
}); | ||
test('Raw strings', () => { | ||
testFormatLine('z=r""', 'z = r""'); | ||
testFormatLine('z=rf""', 'z = rf""'); | ||
testFormatLine('z=R""', 'z = R""'); | ||
testFormatLine('z=RF""', 'z = RF""'); | ||
}); | ||
test('Binary @', () => { | ||
testFormatLine('a@ b', 'a @ b'); | ||
}); | ||
test('Unary operators', () => { | ||
testFormatLine('x= - y', 'x = -y'); | ||
testFormatLine('x= + y', 'x = +y'); | ||
testFormatLine('x= ~ y', 'x = ~y'); | ||
testFormatLine('x=-1', 'x = -1'); | ||
testFormatLine('x= +1', 'x = +1'); | ||
testFormatLine('x= ~1 ', 'x = ~1'); | ||
}); | ||
test('Equals with type hints', () => { | ||
testFormatLine('def foo(x:int=3,x=100.)', 'def foo(x: int = 3, x=100.)'); | ||
}); | ||
test('Trailing comma', () => { | ||
testFormatLine('a, =[1]', 'a, = [1]'); | ||
}); | ||
test('if()', () => { | ||
testFormatLine('if(True) :', 'if (True):'); | ||
}); | ||
test('Grammar file', () => { | ||
const content = fs.readFileSync(grammarFile).toString('utf8'); | ||
const lines = content.splitLines({ trim: false, removeEmptyEntries: false }); | ||
|
This file contains 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 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
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.
Please add
await
as well (#1786 (comment)).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.
A complete list of keywords can be found using https://docs.python.org/3/library/keyword.html#keyword.kwlist
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.
This is list of those that may have
(
after them. Does not have to be complete.