frontend icon indicating copy to clipboard operation
frontend copied to clipboard

Escaping of ' is missing in the Developer tools, leading to wrong syntax highlighting

Open RubenKelevra opened this issue 2 years ago • 3 comments

Checklist

  • [X] I have updated to the latest available Home Assistant version.
  • [X] I have cleared the cache of my browser.
  • [X] I have tried a different browser to see if it is related to my browser.

Describe the issue you are experiencing

This minor bug affects the proper syntax highlighting of entries in Set State's "State attributes"-view.

If a friendly name contains a ' (this friendly name was created by the official HA android app) it isn't properly escaped and thus will mess up the syntax highlighting in this view.

Escaping missing on set_status

Describe the behavior you expected

Escaping with "" at the beginning/end of the string to get proper syntax highlighting

Steps to reproduce the issue

  1. open developer tools
  2. select an entry with a friendly name containing an '
  3. observe wrong syntax highlighting

What version of Home Assistant Core has the issue?

core-2022.2.2

What was the last working version of Home Assistant Core?

unknown

In which browser are you experiencing the issue with?

Chromium: 98.0.4758.87 / Firefox 95.0.2

Which operating system are you using to run this browser?

Windows 11

State of relevant entities

No response

Problem-relevant frontend configuration

No response

Javascript errors shown in your browser console/inspector

No response

Additional information

No response

RubenKelevra avatar Feb 06 '22 12:02 RubenKelevra

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar May 07 '22 13:05 github-actions[bot]

This is still an issue in 2022.5.

bdr99 avatar May 09 '22 01:05 bdr99

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Aug 11 '22 21:08 github-actions[bot]

Still an issue in 2022.8.

bdr99 avatar Aug 12 '22 15:08 bdr99

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Nov 13 '22 17:11 github-actions[bot]

This should not have been closed, the problem still exists in 2022.11. Can this issue be reopened?

bdr99 avatar Nov 20 '22 21:11 bdr99

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Feb 16 '24 03:02 github-actions[bot]

Still an issue in 2024.2.1.

bdr99 avatar Feb 16 '24 03:02 bdr99

~I think this is something that would need to be fixed in codemirror, looks like if I just play with their examples this is their behavior.~

~If you're interested maybe you can open an issue in their repo and link it back here. https://codemirror.net/~

Hmm actually I can't tell for certain. It might be that we're not correctly setting up the yaml language, but I can't figure it out. If I setup a yaml language parser in their examples it doesn't seem to suffer this problem.

karwosts avatar Feb 16 '24 18:02 karwosts

Yeah, I also noticed that their examples doesn't have this problem. That's why I think it might be an HA bug.

For future reference, this is how I tested it:

  1. Go to https://codemirror.net/try/
  2. Enter this code on the left side:
import { basicSetup, EditorView } from "codemirror";
import { yaml } from "@codemirror/lang-yaml";

new EditorView({
  doc: "key: value'value'",
  extensions: [basicSetup, yaml()],
  parent: document.body
});
  1. Click "Run"
  2. Observe result (syntax highlighting works correctly): image

bdr99 avatar Feb 16 '24 20:02 bdr99