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

Causes PHP Syntax Highlighting Issue #1988

Closed
westc opened this issue Feb 14, 2020 · 11 comments
Closed

Causes PHP Syntax Highlighting Issue #1988

westc opened this issue Feb 14, 2020 · 11 comments

Comments

@westc
Copy link

westc commented Feb 14, 2020

Summary

When this extension is enabled in Visual Studio Code the native syntax highlighting for PHP doesn't highlight other embedded languages (HTML, CSS and JavaScript) as expected.

Steps To Reproduce:

  1. Enable this extension.
  2. Create a new file tab.
  3. Set the language to PHP.
  4. Enter the following code:
    <?php if (true): ?>
      <div>Hello world!!!</div>
      <script type="text/javascript">
      var x = 3;
      document.write(x);
      </script>
      <style type="text/css">
      div {
        color: #00F;
      }
      </style>
    <?php endif; ?>

Expected result

All of the code will be syntax highlighted depending on the language:
image

Actual result

The PHP code will be highlighted as PHP but the inline HTML, CSS and JS will not be highlighted:
image

Additional information

VS Code Version: 1.42.1

SFDX CLI Version: sfdx-cli/7.36.0-b1c4e9c7c8 darwin-x64 node-v10.15.3

OS and version: macOS Mojave 10.14.6

OS According to VS Code: Darwin x64 18.7.0

@lcampos
Copy link
Contributor

lcampos commented Mar 12, 2020

Thanks for reporting this @westc , we've made changes in release 48.6.0 to make sure the extensions are only active in Salesforce projects which will take care of this.

@xyc
Copy link
Contributor

xyc commented Apr 23, 2020

Looks like this is related to html language contribution. While "Aura Components" extension is enabled (even if not activated) this issue would present. @mysticflute @nrkruk could we continue conversation here WRT modification for aura support?

@ntotten
Copy link
Contributor

ntotten commented Apr 24, 2020

@lcampos Is it even possible to disable the language contribution of an extension without deactivating it entirely?

@jeffb-sfdc
Copy link
Contributor

I'm still able to reproduce this.

@uip-robot-zz
Copy link

This issue has been linked to a new work item: W-10934996

@michaelsoriano
Copy link

This is still happening. Messing up HTML color syntax in PHP files.

I'm using VSCode 1.72 + SF Extension Pack v v55.8.0.
It immediately gets fixed as soon as I disable the SF Extension pack. Shouldn't it disable automatically in non SF projects? Or is there a setting I have to turn on?

@randi274
Copy link
Contributor

Hi @michaelsoriano just to check for your case as well - is this happening in unsaved php files, or files that are saved with the .php extension?

@michaelsoriano
Copy link

Hi @randi274 - its both. For saved .php files and new files (no extension). Here's a screenshot of both side by side:

image

@randi274
Copy link
Contributor

Screen Shot 2022-10-31 at 12 24 02 PM

@michaelsoriano we actually do have a setting for this! It's possible it's not being respected now, but we would recommend using "Autodetect" in your case, or using "off" definitively should stop the LWC and Aura Language Servers from activating.

@michaelsoriano
Copy link

@randi274 thank you. I checked the settings and "autodetect" is already on.

image

I've learned to just manually "disable" the entire extension pack in PHP projects.

@gbockus-sf
Copy link
Contributor

PR merged. Will be included with next release #5159

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests