Skip to content

Commit 1d5d716

Browse files
committed
Fix dump config CLI command and add textual representation of dumped config
1 parent d250566 commit 1d5d716

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

finecode_extension_api/src/finecode_extension_api/actions/dump_config.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import pathlib
33
import sys
44
import typing
5+
import pprint
56

67
if sys.version_info >= (3, 12):
78
from typing import override
@@ -46,7 +47,8 @@ def update(self, other: code_action.RunActionResult) -> None:
4647
self.config_dump = other.config_dump
4748

4849
def to_text(self) -> str | textstyler.StyledText:
49-
return ""
50+
formatted_dump_str = pprint.pformat(self.config_dump)
51+
return formatted_dump_str
5052

5153

5254
class DumpConfigAction(code_action.Action):

src/finecode/cli_app/dump_config.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from loguru import logger
55

66
from finecode import context, services
7-
from finecode.config import read_configs
7+
from finecode.config import read_configs, config_models
88
from finecode.runner import manager as runner_manager
99

1010

@@ -27,6 +27,19 @@ async def dump_config(workdir_path: pathlib.Path, project_name: str):
2727
for project_dir_path, project in ws_context.ws_projects.items()
2828
if project.name == project_name
2929
}
30+
31+
# read configs without presets, this is required to be able to start runners in
32+
# the next step
33+
for project in ws_context.ws_projects.values():
34+
try:
35+
await read_configs.read_project_config(
36+
project=project, ws_context=ws_context, resolve_presets=False
37+
)
38+
except config_models.ConfigurationError as exception:
39+
raise DumpFailed(
40+
f"Reading project configs(without presets) in {project.dir_path} failed: {exception.message}"
41+
)
42+
3043

3144
# start runner to init project config
3245
try:

0 commit comments

Comments
 (0)