Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax seems to break at a certain point #3

Open
lichenophile opened this issue Jul 13, 2023 · 4 comments
Open

Syntax seems to break at a certain point #3

lichenophile opened this issue Jul 13, 2023 · 4 comments
Assignees

Comments

@lichenophile
Copy link

Cheers for this neat extension. I'm having some trouble though, I wonder if you could shed some light?

image

I appears that {} brakets are breaking the syntax coloring

@wfurphy
Copy link
Owner

wfurphy commented Oct 14, 2023

Hi @lichenophile,

I'm unable to replicate that issue here. Are you using VSCode or VSCode Server in HA? Also, do you have any other syntax highlighting plugins that may be causing a conflict?

@lichenophile
Copy link
Author

Hey

I'm using VSCode for windows using Remote SSH.

Using this plugin and HA Config Helper, disabled everything else related (aside from "built-in" features/languages)

I have more precisely noticed ', " or ` following a return wrapped text when within { and } to cause it, though I have noted some instances of code where it works

Simplified code that color breaks:

            state_display: >
              [[[
                if (variables.state === "playing") {
                  return 'Playing';
                }
              ]]]


Rubbish code that formats color correctly despite quotes/backticks:

A colon after the quotes, such as this style of statement (just the colon on its fixes color too)

                if (variables.state === 'playing') {
                  return 'Playing'
                    ? 
                    :  ;
                }
  • Removing quotes
            state_display: >
              [[[
                if (variables.state === 'playing') {
                  return Playing;
                }
              ]]]
  • any amount of = but not something such as !=
                  return ='Playing';
  • a number character
                  return 2`Playing`;

Figured out by breaking down at a few more complex templates that fit the criteria but didn't fail

No idea if this is actually useful info tbh, syntax highlighting (regex?) is a bit above my head

@wfurphy
Copy link
Owner

wfurphy commented Dec 15, 2023

That's very strange, I still can't replicate it on my local copy of the browser version in HA. the only thing I can think that may be causing this is Windows, I'll have to spin up a Virtual Machine and see if I can replicate the issue, I'll let you know what I find.

@wfurphy
Copy link
Owner

wfurphy commented Dec 15, 2023

@lichenophile Just out of interest could you try using >- instead of > proceeding your block string? It might be Windows line breaks causing the issue. Make sure you use semicolons ; at the end of lines strictly if you do this because it will strip out the line breaks from the javascript.

@wfurphy wfurphy self-assigned this Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants