Commit Graph

41830 Commits

Author SHA1 Message Date
Andrew Dupont
9b1e8e5513 Add features to folds:
* A new predicate called `fold.invalidateOnChange` that can be used when a change should automatically invalidate the fold cache for each row in a node's range.
* The ability to use custom predicates in `folds.scm` files. (Previously, captures from `folds.scm` did not consult an instance of `ScopeResolver` in the processing phase.)
2024-02-10 14:36:32 -08:00
Andrew Dupont
82eac2276d [language-typescript] Add syntax highlighting for enums 2024-02-09 22:33:48 -08:00
Andrew Dupont
89686ce03a [language-html] Allow for folding of attribute lists…
…such as in multi-line self-closing tags and multi-line opening tags.

Also fix an issue in fold handling that made it impossible to use `@_IGNORE_` captures in `folds.scm`.
2024-02-09 14:20:34 -08:00
Andrew Dupont
cc20d7055d [language-html] Fix indentation after self-closing tags 2024-02-09 09:51:41 -08:00
Andrew Dupont
c188a26730 Don’t try to lint JS in the vendor directory 2024-02-04 13:36:33 -08:00
Andrew Dupont
e332953260 [language-c] Add missing anchor to constant pattern 2024-02-04 13:36:17 -08:00
Andrew Dupont
cb7d4aad6c [language-c] C/C++ highlighting fixes…
Changes: 

* `#define FOO 1` and `#define FOO` will _always_ scope `FOO` as `constant.other.c`, even when `FOO` is mixed-case or lower-case.
* `#define FOO()` will _always_ scope `FOO` as `entity.name.function.preprocessor.c`, even when `FOO` is mixed-case or lower-case.
* Usages of bare identifiers in other contexts in preprocessor directives should always scope them as `constant.other.c` — unless I’m made aware of any counterexamples where that shouldn’t happen. For example: in `#if TABLE_SIZE > 200`, `TABLE_SIZE` should always be `constant.other.c`, no matter its casing.
* All-caps variable declarations and assignments (`int FOO = 0`, etc.) should scope `FOO` as `variable` rather than `constant`. We should only scope an arbitrary identifier as `constant` if we think it’s been used in the context of a macro definition.

However:

* When deciding whether something outside of a directive refers to a macro constant, we have no choice but to use the `ALL_CAPS` heuristic. Ideally we’d be able to determine that from some sort of analysis of the source code files — but even if we could keep track of that sort of thing in a single buffer, it’d fall down when macro constants _defined in other files_ are used. All we can do here is make a best guess.
2024-02-03 23:39:12 -08:00
Andrew Dupont
10ce3b11a1 Forgot to bump parserSource (the system works!) 2024-02-02 23:57:21 -08:00
Andrew Dupont
5628d089dc Fix argument passing in the Task class
This code snippet sets up logging so that a worker process can call `console.log` and its siblings and have them show up in the renderer process’s console… but it’s trying to destructure the antiquated magical `arguments` collection (which is like an array, but isn’t an array!) and the engine doesn’t seem to like it.

Logging didn’t work for me until I changed this.

This is such a tiny fix, and I don’t have the energy to shelve everything on this branch just to make a separate PR.
2024-02-02 23:10:49 -08:00
Andrew Dupont
3131464ddb [language-php] Update tree-sitter-phpdoc
…and add some `punctuation` scopes for the generic type delimiters.
2024-02-02 23:07:34 -08:00
Andrew Dupont
69fb61e80c Add fallback values for new compulsory syntax variables…
…that were added to the theme generator in https://github.com/pulsar-edit/ppm/pull/123.
2024-02-01 21:35:07 -08:00
Andrew Dupont
32c464b3cb [language-typescript] Highlight escape characters 2024-02-01 21:35:07 -08:00
Andrew Dupont
982917803e [language-php] Fix block comments failing to re-highlight 2024-02-01 21:35:07 -08:00
Andrew Dupont
dff70516aa
Merge pull request #905 from savetheclocktower/fix-settings-view-readme-markdown-headings
[settings-view] Don’t display heading anchor icons within a README
2024-02-01 18:29:00 -08:00
Andrew Dupont
b3b16010fa [settings-view] Don’t display heading anchor icons within a README 2024-01-31 23:05:18 -08:00
Andrew Dupont
ca25930510
Merge pull request #902 from savetheclocktower/tree-sitter-hotfix
Fix failing spec
2024-01-29 23:35:44 -08:00
Andrew Dupont
11ebeeab61 Prefer a more graceful solution 2024-01-29 22:00:58 -08:00
Andrew Dupont
14e3562330 Fix failing spec 2024-01-29 21:55:04 -08:00
Andrew Dupont
2dbd99582e
Merge pull request #859 from savetheclocktower/tree-sitter-january
Tree-sitter rolling fixes (January edition)
2024-01-29 21:10:58 -08:00
DeeDeeG
4f3bc686e1
Merge branch 'master' into tree-sitter-january 2024-01-29 22:44:18 -05:00
Andrew Dupont
2e36a24fc6 [language-php] Remove firstLineRegex and contentRegex
They don’t gain us anything, and in fact actually cause this grammar to be ranked _below_ the TextMate PHP grammar when they fail.
2024-01-29 18:51:35 -08:00
confused_techie
e999387f82
Merge pull request #858 from pulsar-edit/CI-build-on-older-Linux
CI: build Linux x86-64 binaries on older Linux
2024-01-28 22:17:53 -08:00
confused_techie
b79d47c02d
Merge pull request #870 from Daeraxa/copyright-2024
Update copyright year to 2024
2024-01-28 22:17:36 -08:00
confused_techie
edbb4b8415
Merge pull request #891 from Daeraxa/update-readme-badges
Update README badges
2024-01-28 22:17:26 -08:00
Andrew Dupont
94d41ce82b [language-(java|type)script] Highlight array-destructured variables…
…no matter how deeply they’re nested.

Also highlight `?` in an incomplete ternary.

(Also fix a lot of final segments in the TypeScript highlights file; I’ve been lazily copying-and-pasting and forgetting to change them.)
2024-01-28 11:45:36 -08:00
Andrew Dupont
e49b919703 [language-(java|type)script] Add exhaustive indentation configuration
We are crossing the Rubicon.

https://github.com/orgs/pulsar-edit/discussions/249 is a discussion of specific ways that indentation is different in JavaScript because of the new grammar. We intentionally didn’t try to preserve the indentation decisions in the old TextMate grammar, but this is (predictably) disruptive to some people. We don’t want to punt like legacy Tree-sitter did and rely on the TextMate grammar’s coarse regexes to decide what gets indented, but we can at least make the new indentation system granularly configurable.

This commit makes practically every indentation decision configurable in JavaScript and TypeScript. It groups these settings under a new “Indentation” section in each package’s settings.

I might decide that this goes too far and roll back the granular settings for `{`, `[`, and `(`, but the other indentation hints are absolutely matters of taste, so it’s only proper that users can choose to disable them.

In the long run, we could _consider_ allowing users to swap in another indentation engine altogther, much like #895 proposes for folds. That would let us legitimately offer users a way to opt into “the way the TextMate grammar does it” without affecting other users.

Another stopgap option would be to add a way for a user to disable indentation hinting altogether for a given grammar.
2024-01-28 11:21:59 -08:00
Andrew Dupont
5855241698 Fix issue with looking up objects in atom.config
…when a project-specific config is present.

Most people don't use a project-specific config, which is why this bug has been present for ages. Read the new spec for an explanation.
2024-01-28 00:47:32 -08:00
Andrew Dupont
f691cfce28 Allow for any number of @_IGNORE_ capture names in a query…
…by namespacing them as `@_IGNORE_.foo`, `@_IGNORE_.bar`, etc.

It's sometimes necessary to define a capture in a query not because you want to apply a scope name, but because you need to use it as the argument to a predicate. `@_IGNORE_` was intended for that purpose, but it was the _only_ capture name with that special effect.

Now, you can specify any number of captures that don't apply scope names. As long as it equals `@_IGNORE_` or _starts with_ `@_IGNORE_.`, it'll have the same effect. This lets you target two or more nodes and use them all in predicates in the same query without any of them applying a scope name.
2024-01-27 23:11:41 -08:00
Andrew Dupont
e547ace81c [language-css] Highlighting fixes:
* Style `*` (universal selector)
* Add support for namespaced tags and attributes (now that `tree-sitter-css` supports them)
2024-01-27 20:23:42 -08:00
Andrew Dupont
a8215f107c [language-java] Add highlights for variables…
…when assigning, reassigning, or incrementing.

