Git Product home page Git Product logo

Comments (3)

dsifford avatar dsifford commented on August 19, 2024

Thanks for the report.

The issue here is that the grammar for php is non-discriminatory for regular expressions. If at any time it sees a string with / delimiters, it just assumes you're wanting to do a regex operation and the scope switches entirely.

The reason that Cobalt2 isn't affected is because they likely don't scope regular expressions at all. That's not an ideal solution here because in languages that have deep regular expression grammar baked in (e.g. javascript and typescript), the highlighting of the different groups really comes in handy.

The reason why some other themes are affected, but where the string is entirely a different color than what strings are normally supposed to be is because they likely scope regular expressions, but don't scope it down any further.

This theme has unique highlighting for every scope within a regular expression, which is why you're seeing red delimiters and yellow string-literals. Here's an example of that in typescript:

image

TL;DR: The fix would have to be made in the grammar. It cannot be made in the theme. Would you mind opening this issue here instead?

Thanks in advance!

from visual-studio-code.

onetrev avatar onetrev commented on August 19, 2024

Gotcha. I did figure it might be something out of your control, since it was hit and miss. Sorry.

Happy to post the issue elsewhere so this can be tackled. Only thing is the link you gave me is for Atom -> PHP. Can you confirm where best to post for VS Code PHP issues?

from visual-studio-code.

dsifford avatar dsifford commented on August 19, 2024

Oh, just realized you also were wondering why the first parsed as a normal string and the second did not..

That's because the first uses the delimiter character inside the "expression", so the regex scope match fails and it defaults back to string.

The second one has the delimiter character only on the outer edges of the string, so the regex scope passes.

More examples....

<?php

$not_regex_1 = '/some-dirname';
$not_regex_2 = 'some-other-dirname/';
$regex = '/i-am-now-regex/';

Gotcha. I did figure it might be something out of your control, since it was hit and miss. Sorry

No apology necessary! I'd prefer things like this to be reported and clarified, rather than not.

Only thing is the link you gave me is for Atom -> PHP. Can you confirm where best to post for VS Code PHP issues?

Yep, that's the right location. VSCode pulls the PHP grammar directly from Atom.

from visual-studio-code.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.