-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
PHP syntax highlighting without <?php #14166
Comments
I would like to remove the |
@felixfbecker started looking into this. Quick question, regarding your first bullet point - just to confirm - are you actually getting syntax highlighting for php blocks in the markdown editor (not preview)? Because even when I add |
@mousetraps Yes, correct. The markdown preview is not affected. Thanks for looking into this |
@felixfbecker, @mousetraps There's another bug tracking php syntax highlighting not working at all in markdown files: #3746 I do not know what is different about the php here. We do properly recognize the fenced code block as a php fenced code block, but the language highlighter never seems to kick in. |
@mousetraps Removing this from January. |
This issue is being closed to keep the number of issues in our inbox on a manageable level, we are closing issues that are not going to be addressed in the foreseeable future: We look at the number of votes the issue has received and the number of duplicate issues filed. More details here. If you disagree and feel that this issue is crucial: We are happy to listen and to reconsider. If you wonder what we are up to, please see our roadmap and issue reporting guidelines. Thanks for your understanding and happy coding! |
I do disagree. Guess I’ll just remove the tag then since no other client has this problem. |
I understand the argument but I don't know that it's likely to change soon. @aeschli can you help me decide whether this fits into any planned work we have? |
I also understand the argument. But it looks like markdown worked around this as I see this working. I think it's ok to close, unless there are other issues blocked by this. |
Forgive me, as I haven’t looked at the codebase in a while. But not sure I follow. Markdown works around this, but it also has different constraints. In particular... markdown and editor syntax highlighting are more decoupled between Lang server clients than the hover provider is.
Expected behavior is as follows.
* For markdown and for hovers... It’s good to be fuzzy because most use cases are about highlighting code snippets - it is assumed that context is lacking.
* In the case of the editor, it’s not okay to be fuzzy because in most cases you have full context.
Perhaps another option is adding a property to the tmlanguage that includes a reference key for “contextless” scenarios. If the reference key exists, the hover provider can use that. Otherwise default to existing behavior.
if I recall correctly this is similar to how we worked around it in markdown - I believe I specified “php#language” or something like it.
…Sent from my Rotary Phone
________________________________
From: Martin Aeschlimann <notifications@github.com>
Sent: Wednesday, September 12, 2018 11:51 PM
To: Microsoft/vscode
Cc: Sara Itani; Mention
Subject: Re: [Microsoft/vscode] PHP syntax highlighting without
I also understand the argument. But it looks like markdown worked around this as I see this working. I think it's ok to close, unless there are other issues blocked by this.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgh.neting.cc%2FMicrosoft%2Fvscode%2Fissues%2F14166%23issuecomment-420902480&data=02%7C01%7C%7Ca7ffbfc59dd346cffb8208d619455633%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636724182921715114&sdata=FPGrMu3BVH6IScf92QWsj5VOARkGULk2RJHxJC26PXE%3D&reserved=0>, or mute the thread<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgh.neting.cc%2Fnotifications%2Funsubscribe-auth%2FAAuj4JMpqXYZoJXMyx-E_QmyETqzhpzWks5uagBxgaJpZM4KdTXS&data=02%7C01%7C%7Ca7ffbfc59dd346cffb8208d619455633%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636724182921871382&sdata=gb0FjbyRz2Jy0GPEiM0X9RuW5iiGEwemlcVT%2Blky1rI%3D&reserved=0>.
|
VS Code currently highlights something that has the language ID
php
only if it is wrapped in<?php
tags, and everything outside like HTML. That is wrong in a few ways. The code outside of<?php
is not "php" language, it is whatever output you are using. So for a CLI application, code outside would just get printed to STDOUT, while in a webserver it would get send to the client, which means the language is dependend on theContent-Type
header (it does not have to be text/html). Only the code inside<?php
tags should be considered PHP, the outside can actually be any language, likehtml
orplaintext
. As this is not defined anywhere, VS Code should autodetect and fallback to HTML as that is most used. The inside is then "injected" as PHP like JavaScript in a<script/>
tag or CSS in a<style/>
tag. Also see #1751.This causes many issues:
<?php
. If you switch to preview or view the file on GitHub or any other editor, everything works fine.eval()
to evaluate code (which does not require<?php
tags) and the PHP debugger breaks inside that code, VS Code does asourceRequest
. The reported code does not get syntax highlighted. This means the PHP debugger needs to dynamically add this tag, which also means that every breakpoint request, every stackframe location needs to be shifted one line down.<?php
is included, which I would like to remove because it doesn't make sense: I declared the language to be PHP, so it should be highlighted as PHP. Other clients like Eclipse behave correctly here. Issue: Avoid prepending <?php in hover messages felixfbecker/php-language-server#105The text was updated successfully, but these errors were encountered: