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

Editor uses VSCode and sees JS syntax highlighting and validation in on-change/on-open #1881

Closed
rjcorwin opened this issue Feb 9, 2020 · 4 comments

Comments

@rjcorwin
Copy link
Contributor

rjcorwin commented Feb 9, 2020

No description provided.

@rjcorwin
Copy link
Contributor Author

rjcorwin commented Feb 9, 2020

I've posted a question on stackoverflow how to this in a more sustainable way, but for the time being you can hack your VSCode installation by doing the following...

On Mac: Open the html.tmLanguage.json file in your Visual Studio Code's app folder.

code /Applications/Visual\ Studio\ Code.app/Contents/Resources/app/extensions/html/syntaxes/html.tmLanguage.json

Then search for "hashchange" and add |-change|-open right after it. The result will look like...

image

Now restart VS Code and voila!

In the future I hope it's an option that added when describing to VSCode the attributes of your custom elements. That way we could just have folks install the tangy-form plugin to add syntax highlighting. See discussion around VSCode support for custom elements here and docs for adding support for your custom elements here.

@mfinholt
Copy link
Member

mfinholt commented Feb 9, 2020

recommend that you add "|-change|-open|-submit" so that it also catches the on-submit functions

@rjcorwin
Copy link
Contributor Author

rjcorwin commented Feb 13, 2020

@mfinholt Good call! There are even more. Here are some updated directions.

Step 1

Open Visual Studio configuration file.

code /Applications/Visual\ Studio\ Code.app/Contents/Resources/app/extensions/html/syntaxes/html.tmLanguage.json

Step 2

Find on(s(c and replace with on-open|on-change|on-submit|skip-if|hide-if|dont-skip-if|disable-if|valid-if|discrepancy-if|warn-if|on(s(c.

Screen Shot 2020-02-13 at 11 58 59 AM

Step 3

Restart Visual Studio.

@rjcorwin
Copy link
Contributor Author

rjcorwin commented Sep 2, 2020

@rjcorwin rjcorwin closed this as completed Sep 2, 2020
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