-
-
Notifications
You must be signed in to change notification settings - Fork 183
Tree-sitter fixes for December (including a PHP grammar!) #852
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
Merged
savetheclocktower
merged 68 commits into
pulsar-edit:master
from
savetheclocktower:add-php-grammar
Jan 14, 2024
Merged
Changes from 64 commits
Commits
Show all changes
68 commits
Select commit
Hold shift + click to select a range
a8f5b17
[tree-sitter] Fold on type objects in TypeScript
savetheclocktower a1e9fa0
[tree-sitter] Make the shell grammar's file types match the TM grammar's
savetheclocktower daf0637
Do the same for the modern Tree-sitter grammar
savetheclocktower 818d204
[tree-sitter] Add the pipe character (`|`) as an operator
savetheclocktower 037377a
[tree-sitter] Ruby fixes…
savetheclocktower 1ed79e2
[tree-sitter] Fix indentation hinting at the edges of injections
savetheclocktower fdc70fc
[tree-sitter] Highlight an obscure inheritance construct properly in C++
savetheclocktower 20a64bd
Allow `suggestedIndentForBufferRows` to work correctly…
savetheclocktower be37b26
[tree-sitter] Don't highlight JS default param values like parameters
savetheclocktower f6bb61f
[tree-sitter] Highlight assertion function clauses in TypeScript
savetheclocktower da10036
[tree-sitter] Fix JSX dedent logic
savetheclocktower bc55c4f
[tree-sitter] Further JSX indent fixes for JS and TS alike
savetheclocktower 7b4a50d
(oops)
savetheclocktower 66aea45
[tree-sitter] Fixes for shell script highlighting
savetheclocktower 294134c
[tree-sitter] Highlight private fields similarly to other JS properties
savetheclocktower ee54d37
[tree-sitter] Highlight TypeScript `infer` clauses properly
savetheclocktower d6f8a3c
Add a modern Tree-sitter PHP grammar
savetheclocktower 00de52c
Add `parserSource` fields where appropriate
savetheclocktower 1dc1536
Remove logging from injection callback
savetheclocktower 0fd47f5
Skip incorrect CI behavior on changes to `web-tree-sitter` itself
savetheclocktower ee3f41e
Don't try to parse non-CSON files as CSON
savetheclocktower 3a4b2dc
Handle nowdocs in PHP
savetheclocktower 8ae599f
[tree-sitter] TS: Treat parameters with defaults like parameters…
savetheclocktower b6d88a5
Update `tree-sitter-php` WASM file to latest `master`
savetheclocktower 18788c0
Address feedback on PHP syntax highlighting
savetheclocktower f6e1a22
Apply PHPDoc learnings to JSDoc
savetheclocktower 5e62e20
[tree-sitter] Add TODO and hyperlink injections to Java
savetheclocktower 0807dcf
Add TODO and hyperlink injections to Rust
savetheclocktower bbf4cb4
Add TODO and hyperlink injections to C/C++
savetheclocktower 351493f
Only inject TODO and hyperlink into CSS when needed
savetheclocktower bf039cc
Don't add root scopes to CSS for TODO/hyperlink injections
savetheclocktower ebd0ae0
Add TODO and hyperlink injections to Go
savetheclocktower e2da555
Add hyperlink injection to JSON
savetheclocktower 70b34cd
Add TODO and hyperlink injections to YAML comments
savetheclocktower a40bae4
Allow `(#set! capture.final)` as shorthand…
savetheclocktower 30f696f
Address more PHP grammar feedback
savetheclocktower 9db2ace
[tree-sitter] Add the pipe character (`|`) as an operator
savetheclocktower 0e8fe9b
[tree-sitter] Fix indentation hinting at the edges of injections
savetheclocktower a42d0ed
Allow `suggestedIndentForBufferRows` to work correctly…
savetheclocktower d32bdf6
[tree-sitter] Highlight assertion function clauses in TypeScript
savetheclocktower d9f6946
[tree-sitter] Fix JSX dedent logic
savetheclocktower 0b51a77
[tree-sitter] Further JSX indent fixes for JS and TS alike
savetheclocktower aef7c84
(oops)
savetheclocktower b7dc654
[tree-sitter] Fixes for shell script highlighting
savetheclocktower d148a73
Add a modern Tree-sitter PHP grammar
savetheclocktower c93bdeb
Add `parserSource` fields where appropriate
savetheclocktower ad8a215
Remove logging from injection callback
savetheclocktower 58b9cc1
Handle nowdocs in PHP
savetheclocktower 8c946a0
[tree-sitter] TS: Treat parameters with defaults like parameters…
savetheclocktower f2dabe5
Update `tree-sitter-php` WASM file to latest `master`
savetheclocktower 2580642
Address feedback on PHP syntax highlighting
savetheclocktower 8836be7
Only inject TODO and hyperlink into CSS when needed
savetheclocktower 0b08306
Don't add root scopes to CSS for TODO/hyperlink injections
savetheclocktower 336f609
More PHP grammar feedback
savetheclocktower c50b0e6
More PHP grammar feedback
savetheclocktower 4c6b0ba
Ensure indentation decisions consult the correct layers…
savetheclocktower 254440e
Oops
savetheclocktower 50bfa51
Update `tree-sitter-json` WASM build to latest
savetheclocktower 865153b
Address newly failing tests
savetheclocktower ddfa645
Fix issue where `symbol-provider-ctags` used the wrong package root
savetheclocktower 9972245
[symbols-view] Allow for scope-specific overrides of preferred providers
savetheclocktower a34b01b
In JS/TS, correctly highlight a variable with a default value…
savetheclocktower e78feea
Address more PHP grammar feedback
savetheclocktower 62bd6cc
Even more PHP grammar feedback
savetheclocktower f3be33b
Add `<>` and `<=>` operators in PHP
savetheclocktower bae3689
Add folds for PHP
savetheclocktower 6ebdfa0
Remove unneeded file
savetheclocktower 0111e13
PHP feedback
savetheclocktower File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,39 @@ | ||
| exports.activate = function() { | ||
| exports.activate = function () { | ||
| // Highlight macro bodies as C/C++ | ||
| for (const language of ['c', 'cpp']) { | ||
| for (const nodeType of ['preproc_def', 'preproc_function_def']) { | ||
| atom.grammars.addInjectionPoint(`source.${language}`, { | ||
| type: nodeType, | ||
| language(node) { | ||
| language() { | ||
| return language; | ||
| }, | ||
| content(node) { | ||
| return node.lastNamedChild; | ||
| } | ||
| }); | ||
| } | ||
|
|
||
| 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?:/ | ||
|
|
||
| atom.grammars.addInjectionPoint(`source.${language}`, { | ||
| type: 'comment', | ||
| language: (node) => { | ||
| return TODO_PATTERN.test(node.text) ? 'todo' : undefined; | ||
| }, | ||
| content: (node) => node, | ||
| languageScope: null | ||
| }); | ||
|
|
||
| for (let type of ['string_literal', 'comment']) { | ||
| atom.grammars.addInjectionPoint(`source.${language}`, { | ||
| type, | ||
| language: (node) => { | ||
| return HYPERLINK_PATTERN.test(node.text) ? 'hyperlink' : undefined; | ||
| }, | ||
| content: (node) => node, | ||
| languageScope: null | ||
| }); | ||
| } | ||
| } | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| exports.activate = () => { | ||
| 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?:/ | ||
|
|
||
| for (let type of ['comment', 'interpreted_string_literal', 'raw_string_literal']) { | ||
| atom.grammars.addInjectionPoint('source.go', { | ||
| type, | ||
| language: (node) => { | ||
| return HYPERLINK_PATTERN.test(node.text) ? 'hyperlink' : undefined; | ||
| }, | ||
| content: (node) => node, | ||
| languageScope: null | ||
| }); | ||
| } | ||
|
|
||
| atom.grammars.addInjectionPoint('source.go', { | ||
| type: 'comment', | ||
| language(node) { | ||
| return TODO_PATTERN.test(node.text) ? 'todo' : undefined; | ||
| }, | ||
| content: (node) => node, | ||
| languageScope: null | ||
| }); | ||
|
|
||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,4 @@ | ||
|
|
||
| ; (element) @fold | ||
| ; (style_element) @fold | ||
| ; (script_element) @fold | ||
|
|
||
| [ | ||
| (element) | ||
| (script_element) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,24 @@ | ||
| exports.activate = () => { | ||
| // TODO: Injections for language-todo and language-hyperlink. | ||
| 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?:/ | ||
|
|
||
| atom.grammars.addInjectionPoint('source.java', { | ||
| type: 'comment', | ||
| language: (node) => { | ||
| return TODO_PATTERN.test(node.text) ? 'todo' : undefined; | ||
| }, | ||
| content: (node) => node, | ||
| languageScope: null | ||
| }); | ||
|
|
||
| for (let type of ['string_literal', 'comment']) { | ||
| atom.grammars.addInjectionPoint('source.java', { | ||
| type, | ||
| language: (node) => { | ||
| return HYPERLINK_PATTERN.test(node.text) ? 'hyperlink' : undefined; | ||
| }, | ||
| content: (node) => node, | ||
| languageScope: null | ||
| }); | ||
| } | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.