mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-11 11:15:24 +03:00
Handle nowdocs in PHP
This commit is contained in:
parent
ee3f41e6e0
commit
3a4b2dc039
@ -303,7 +303,8 @@
|
||||
(encapsed_string
|
||||
(escape_sequence) @constant.character.escape.php)
|
||||
|
||||
(heredoc) @string.unquoted.heredoc.php
|
||||
[(heredoc) (nowdoc)] @string.unquoted.heredoc.php
|
||||
|
||||
|
||||
[
|
||||
"abstract"
|
||||
|
@ -73,6 +73,9 @@ exports.activate = function () {
|
||||
includeAdjacentWhitespace: true
|
||||
});
|
||||
|
||||
// TODOs and URLs
|
||||
// ==============
|
||||
|
||||
const TODO_PATTERN = /\b(TODO|FIXME|CHANGED|XXX|IDEA|HACK|NOTE|REVIEW|NB|BUG|QUESTION|COMBAK|TEMP|DEBUG|OPTIMIZE|WARNING)\b/;
|
||||
const HYPERLINK_PATTERN = /\bhttps?:/
|
||||
|
||||
@ -104,6 +107,9 @@ exports.activate = function () {
|
||||
});
|
||||
}
|
||||
|
||||
// HEREDOCS and NOWDOCS
|
||||
// ====================
|
||||
|
||||
atom.grammars.addInjectionPoint('text.html.php', {
|
||||
type: 'heredoc',
|
||||
language(node) {
|
||||
@ -118,6 +124,24 @@ exports.activate = function () {
|
||||
}
|
||||
});
|
||||
|
||||
atom.grammars.addInjectionPoint('text.html.php', {
|
||||
type: 'nowdoc',
|
||||
language(node) {
|
||||
let id = node.firstNamedChild;
|
||||
if (id.type !== 'heredoc_start') return null;
|
||||
return id.text;
|
||||
},
|
||||
content(node) {
|
||||
let body = node.children.find(c => c.type === 'nowdoc_body');
|
||||
let results = body.children.filter(c => c.type === 'nowdoc_string');
|
||||
return results;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// PHPDoc
|
||||
// ======
|
||||
|
||||
atom.grammars.addInjectionPoint('text.html.php', {
|
||||
type: 'comment',
|
||||
language(node) {
|
||||
|
Loading…
Reference in New Issue
Block a user