I have a file, source.php, that contains Javascript after the closing PHP tag. Is there a way to make Visual Studio Code do syntax highlighting/completion on the Javascript code. It currently only highlights the PHP code.
It'd be great if settings.json supported something like the following:
"files.associations": {
"source.php": ["javascript", "php"]
}
No, this is not possible without writing your own VSCode extension to understands the combined file
For syntax highlighting, you'd need to define a new grammar that combines the php and javascript grammars.
Completions are even more complicated. You need a language server / extension that can understand the new combined document. How our html server handles script blocks is probably the best example of this: https://github.com/Microsoft/vscode/blob/master/extensions/html/server/src/modes/javascriptMode.ts
This extension could help. One Dark Theme
It is based in this Git Repo : https://github.com/atom/one-dark-syntax
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.