Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add code action for E242 #176

Merged
merged 1 commit into from
Jun 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bundled/tool/lsp_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def code_action(params: lsp.CodeActionParams) -> List[lsp.CodeAction]:
return code_actions


@QUICK_FIXES.quick_fix(codes=["E241", "E271", "E273", "E274", "E275"])
@QUICK_FIXES.quick_fix(codes=["E241", "E242", "E271", "E273", "E274", "E275"])
def fix_format(
_document: workspace.Document, diagnostics: List[lsp.Diagnostic]
) -> List[lsp.CodeAction]:
Expand Down
16 changes: 12 additions & 4 deletions src/test/python_tests/test_code_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,24 @@
("code", "contents", "command"),
[
(
"E271",
"from collections import (namedtuple, defaultdict)",
"E241",
"x = [1, 2]",
{
"title": f"{LINTER}: Run document formatting",
"command": "editor.action.formatDocument",
},
),
(
"E241",
"x = [1, 2]",
"E242",
"a, b = 1, 2",
karthiknadig marked this conversation as resolved.
Show resolved Hide resolved
{
"title": f"{LINTER}: Run document formatting",
"command": "editor.action.formatDocument",
},
),
(
"E271",
"from collections import (namedtuple, defaultdict)",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rearranged in order

{
"title": f"{LINTER}: Run document formatting",
"command": "editor.action.formatDocument",
Expand Down