Describe the bug
After editing variable or keyword names in a .robot file, subsequent formatting by RobotCode fails to realign columns based on the current maximum identifier width. This results in misaligned variables in *** Variables *** and keywords in *** Keywords ***. The issue persists until "RobotCode: Reload Workspace" is manually triggered, indicating a caching or incremental update bug in the language server.
Steps To Reproduce
Steps to reproduce the behavior:
- Create a new .robot file with long-named variables and keywords.
- Save and format the file (initial formatting works correctly).
- Edit the file by either:
- Replacing a long variable name (e.g., ${very_long_variable_name}) with a short one (e.g., ${x}), or
- Renaming a long keyword (e.g., ThisIsAVeryLongKeywordName) to a short one (e.g., ShortKW).
- Save the file again (with formatOnSave enabled) or manually trigger format.
- Observe that the newly edited line is no longer aligned with other entries in the same section.
If possible add some example source code like:
*** Settings ***
Library Collections
*** Variables ***
${tmp_01} ${EMPTY}
${tmp_02_02} ${EMPTY}
${tmp_03_03_03} ${EMPTY}
${tmp_04_04_04_04} ${EMPTY}
*** Keywords ***
VeryLongKeywordName [Arguments] ${arg1} ${arg2}
AnotherVeryLongKW [Arguments] ${x} ${y}
add new ${short} and reformatting:
*** Variables ***
${tmp_01} ${EMPTY}
${tmp_02_02} ${EMPTY}
${tmp_03_03_03} ${EMPTY}
${tmp_04_04_04_04} ${EMPTY}
${short} ${EMPTY} # ← Misaligned!
Expected behavior
Formatting should always recompute alignment based on the current content of the section. All variables/keywords in the same block should align to the same column, determined by the longest identifier after edits.
Screenshots/ Videos
None
Logs
None
Additional context
- Running “RobotCode: Reload Workspace” immediately fixes the alignment, confirming the problem is due to stale internal state/cache in the LSP.
- Formatting works correctly on first open; only breaks after incremental edits.
- VS Code setting explicitly uses RobotCode as formatter:
"[robotframework]": {
"files.eol": "\n",
"editor.defaultFormatter": "d-biehl.robotcode",
"editor.formatOnSave": true,
},
"robotcode.robocop.enabled": false,
Desktop (please complete the following information):
-
VS Code Version
version: 1.119.1 (user setup)
Commit: 974500e64f0d1cfdf7c9821a2a51c2cb3bf0e561
-
RobotCode Version: 2.5.1
-
OS: Windows
-
Python Version: 3.14.3
-
RobotFramework Version : 7.4.2
-
robotframework-robocop 8.2.8 (but not used for formatting)
Describe the bug
After editing variable or keyword names in a .robot file, subsequent formatting by RobotCode fails to realign columns based on the current maximum identifier width. This results in misaligned variables in *** Variables *** and keywords in *** Keywords ***. The issue persists until "RobotCode: Reload Workspace" is manually triggered, indicating a caching or incremental update bug in the language server.
Steps To Reproduce
Steps to reproduce the behavior:
If possible add some example source code like:
add new ${short} and reformatting:
Expected behavior
Formatting should always recompute alignment based on the current content of the section. All variables/keywords in the same block should align to the same column, determined by the longest identifier after edits.
Screenshots/ Videos
None
Logs
None
Additional context
Desktop (please complete the following information):
VS Code Version
version: 1.119.1 (user setup)
Commit: 974500e64f0d1cfdf7c9821a2a51c2cb3bf0e561
RobotCode Version: 2.5.1
OS: Windows
Python Version: 3.14.3
RobotFramework Version : 7.4.2
robotframework-robocop 8.2.8 (but not used for formatting)