Also add `++` and `--` as operators.
2024-01-27 18:13:42 -08:00
Andrew Dupont
1f9ab2008b [language-javascript] Highlight public fields in class bodies 2024-01-27 11:31:25 -08:00
Andrew Dupont
6767cda288 Fix indentation bug in suggestedIndentForBufferRow
A leading space was being accounted for when doing some math to compute indent level… but not on both sides of the equation.
2024-01-27 01:32:44 -08:00
Andrew Dupont
adfdd05472 Allow “half-covering” of scopes at the edges of injections
There's a hard-to-grok setting for language injections that allows a deeper layer to monopolize the scope application for a range. In most cases, an injection is placed into a node that the parser doesn't know much about (like a `script` block in HTML); but Rust and C parsers needed a way to inject themselves _into themselves_ so that they could add syntax highlighting to macros. Because they were applying highlighting to a range that the base layer _already_ had plans to highlight, they needed a way to block the shallower layer from acting.

This mode has never worked briliantly, but it's been made smarter in several ways since the invention of modern Tree-sitter. And here's another one: if the highlight iterator is at a position where an injection range is _about_ to begin, it shouldn't be able to stop any other layer from _closing_ a scope; and if the highlight iterator is at a position where an injection range has just _finished_, it shouldn't be able to stop any other layer from _opening_ a scope.

Because of this, we can now fix a bug that I think might've been present for a while in the application of scopes to rust macros like `println!` — the position after the exclamation point is one of those injection-layer boundaries, to the effect that a scope name was opened that would persist until at least the end of the screen line.
2024-01-27 00:41:41 -08:00
Andrew Dupont
5728b7fe5e [language-javascript] Update to latest tree-sitter-jsdoc 2024-01-26 23:12:02 -08:00
Andrew Dupont
483870d701 [language-rust] Scope &s in references as operators 2024-01-26 23:11:11 -08:00
Andrew Dupont
312f627cc1 [language-yaml] Scope unquoted strings as, well, string.unquoted 2024-01-26 23:10:37 -08:00
Andrew Dupont
ecf4fa3917 Revert change to indentLevelForLine
…which locked its return values to integers.

The other language modes allow this method to return a non-integer, hence so should we. If this breaks something, it can be addressed some other way.
2024-01-26 18:33:15 -08:00
Andrew Dupont
ff030d896c [language-javascript] Missed these renames 2024-01-26 18:19:48 -08:00
Andrew Dupont
476e784005 [language-javascript] Two highlighting fixes…
* Revert JSDoc tags to use the `keyword` namespace
* Ensure we always apply `meta.tag.jsx.js` to the area surrounding a JSX opening/closing/self-closing tag element and its punctuation.
2024-01-26 17:26:37 -08:00
Andrew Dupont
11910a11aa [language-gfm] Change markup.code to markup.raw
…and apply it only to the content _inside_ the fence when handling fenced code blocks.
2024-01-26 17:22:04 -08:00
confused_techie
d34af8fa19
Merge pull request #889 from savetheclocktower/fix-markdown-after-line-break
Fix issue with Markdown rendering after line break in strict mode
2024-01-25 17:48:58 -08:00
DeeDeeG
fd218433f4 CI: Add comments to explain workarounds for Debian Docker 2024-01-24 23:41:50 -05:00
Daeraxa
538117a8f9 update colours 2024-01-25 02:47:45 +00:00
Daeraxa
77001b6f64 fix spacing 2024-01-25 02:35:25 +00:00
Daeraxa
83fc5d473d add badges 2024-01-25 02:32:50 +00:00
Andrew Dupont
edf19b2af2 [language-php] Stop scoping all tokens LIKE_THIS as constant 2024-01-24 17:11:47 -08:00
Andrew Dupont
9265e5eb3e [language-css] Fix failure to scope the foo in .div foo
…and other descendant combinators.
2024-01-24 17:10:38 -08:00
Andrew Dupont
f1ce722f33 [language-typescript] Various highlighting fixes…
* Declared namespaces should be `entity` only, not `support`
* `<` and `>` in type parameters should always have the proper `punctuation` scopes applied
* All TSX tags should have the surrounding `meta.tag.ts.tsx` scope applied
* TSX fragments (`<>`) should be highlighted
2024-01-24 17:09:42 -08:00
Andrew Dupont
a0595b275d [language-typescript] Use proper comment delimiters in TypeScript…
…when inside of a TS block within a TSX interpolation.

Some mixing of TS and TSX is too ambiguous for the “Toggle Line Comments” command, but in this case we've got a brace-delimited block inside of a TSX interpolation. That's practically guaranteed to mean we've got a line with _only_ TypeScript on it, so we should use an ordinary TS line comment.
2024-01-23 16:17:06 -08:00
Andrew Dupont
1b2163f1ad Stop ESLint from complaining about require('atom') 2024-01-22 23:32:35 -08:00