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

[coffeescript] syntax highlighting broken when divide symbol is not separated using space #499

Closed
vedanshujain opened this issue Nov 23, 2015 · 11 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug languages-basic Basic language support issues verified Verification succeeded
Milestone

Comments

@vedanshujain
Copy link

screen shot 2015-11-23 at 8 16 36 pm

@aeschli
Copy link
Contributor

aeschli commented Nov 24, 2015

We use the text mate grammar from https://github.com/textmate/coffee-script.tmbundle

@aeschli aeschli changed the title Coffeescript syntax highlighting broken when divide symbol is not separated using space [coffeescript] syntax highlighting broken when divide symbol is not separated using space Nov 24, 2015
@aeschli aeschli added bug Issue identified by VS Code Team member as probable bug help wanted Issues identified as good community contribution opportunities labels Nov 25, 2015
@egamma egamma added the languages-basic Basic language support issues label Nov 30, 2015
@aeschli
Copy link
Contributor

aeschli commented Dec 9, 2015

This issue was moved to textmate/coffee-script.tmbundle#8

@aeschli aeschli closed this as completed Dec 9, 2015
@aeschli aeschli reopened this Dec 9, 2015
@aeschli aeschli added upstream Issue identified as 'upstream' component related (exists outside of VS Code) and removed help wanted Issues identified as good community contribution opportunities labels Dec 9, 2015
@egamma egamma modified the milestone: Backlog Dec 10, 2015
@crisward
Copy link

I can confirm, using the same textmate bundle in sublime works, so this must have something to do with vscode.

@aeschli aeschli removed the upstream Issue identified as 'upstream' component related (exists outside of VS Code) label Feb 22, 2016
@almarklein
Copy link

Hooray!

@vedanshujain
Copy link
Author

Hey,
minor thing... this is still breaking at one point in my project which reduces to
screen shot 2016-04-12 at 2 00 51 am

@aeschli
Copy link
Contributor

aeschli commented Apr 12, 2016

Yes, I know. The '/' character is both used for division and the start of a regex. I can try to do some more tricks but from what I understand, only a context sensitive parser can get it 100% right.

@vedanshujain
Copy link
Author

Can we at least change it to match only one line.. regexp with single '/' will always be in single line as opposed to a regexp block

@aeschli
Copy link
Contributor

aeschli commented Apr 12, 2016

We process line by line, so the lookahead can only match on the current line. Did I miss anything?

@vedanshujain
Copy link
Author

Yeah lookahead will only match the current line, however tokeniser definition currently have begin and end block which matches multiple line, as opposed to match block which block single line (see my change for reference). Now this will not solve the problem I commented above, however it will keep the erroneous colorising only to that line instead of expanding it to all the lines below it until it finds an /

For egs:
currently if we have

a = b/c + d/e
someOtherStuff

The text someOtherStuff will also be incorrectly coloured in current case. However, since regexp starting with / would always be single liner, we can change the tokeniser definition to user match instead of begin and end block which prevent incorrect colouring in someOtherStuff even though d/e is coloured incorrectly. Let me know if I have not explained clearly...

@aeschli
Copy link
Contributor

aeschli commented Apr 13, 2016

@vedanshujain Thanks for the explanation. I understand. To make sure we won't match on multiple lines, I added the look ahead to the begin pattern.
The patterns are matched only against a single line, not the full content. So unless we don't see the regex on the same line, the rule will never be entered.
I improved the lookahead so now also your example works.

@lelandcope
Copy link

Is this fixed because I am having this issue on version 1.7.1 (macOS Sierra) where my multiline comments aren't working properly.

image

@aeschli aeschli added this to the April 2016 milestone Nov 9, 2016
@aeschli aeschli removed this from the Backlog milestone Nov 9, 2016
@ramya-rao-a ramya-rao-a added the verified Verification succeeded label Jun 5, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug languages-basic Basic language support issues verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants