-
Notifications
You must be signed in to change notification settings - Fork 6
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
Some changes to work better with Visual Studio 2019 plus TODO highlighting #2
Comments
Today I saw, that |
Thanks for the changes @zledas! I'm sorry it took so long to respond, I completely missed this issue. I won't be able to use your patch as-is, since, as you pointed out, the source of truth is the YAML. But, if changing I'll have a look at the TODO changes, but a lot of corner cases can't be matched with the Textmate Grammar. So not handling these cases might be perfectly okay. |
Thanks for responding. Yes, And it would be perfect if at least main cases of TODO highlighting would be available as well :) |
I've resumed working on the grammar and made significant progress. There were a lot of other issues, beyond the line-ending thing. Would you be able to try the latest version and tell me if you still encounter the same issues? (If you do, it would be nice to have a sample of the breaking code, so that I can write a text case against it!) Thanks a lot for your help! |
Tested new version – it works! :) Didn't find any breakages, but our formatting is quite strict, so not much variation. On the other hand, variables and function calls are still not coloured. From what I see, |
Awesome!
Of course, I missed it during the refactoring. I'll add the scopes right away. |
0.2.2 is out with the scope extensions. Let me know if it works or if I missed something else! |
Tested it – extended variable scopes work great. BUT I found another problem. I think this did not work before as well. Attaching screenshot and repro case (repro.ink.txt). AND while writing this report I noticed that |
I'm happy to hear that! Thanks for providing an example, I'm unable to reproduce the problem with the latest grammar, sadly (attached here, in case I messed up the release: Ink.tmLanguage.zip). I tested with Textmate 2, SublimeText and VS Code, see below.
You're right, it should be coloured. But I'm assuming it's related to the other issue. Which editor are you using? |
Thanks for checking it out. I am using Visual Studio 2019 (Community edition). What I just noticed is that |
Ahhh, dammit... Turns out that when I first checked So line break problem still exists. Basically all So I have to change such (and similar) places: |
It's really strange that Visual Studio doesn't behave like other editors. I replaced most Here's the latest version, can you give it a try and let me know how it goes? |
Yes, it was very strange to me as well. On the other hand, I found one not handled
|
All good!
It's fine, thanks for providing an example, I'll have a look. |
0.2.3 should fix the issue. 🙂 |
All good, we all spend 30% of our time fightings tools, 60% of our time wondering why things don't work and 10% actually coding. 😄
Probably not, can you provide a gist? Seems that they might get eaten by something else.
That one is an oversight, I forgot tags could be chained. It's easy to fix! I also noticed the Note that
Ouch. I'm okay with some things not being highlighted properly, but NOT when it breaks the next lines. Looking at the source, I think the regex for strings is wrong actually. Maybe Visual Studio is stricter than other editors and it's actually a good thing. I'll update the regex, let me know if you see a difference.
Yeah they should but I'd tend to believe it's the same issue you had with variables. Your current theme might highlight neither The naming conventions give a lot of room for interpretation, so it's always a bit tricky to find the right scopes.
Nah, don't, you've been super helpful! Visual Studio might have its quirks, but it helped me uncover a lot of small issues in the grammar. I'm happy to fix if you're happy to test! I'll push a new grammar soon. |
Sorry, can't find enough time to check it this week... Will try to do it next. |
No worries, I'll be working a bit in Visual Studio on Windows in the near future, so I'm going to do a full sweep and try to fix as many issues as I can see! |
So, I had a look with Visual Studio. The good news is that it's definitely got a stricter engine and that's a good thing. I fixed most parsing issues (I think), the remaining ones have to do with expressions. It's notable with list declarations, for instance, where syntax highlighting breaks. I'll fix that in the future. The bad news is that while Visual Studio does detect the scopes properly, the default theme chooses to not highlight them most of the time. I double checked and it's in line with how C# is highlighted by defaults. For instance variables and functions are not highlighted when they are invoked (hence the need to use I'm trying to find a middle ground that is semantically accurate (I've already removed some of the crazy scopes I previously added). I'm not opposed to create a custom version for Visual Studio but I think providing custom tmThemes or customising the Visual Studio editor theme would be a better option. For instance, I noticed that changing the color of Identifier would change the color of tokens matched by |
This is great news (at least for me :) ) that you are able to test with Visual Studio! Yeah, highlighting in VS looks complicated. I could not find a good way to customise only for .ink files (might be my problem not finding, but I think it is not possible). To my mind, it is best to prepare a theme that looks good with defaults, but I totally understand your reasoning about semantic accuracy! And sorry once more – I was hoping to have some time this week, but looks like I won't, and not sure if I'll be able to find enough time next week as well. |
Yeah, that's my understanding as well after fiddling with the editor. The default theming capabilities apply to all languages (and are a bit weird IMO, it looks like they deal with a ton of legacy there). Identifer matches basically everything in a C# file, so it's not ideal to change its default color. Good thing though, is that as far as I understand, Visual Studio as a strict number of configuration variables for the theme. So side effects are limited, it's not as wild as TextMate scopes! I've added override capabilities in the build system. Meaning that I can now output a VS-only version without too much hassle and without cluttering the base grammar! The current version in "variable.other.ink" -> "entity.name.variable.other.ink"
"variable.function.ink" -> "entity.name.function.ink" I'm going to fix the remaining matching issues and test it with Visual Studio over the next few days, but I should have something by the end of the week.
All good, we're not in a hurry! |
Hello,
I tried to use it with Visual Studio 2019, but there were some problems. The main one, is that VS2019 somehow reads to the end of the line AND consumes line ending if
\s*
is used. So next line is not highlighted properly. So I changed\s*
to[^\S\n\r]*
in many places where it was used to read till the end of line.Also I changed
variable.other.XXX
(and similar) toentity.name.variable.other.XXX
so it gets coloured.What is more, I added
TODO
highlighting, but I am not sure if I inserted it in all the needed places.I am attaching .patch file with my changes, if that would help: changes.txt
P. S. I edited xml directly, so don't have YAML for these changes...
The text was updated successfully, but these errors were encountered: