Skip to content

Commit

Permalink
Add code action for E242 (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyoto7250 committed Jun 30, 2023
1 parent f54d9cc commit 7637c71
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
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",
{
"title": f"{LINTER}: Run document formatting",
"command": "editor.action.formatDocument",
},
),
(
"E271",
"from collections import (namedtuple, defaultdict)",
{
"title": f"{LINTER}: Run document formatting",
"command": "editor.action.formatDocument",
Expand Down

0 comments on commit 7637c71

Please sign in to comment.