robotcode icon indicating copy to clipboard operation
robotcode copied to clipboard

[BUG] Request textDocument/formatting failed

Open Abe210 opened this issue 7 months ago • 3 comments

Describe the bug I don't know if this bug/issue is related to RobotCode or the underlying robotidy/robocop used. In my case, I use both robocop and robotidy, here is my pyproject.toml:

[tool.poetry]
name = "...."
version = "...."
description = "...."
authors = []
readme = "README.md"
package-mode = false

[tool.poetry.dependencies]
python = "^3.10"
robotframework = "^7.3.2"
robotframework-browser = "^19.6.1"
robotframework-requests = "^0.9.7"
robotframework-pabot = "^4.2.0"
robotframework-robocop = "^5.5.0"
robotframework-tidy = "^4.14.0"
robotframework-debugger = "^0.2.1"
playwright = "^1.53.0"


[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"


[tool.robocop]
configure = [
    "line-too-long:line_length:180",
    "too-long-keyword:max_len:80",
    "too-many-arguments:max_args:10",
    "too-many-calls-in-keyword:max_calls:20",
    "file-too-long:max_lines:800",
]
exclude = [
    "no-global-variable",
]

[tool.robotidy]
spacecount = 4
indent = 4
continuation-indent = 4
line_length = 180
separator = "space"
diff = false
overwrite = true
verbose = false
configure = [
    "AddMissingEnd:enabled=True",
]

Whenever there is an emoji or icon (usually added by copilot), the reformat document seems to break. Error message: Robotcode Request textDocument/formatting failed.Message: 'utf-8' codec can't encode character '\udd00' in position 3102: surrogates not allowed

Steps To Reproduce Steps to reproduce the behavior:

  1. Add � inside any .robot or .resource
  2. Enable format document on save in Vscode
  3. Save the document with the icon
  4. See error

If possible add some example source code like:

***Test Cases***
a simple test
    Log    �  Something    # this should show the icon the logs

Expected behavior The format document to work without any errors.

Desktop (please complete the following information):

  • VS Code Version: Visual Studio Code - Insiders v1.103.0-insider
  • RobotCode Version: 1.5.0
  • OS: Windows
  • Python Version: 3.12.4
  • RobotFramework Version: 7.3.2
  • Additional tools like robocop, robotidy: please look at the pyproject.toml provided

Abe210 avatar Jul 23 '25 23:07 Abe210