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

[Bug] Code validation (syntax error) does not work for php language #4781

Open
2 tasks
SteelManITA opened this issue Dec 12, 2024 · 7 comments
Open
2 tasks

Comments

@SteelManITA
Copy link

SteelManITA commented Dec 12, 2024

Reproducible in vscode.dev or in VS Code Desktop?

  • Not reproducible in vscode.dev or VS Code Desktop

Reproducible in the monaco editor playground?

Monaco Editor Playground Link

No response

Monaco Editor Playground Code

<?php
// The next line contains a syntax error:
if () {
  return "The parser recovers from this type of syntax error"
}
?>

Reproduction Steps

Write a syntax error, like missing condition in if statement or missing a ;

Actual (Problematic) Behavior

Code validation (syntax error) does not work for php language

It does not work in demo either (microsoft.github.io/monaco-editor)

If you select PHP language, the first comment is "the next line contains a syntax error". But the "next line" (which has a syntax error) is not highlighted

Expected Behavior

Code validation works

Additional Context

No response

@rcjsuen
Copy link
Contributor

rcjsuen commented Dec 12, 2024

@SteelManITA Monaco does not support validating PHP syntax.

@SteelManITA
Copy link
Author

@rcjsuen I don't understand... Why then on the page https://microsoft.github.io/monaco-editor is there actually an example in PHP that refers to validation?

In any case, is there currently no way to have even basic validation of PHP syntax?

@rcjsuen
Copy link
Contributor

rcjsuen commented Dec 13, 2024

@rcjsuen I don't understand... Why then on the page https://microsoft.github.io/monaco-editor is there actually an example in PHP that refers to validation?

Which example are you referring to?

In any case, is there currently no way to have even basic validation of PHP syntax?

I doubt it personally but I don't work for Microsoft. You'd probably need to hook it up with a language server.

@SteelManITA
Copy link
Author

SteelManITA commented Dec 14, 2024

@rcjsuen I refer to the example that appears when selecting php on the homepage (screnshot below)

Image

@rcjsuen
Copy link
Contributor

rcjsuen commented Dec 17, 2024

@rcjsuen I refer to the example that appears when selecting php on the homepage (screnshot below)

I agree it's kind of a strange design choice but unfortunately the reality is that it does not have PHP syntax validation out-of-the-box.

@SteelManITA
Copy link
Author

SteelManITA commented Dec 17, 2024 via email

@rcjsuen
Copy link
Contributor

rcjsuen commented Dec 17, 2024

Ok, thanks for clarifying. Do you know any packages I can use to achieve my goal?

You should read up on the language server protocol and then look at TypeFox/monaco-languageclient. They have examples that integrate with Java and Python language servers that you can reference.

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

No branches or pull requests

2 participants