-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
[FilePreview] Use syntax highlighting for .srt
#35651
base: main
Are you sure you want to change the base?
Conversation
registerAdditionalLanguage("cppExt", [".ino", ".pde"], "cpp", monaco) | ||
registerAdditionalLanguage("xmlExt", [".wsdl", ".csproj", ".vcxproj", ".vbproj", ".fsproj"], "xml", monaco) | ||
registerAdditionalLanguage("txtExt", [".sln", ".log", ".vsconfig", ".env", ".srt"], "txt", monaco) | ||
registerAdditionalLanguage("razorExt", [".razor"], "razor", monaco) | ||
registerAdditionalLanguage("vbExt", [".vbs"], "vb", monaco) | ||
registerAdditionalLanguage("iniExt", [".inf", ".gitconfig", ".gitattributes", ".editorconfig"], "ini", monaco) | ||
registerAdditionalLanguage("shellExt", [".ksh", ".zsh", ".bsh"], "shell", monaco) | ||
registerAdditionalNewLanguage("reg", [".reg"], regDefinition(), monaco) | ||
registerAdditionalNewLanguage("gitignore", [".gitignore"], gitignoreDefinition(), monaco) | ||
registerAdditionalLanguage("cppExt", [".ino", ".pde"], "cpp", monaco); | ||
registerAdditionalLanguage("xmlExt", [".wsdl", ".csproj", ".vcxproj", ".vbproj", ".fsproj"], "xml", monaco); | ||
registerAdditionalLanguage("txtExt", [".sln", ".log", ".vsconfig", ".env"], "txt", monaco); | ||
registerAdditionalLanguage("razorExt", [".razor"], "razor", monaco); | ||
registerAdditionalLanguage("vbExt", [".vbs"], "vb", monaco); | ||
registerAdditionalLanguage("iniExt", [".inf", ".gitconfig", ".gitattributes", ".editorconfig"], "ini", monaco); | ||
registerAdditionalLanguage("shellExt", [".ksh", ".zsh", ".bsh"], "shell", monaco); | ||
registerAdditionalNewLanguage("reg", [".reg"], regDefinition(), monaco); | ||
registerAdditionalNewLanguage("gitignore", [".gitignore"], gitignoreDefinition(), monaco); | ||
registerAdditionalNewLanguage("srt", [".srt"], srtDefinition(), monaco); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why all of the are changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know, I don't see any changes there. Maybe it's just git being weird?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh no, sorry, I see it now. There are semicolons added to each line. I guess I hit format and it added them without me noticing. But I guess we can keep that in, right? After all, they're supposed to be there.
{token: 'string.bold', fontStyle: 'bold'}, | ||
{token: 'string.emphasis', fontStyle: 'italic'}, | ||
{token: 'string.underline', fontStyle: 'underline'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we need combined styles for the nested formats? Or is this to complicated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes we would for proper nesting, however as far as I know there isn't any nice way to do that, we would need a separate state for every possible combination (bold, italic, underline, bold-italic, bold-underline, italic-underline and so on...) and not even VSCode does that for Markdown, so I think that it's unnecessary.
The tags are styled, so even if you have something like <b><i>text</i></b>
you can see both bold and italic.
What color? Can we instead color it white? Then it is more clear what is used as sub title.
|
You might look at this: This page contains additional sytax that you currently not support in your PR. Edited at 30. October 2024 00:08 AM. |
Yes, it does contain the following syntax that I don't support:
I'm aware of this, but I have decided not to support these features for a reason:
|
I am working on this |
You know the test page? |
Yeah, I do, that's where I did most of my testing. Thanks for making sure |
Wondering if we should format in the text only the tags instead of memic the format. This would help with the font tag problem. We could use a lighter color or make it italic. Then you can see that it is a valid tag or not. |
Summary of the Pull Request
Adds syntax highlighting to
.srt
preview (Peek and Preview Pane).PR Checklist
.srt
#35152Detailed Description of the Pull Request / Additional comments
srt
fromtxtExt
and registers it as a new languagecustomTokenColors
tocustomTokenThemeRules
number
tag
string
Assumes that all format tags are closed (if not, the rest of that subtitle block is in that format)Correction: that's the intended behaviorHH:mm:ss,mmm
format are considered valid, even though something like00:123:01,1234 --> 00:00:02,000
is technically valid and would get interpreted as02:03:02,234 --> 1193:02:49,296
(I have no idea what's going on)Screenshot:
Validation Steps Performed
Tested previewing srt files with Peek and Preview Pane. Monarch definition tested for edge cases.