-
Notifications
You must be signed in to change notification settings - Fork 12
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
Auto indent support #13
Comments
Have you found a solution to this yet? Installing this breaks many things that work with html syntax, including auto-indenting and emmet. I have to put these into my settings.json to have emmet working properly: {
"editor.tabCompletion": "on",
"editor.snippetSuggestions": "top"
} |
No but I've been playing around with an idea this morning. I'm thinking that I followed this guide on injecting grammars and was able to get some basic syntax highlighting happening with the following: {
"scopeName": "ss-template.injection",
"injectionSelector": "L:text.html",
"patterns": [
{
"include": "#ss-template-comment"
},
{
"include": "#ss-template-tag"
}
],
"repository": {
"ss-template-comment": {
"match": "<%--.*?--%>",
"name": "comment.sscomment"
},
"ss-template-tag": {
"match": "<%.*?%>",
"name": "keyword.sstag"
}
}
} Maybe exploring that approach, and associating |
@jonom Let me know if the latest update helps. |
Thanks for all your work @gorriecoe! It looks like auto indenting works but gets confused by SS tags. Might be partially a stylistic thing. Also, not sure if it would be related but VSCode doesn't appear to know how to format .ss files |
Its probably my regex pattern. I have updated it to this:
I would like to simplify this to As for the formatter, I'm not really sure. Could be your settings, as I changed the language name from uppercase to lowercase. However I kept uppercase as an alias. https://github.com/adrhumphreys/vscode-silverstripe/blob/master/package.json#L50-L54 |
So this feature works for you on I guess formatting might be too much to hope for since you can put SS tags anywhere... I can't imagine how you'd get perfect syntax highlighting or formatting when we can do things like this 😄 |
No that feature doesn't work for me. =( Was it previously? I can investigate further. For syntax highlighting its the same issue as #12 and is inherited from html. I can't figure out how to resolve this both via injection or include. Otherwise we would have to write an entire .ss syntax |
@gorriecoe no it wasn't working before either so no problem there. |
@jonom The latest update should have resolved the indentation of cache and uncached |
@gorriecoe seems to be working a lot better - thanks! I noticed that |
@jonom I would say its an issue with the closing tag being on the same line. The problem is a conflict of increase and decrease indention patterns. The increase of indent rule kicks in after the regex matches but the decrease before the regex match. If you try that with any html element this will occur. I have come across something similar and think I can fix this. Just a matter of checking and excluding any html closing tag that is on the same line from increasing its indentation. But yeah if you could confirm that is the issue that would be great. |
@gorriecoe interesting - if I change the heading tag to a div (still all on one line) you're right, the same problem happens. Oddly though, if I put the heading opening and closing tags on their own lines, the issue still happens, even though it doesn't happen for the same structure with a div. |
@jonom 5a034ca. The latest update should resolve both the h1 and sameline issues. I'll get @adrhumphreys to publish it soon =) |
Published 1.0.4 should have this fixed =) |
Legend! Thanks mate. |
Thanks for this extension! It seems to work pretty well although I'm finding some of the things I can do with an html file don't work with a SS file. One example is auto indent... I like it when VSCode indents my lines automatically when I move them around. It seems a definition could be added to this extension to make that work, here is the info: https://code.visualstudio.com/updates/v1_14#_auto-indent-on-type-move-lines-and-paste
I'm not really following what is going on there but maybe it means something to you. I guess the indent rules could be copied from the html definition?
The text was updated successfully, but these errors were encountered: