Improve line ending configuration

* Keep unset in project.yml by default (only explicit override)
* Fix member docstrings and member grouping in SerenaConfig
* Fix missing migration in SerenaConfig (ensure setting is saved)
This commit is contained in:
Dominik Jain authored and Dominik Jain committed 2026-03-09 23:20:45 +01:00
1 parent d6a832b5d9
commit 6bf71ef10b
4 files changed
+20 -13

No files matched your search

+4
View File
@@ -146,3 +146,7 @@ language_backend:
# list of regex patterns which, when matched, mark a memory entry as read‑only.
# Extends the list from the global configuration, merging the two lists.
read_only_memory_patterns: []
# line ending convention for file writes: unset (use global setting, "lf", "crlf", or "native" (platform default)
# If not undefined, overrides the global setting in serena_config.yml
line_ending:
+9 -9
View File
@@ -591,11 +591,6 @@ class SerenaConfig(SharedConfig):
jetbrains_plugin_server_address: str = "127.0.0.1"
tool_timeout: float = DEFAULT_TOOL_TIMEOUT
language_backend: LanguageBackend = LanguageBackend.LSP
"""
the language backend to use for code understanding features
"""
token_count_estimator: str = RegisteredTokenCountEstimator.CHAR_COUNT.name
"""Only relevant if `record_tool_usage` is True; the name of the token count estimator to use for tool usage statistics.
See the `RegisteredTokenCountEstimator` enum for available options.
@@ -628,9 +623,13 @@ class SerenaConfig(SharedConfig):
"""
# settings with overridden defaults
language_backend: LanguageBackend = LanguageBackend.LSP
"""
the language backend to use for code understanding features
"""
default_modes: Sequence[str] | None = ("interactive", "editing")
symbol_info_budget: float = 10.0
line_ending: LineEnding = LineEnding.NATIVE
symbol_info_budget: float = 10.0
"""
Time budget (seconds) for requests when tools request include_info (currently
only supported for LSP-based tools).
@@ -783,11 +782,12 @@ class SerenaConfig(SharedConfig):
instance.language_backend = language_backend
# determine line ending
line_ending = get_dataclass_default(SerenaConfig, "line_ending")
line_ending_value = loaded_commented_yaml.get("line_ending")
if line_ending_value:
line_ending = LineEnding.from_str(line_ending_value)
instance.line_ending = line_ending
instance.line_ending = LineEnding.from_str(line_ending_value)
else:
num_migrations += 1
instance.line_ending = get_dataclass_default(SerenaConfig, "line_ending")
# migrate deprecated "gui_log_level" field if necessary
if "gui_log_level" in loaded_commented_yaml:
+4 -2
View File
@@ -31,8 +31,10 @@ languages: ["python"]
# For a list of possible encodings, see https://docs.python.org/3.11/library/codecs.html#standard-encodings
encoding: "utf-8"
# line ending convention for file writes: "lf", "crlf", or "native" (platform default)
line_ending: "native"
# line ending convention to use when writing source files.
# Possible values: unset (use global setting), "lf", "crlf", or "native" (platform default)
# This does not affect Serena's own files (e.g. memories and configuration files), which always use native line endings.
line_ending:
# The language backend to use for this project.
# If not set, the global setting from serena_config.yml is used.
@@ -7,9 +7,10 @@
# in your IDE).
language_backend: LSP
# line ending convention for file writes across all projects.
# line ending convention to use when writing source files.
# Possible values: "lf" (Unix), "crlf" (Windows), "native" (platform default).
# Can be overridden per project in project.yml.
# Note that Serena's own files (e.g. memories and configuration files) always use native line endings.
# This setting can be overridden on a per-project basis in project.yml files.
line_ending: native
# whether to open a graphical window with Serena's logs.