pulsar/spec
Andrew Dupont 46877b05ff [language-php] Add meta.embedded.block/meta.embedded.line
…to each PHP section in order to match the functionality of the TextMate grammar.

This was a gigantic endeavor and involved doing several things that were on my “ugh, I’ll get around to it” list:

* To make some of this stuff work, we were using two different PHP parser layers. The root one did the syntax highlighting and separated the HTML from the rest, and the deeper injection was there just so we could scope some ranges as `source.php`.

  That doesn’t work because of rules we have about shallower layers acting before deeper layers when iterating through syntax highlighting boundaries. I was trying to be too clever. Now the _root_ layer is the one that does no highlighting, and the _deeper_ layer is the one that exists to apply `source.php` _and then_ perform highlighting and indentation hinting and folding and whatnot.

  If we need to, we can move some of the queries to the root layer for whatever reason; maybe we come across a bug six months from now that could be fixed if we made the root layer in charge of folding. We have options.

* All boundaries for `HighlightIterator`s now _either_ open one or more scopes _or_ close one or more scopes. If one boundary can close some scopes and open others, then boundaries on different layers that share a buffer position cannot possibly close/open in the correct order because they can't intermingle. This needed to happen and this was as good of an excuse as any to do it.
* We needed to present sane PHP opening/closing ranges to the injection. Ironically, `tree-sitter-php` itself makes this nearly impossible because of how the tree is structured; it tries to hide the `<?php` and `?>` tags from the PHP layer and treat them as text, despite the fact that PHP is the thing that knows how to parse that.

  The best way to do this — at least until I encounter a reason why it can’t work — is to find all the `<?php`s and `?>`s, sort them, group them, and build fake node ranges. This is fine! I mean, it’s ridiculous, but it’s fine! The ranges that we hand off to another parser are allowed to be completely arbitrary!

  This lets us do what we were only approximating before: have _one_ PHP injection layer with _any number of_ content ranges, each of which begins with `<?php` and ends with `?>` without trying to claim any surrounding whitespace. This would be worth it even if we didn’t have to do any of this other stuff.

