Skip to content

Commit 842e181

Browse files
committed
Make IDE lint configurable: lint opened files or whole project
1 parent d68a961 commit 842e181

File tree

1 file changed

+8
-2
lines changed
  • finecode_builtin_handlers/src/finecode_builtin_handlers

1 file changed

+8
-2
lines changed

finecode_builtin_handlers/src/finecode_builtin_handlers/lint.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99

1010

1111
@dataclasses.dataclass
12-
class LintHandlerConfig(code_action.ActionHandlerConfig): ...
12+
class LintHandlerConfig(code_action.ActionHandlerConfig):
13+
lint_opened_files_only_in_ide: bool = True
14+
"""When True (default), background IDE lints triggered automatically only lint
15+
currently opened files for performance. Set to False to always lint the full project."""
1316

1417

1518
class LintHandler(
@@ -19,10 +22,12 @@ class LintHandler(
1922
):
2023
def __init__(
2124
self,
25+
config: LintHandlerConfig,
2226
action_runner: iactionrunner.IActionRunner,
2327
logger: ilogger.ILogger,
2428
file_editor: ifileeditor.IFileEditor,
2529
) -> None:
30+
self.config = config
2631
self.action_runner = action_runner
2732
self.file_editor = file_editor
2833
self.logger = logger
@@ -37,7 +42,8 @@ async def run(
3742

3843
if payload.target == lint_action.LintTarget.PROJECT:
3944
if (
40-
run_meta.dev_env == code_action.DevEnv.IDE
45+
self.config.lint_opened_files_only_in_ide
46+
and run_meta.dev_env == code_action.DevEnv.IDE
4147
and run_meta.trigger == code_action.RunActionTrigger.SYSTEM
4248
):
4349
# Performance optimisation: when the IDE triggers a background project

0 commit comments

Comments
 (0)