* Each content range of the injection needs _either_ `meta.embedded.line.php` _or_ `meta.embedded.block.php` depending on whether the range begins and ends on the same line. This is not something I was willing to regress on because it's _hard_ to distinguish between PHP and non-PHP unless your editor helps you out, and because I wasn't going to go into a bunch of themes and tell them to treat `source.php` like `meta.embedded`.

  This also meant that we needed to be able to add _multiple_ “root” scope names per content range. But we already had a mode in which the `languageScope` injection option could be a callback, so it wasn't hard to make it a callback that could take extra parameters for the buffer and range.

  This isn't a feature that I'm eager for other grammars to use, or even necessarily know about, but it was what we needed to deliver feature parity here. And none of it would have been necessary if `tree-sitter-php` made more sensible choices. (Whatever. Maybe what I want isn't possible for some strange reason.)

All existing tests pass. Tests have been written for the new `languageScope` features. Tests need to be written for PHP just like for all other language grammars, but that was on the to-do list anyway. If any of this turns out to be catastrophic, it’s easy to roll back, but tests are passing on my machine and I expect them to pass in CI.
2024-01-20 20:49:17 -08:00
..
fixtures Get PackageManager specs passing 2024-01-07 15:35:07 -08:00
helpers Reformat all JS files using prettier 2019-05-31 18:33:56 +02:00
main-process Fix a spec to expect 'Pulsar', not 'Atom' (#116) 2022-11-09 22:08:24 -05:00
.eslintrc.js Get Workspace specs passing 2024-01-07 15:35:08 -08:00
application-delegate-spec.js Reformat all JS files using prettier 2019-05-31 18:33:56 +02:00
async-spec-helpers.js support sync conditions 2021-01-21 21:20:44 +03:00
atom-environment-spec.js Rewrite, and simplify 2023-06-14 17:17:20 -07:00
atom-paths-spec.js Added failing tests from atom-paths-spec.js 2022-09-24 23:56:33 -07:00
atom-protocol-handler-spec.js Decaffeinate specs (#21546) 2020-10-30 16:40:57 +03:00
atom-reporter.js Decaffeinate 2022-09-05 14:13:39 -07:00
babel-spec.js Decaffeinate specs (#21546) 2020-10-30 16:40:57 +03:00
buffered-node-process-spec.js Decaffeinate specs (#21546) 2020-10-30 16:40:57 +03:00
buffered-process-spec.js Added buffered-process-spec.js 2022-09-24 23:59:58 -07:00
clipboard-spec.js Re-apply prettier JS formatter 2021-09-29 13:41:03 +03:00
command-installer-spec.js Commented command installer 2023-01-05 12:45:50 -03:00
command-registry-spec.js Reformat all JS files using prettier 2019-05-31 18:33:56 +02:00
compile-cache-spec.js Moved usage of coffee-script to coffeescript 2023-01-29 19:44:06 -08:00
config-file-spec.js Reformat all JS files using prettier 2019-05-31 18:33:56 +02:00
config-spec.js Un-focus config specs 2023-07-22 22:05:41 -07:00
context-menu-manager-spec.js Fix bug of Linter error 2021-06-20 00:12:14 +09:00
decoration-manager-spec.js Decaffeinate specs (#21546) 2020-10-30 16:40:57 +03:00
default-directory-provider-spec.js Decaffeinate specs (#21546) 2020-10-30 16:40:57 +03:00
default-directory-searcher-spec.js Reformat all JS files using prettier 2019-05-31 18:33:56 +02:00
deserializer-manager-spec.js Decaffeinate specs (#21546) 2020-10-30 16:40:57 +03:00
dock-spec.js Reformat all JS files using prettier 2019-05-31 18:33:56 +02:00
file-system-blob-store-spec.js Decaffeinate specs (#21546) 2020-10-30 16:40:57 +03:00
git-repository-provider-spec.js 🐛 Recognize git worktree directories as valid git repositories 2019-08-23 14:02:54 -05:00
git-repository-spec.js Reformat all JS files using prettier 2019-05-31 18:33:56 +02:00
grammar-registry-spec.js Change references to JS grammar path in specs 2024-01-18 13:53:23 -08:00
gutter-container-spec.js Reformat all JS files using prettier 2019-05-31 18:33:56 +02:00
gutter-spec.js Reformat all JS files using prettier 2019-05-31 18:33:56 +02:00
history-manager-spec.js Reformat all JS files using prettier 2019-05-31 18:33:56 +02:00
jasmine-junit-reporter.js Reformat all JS files using prettier 2019-05-31 18:33:56 +02:00
jasmine-list-reporter.js Fixed reporter 2023-01-05 11:53:50 -03:00
jasmine-test-runner.js Added a new way to filter for tests 2023-01-04 21:37:03 -03:00
keymap-extensions-spec.js Decaffeinate specs (#21546) 2020-10-30 16:40:57 +03:00
menu-manager-spec.js Fix bug of Linter error 2021-06-20 00:12:14 +09:00
menu-sort-helpers-spec.js Fix typo in menu-sort-helpers-spec.js (#22032) 2021-03-26 08:33:44 +03:00
module-cache-spec.js Decaffeinate specs (#21546) 2020-10-30 16:40:57 +03:00
native-compile-cache-spec.js Decaffeinate 2022-09-05 14:13:39 -07:00
native-watcher-registry-spec.js Reformat all JS files using prettier 2019-05-31 18:33:56 +02:00
notification-manager-spec.js Reformat all JS files using prettier 2019-05-31 18:33:56 +02:00
notification-spec.js Reformat all JS files using prettier 2019-05-31 18:33:56 +02:00
package-manager-spec.js Get PackageManager specs passing 2024-01-07 15:35:07 -08:00
package-spec.js Removed tests related to caching incompatible things 2023-05-09 21:07:44 -03:00
package-transpilation-registry-spec.js Reformat all JS files using prettier 2019-05-31 18:33:56 +02:00
pane-axis-element-spec.js Decaffeinate specs (#21546) 2020-10-30 16:40:57 +03:00
pane-container-element-spec.js Spec cleanup 2021-07-20 22:27:18 +03:00
pane-container-spec.js Add prevent option to ::onWillDestroyPaneItem 2021-09-06 21:12:47 +02:00
pane-element-spec.js Revert "Only allow drag-and-drop to succeed on panes in the center workspace" 2021-10-25 18:14:08 +01:00
pane-spec.js Add prevent option to ::onWillDestroyPaneItem 2021-09-06 21:12:47 +02:00
panel-container-element-spec.js Destroy panels after test. 2022-09-04 15:30:51 -07:00
panel-container-spec.js Reformat all JS files using prettier 2019-05-31 18:33:56 +02:00
panel-spec.js Reformat all JS files using prettier 2019-05-31 18:33:56 +02:00
path-watcher-spec.js Revert "add delay to watch-path tests to make them less flaky" 2019-06-14 15:28:48 -04:00
project-spec.js Revert "Disable flaky spec on Windows until we can identify a proper fix" 2019-06-14 11:20:37 -04:00
reopen-project-menu-manager-spec.js Reformat all JS files using prettier 2019-05-31 18:33:56 +02:00
scope-resolver-spec.js Fix other grammar paths 2024-01-18 13:53:23 -08:00
selection-spec.js Reformat all JS files using prettier 2019-05-31 18:33:56 +02:00
spec-helper-functions.js Separated mockDebounce to new spec-helper-functions.js and added more comments 2022-09-06 16:29:08 -07:00
spec-helper-platform.js Decaffeinate specs (#21546) 2020-10-30 16:40:57 +03:00
spec-helper.js Avoiding specs that have no spec file 2023-01-27 16:21:35 -03:00
state-store-spec.js Reformat all JS files using prettier 2019-05-31 18:33:56 +02:00
style-manager-spec.js Incorrect spec added 2023-07-25 16:54:17 -07:00
styles-element-spec.js Migrate to custom elements 2021-07-20 17:15:27 +03:00
syntax-scope-map-spec.js Reformat all JS files using prettier 2019-05-31 18:33:56 +02:00
task-spec.js Decaffeinate specs (#21546) 2020-10-30 16:40:57 +03:00
text-editor-component-spec.js Added text-editor-component-spec.js 2022-09-25 00:13:28 -07:00
text-editor-element-spec.js Use custom element on text editor element 2021-08-18 12:55:00 +03:00
text-editor-registry-spec.js Get TextEditorRegistry specs passing 2024-01-07 15:35:07 -08:00
text-editor-spec.js Fix memory access error on autocomplete-html specs 2024-01-07 15:35:08 -08:00
text-mate-language-mode-spec.js Restore core.useTreeSitterParsers setting… 2023-04-26 17:46:02 -07:00
text-utils-spec.js Reformat all JS files using prettier 2019-05-31 18:33:56 +02:00
theme-manager-spec.js Reformat all JS files using prettier 2019-05-31 18:33:56 +02:00
title-bar-spec.js Reformat all JS files using prettier 2019-05-31 18:33:56 +02:00
tooltip-manager-spec.js Reformat all JS files using prettier 2019-05-31 18:33:56 +02:00
tree-indenter-spec.js Added: tree-indenter-spec.js 2022-09-25 00:15:10 -07:00
tree-sitter-language-mode-spec.js Make useExperimentalModernTreeSitter the default… 2024-01-07 15:35:07 -08:00
typescript-spec.js Decaffeinate specs (#21546) 2020-10-30 16:40:57 +03:00
ui-spec.js Add missing path delimiter 2023-11-08 19:55:11 -08:00
update-process-env-spec.js Merge branch 'master' into pr/67 2022-06-30 00:32:26 -07:00
uri-handler-registry-spec.js Reformat all JS files using prettier 2019-05-31 18:33:56 +02:00
view-registry-spec.js Reformat all JS files using prettier 2019-05-31 18:33:56 +02:00
wasm-tree-sitter-language-mode-spec.js [language-php] Add meta.embedded.block/meta.embedded.line 2024-01-20 20:49:17 -08:00
window-event-handler-spec.js Debounce the resize event handler 2019-06-28 18:51:43 +02:00
workspace-center-spec.js Reformat all JS files using prettier 2019-05-31 18:33:56 +02:00
workspace-element-spec.js Added workspace-element-spec.js 2022-09-25 00:22:51 -07:00
workspace-spec.js Address feedback 2024-01-10 20:47:51 -08:00