Commit Graph

33 Commits

Author SHA1 Message Date
Andrew Dupont
50bfa5141e Update tree-sitter-json WASM build to latest
Spotted it falling down on a very large JSON file I had. Seems to be fixed on `master`. Not sure which verison I originally built it from.
2024-01-11 15:07:11 -08:00
Andrew Dupont
e2da555079 Add hyperlink injection to JSON 2024-01-11 15:07:08 -08:00
Andrew Dupont
69038a1c4c
Merge pull request #677 from savetheclocktower/tree-sitter-more-fixes
Tree-sitter running fixes (August edition)
2023-09-13 15:14:27 -07:00
confused-Techie
b887846496 Manual Decaf language-json spec 2023-08-22 22:25:48 -07:00
confused-Techie
e19613ecdf language-json spec 2023-08-22 20:34:10 -07:00
Andrew Dupont
5c8f6abd94 Tag properties as such in JSON's tags.scm 2023-08-16 11:40:51 -07:00
Andrew Dupont
d629e2c3a8 Add tags queries for lots of builtin grammars
These can probably be improved in most cases, but they should be present so that
`symbol-provider-tree-sitter` is more likely to be useful.
2023-07-29 16:23:02 -07:00
Andrew Dupont
c8cbd82518 Overhaul Tree-sitter scope tests
I realized a few days ago that the `#is?` and `#is-not?` predicates — which
puzzled me upon first investigation back in February, and which I'd ignored ever
since — are exactly what I should've been using all along for scope tests.

They are counterparts to `#set!` in that they are two additional buckets in
which to store arbitrary data. And they remove the need to have both
`test.onlyIfFoo` and `test.onlyIfNotFoo`, since the presence of `test.onlyIfFoo`
in the `refutedProperties` bucket can behave opposite to the its presence in the
`assertedProperties` bucket.

This further means that a test called `test.onlyIfFoo` can be renamed
`test.foo`. The `onlyIf` was my way of making it clear through context that this
`#set!` predicate actually enforced a criterion — but that's implicit now that
it'll be using an `#is?` or `#is-not?` predicate.

I also took the opportunity to move `test.final` and `test.shy` to their own
namespace. `final` is an oddball in the sense that it sets criteria for _other_
captures as well as its own, and they're both oddballs in the sense that they
consider the effects of other captures on the same range. And I don't want to
introduce the idea that a predicate like `#is?` can have side effects.

So they stay on `#set!` and live at `capture.final` and `capture.shy`,
respectively.

To summarize, here's a before and after:

  ((string "\"" @punctuation.start)
    (#set! test.onlyIfFirst true)
    (#set! test.final true)

  ((bar) @baz
    (#set! test.onlyIfNotDescendantOfType thud))

becomes

  ((string "\"" @punctuation.start)
    (#is? test.first true)
    (#set! capture.final true)

  ((bar) @baz
    (#is-not? test.descendantOfType thud))

This PR changes all the built-in grammars. I don't know if there are any
third-party modern-Tree-sitter grammars out there except for mine, but I've
added a simple compatibility layer so that all of the old predicates should
still work for now. But I'm going to remove that code before we ship this stuff
for real.
2023-07-20 15:17:01 -07:00
Andrew Dupont
1e54a680ca [language-json] Add a scope to JSON keys…
…so that they can be scoped differently in themes.

The TM grammar already had the `meta.structure.key.json` scope, so
I've added it here. Further work would need to be done if we wanted JSON
keys to be highlighted differently in built-in themes.
2023-06-08 11:07:56 -07:00
Andrew Dupont
1c90032276 Add namespaces to custom #set! predicates
Predicates were getting pretty chaotic. With the namespace, it's now clearer
where a predicate may be defined and what its purpose is. It also helps resolve
ambiguity — e.g., both folds and highlights can have an `endAt` predicate, so
now they're disambiguated as `fold.endAt` and `adjust.endAt`, respectively.

Namespaces:

* `highlight` for highlight-specific settings (of which there is presently only
   one)
* `test` for scope tests (currently used by highlights and indents)
* `adjust` for scope adjustments (highlights)
* `indent` for indent settings
* `fold` for fold settings

Right now, only the `test` namespace will be used by more than one kind of query
file, but I could imagine that changing in the future.

For now, tests and adjustments still work without the prepended namespace, but
I imagine I'll take that out even before we ship this feature experimentally.
Much easier to make big changes like this before anyone depends on them.

This also draws a much clearer line between `#set!` predicates with special
meaning in Pulsar… and those which are being used to set arbitrary data for
later use. For instance, if you see `(#set! isOnLeftSideOfAssignment true)`, you
know it must just be arbitrary data.
2023-04-29 14:58:42 -07:00
Andrew Dupont
71d4ad1d07 Restore core.useTreeSitterParsers setting…
…along with a temporary `core.useExperimentalModernTreeSitter` setting.

If we truly planned to keep three different language modes around indefinitely,
changing `core.useTreeSitterParsers` to an enum would make sense. But we don't,
so it'd actually just be a gigantic pain in the ass to migrate one setting to
another of a different type.

When we ship modern-tree-sitter experimentally, we'll make it opt-in via the
temporary setting. When we make it the official tree-sitter implementation and
remove the legacy node-tree-sitter version, we'll remove the temporary setting
and just change the semantics around `core.useTreeSitterParsers`.

Reverting the addition of the `core.languageParser` setting is a chore, but it
prevents a _gigantic_ future headache.
2023-04-26 17:46:02 -07:00
Andrew Dupont
2cd20067b5 Rename syntaxQuery to highlightsQuery
The `syntaxQuery` key in a grammar definition file is the only query whose name
differs from its canonical filename, and there's no reason why that should be
the case. Might as well change it now before we ship instead of going through
the pain of changing it later.
2023-04-25 11:38:53 -07:00
Andrew Dupont
365561069f Rename all tree-sitter-2 values to modern-tree-sitter
Any file paths with `tree-sitter-2` in them can be renamed later.
2023-04-07 15:21:33 -07:00
Andrew Dupont
d9347d6c57 Clean up/harmonize scopes…
…to conform better to the documentation I just wrote at

https://gist.github.com/savetheclocktower/c9607b97477d4817911e4f2f8db89679#file-scope-taxonomy-md.
2023-03-31 00:02:30 -07:00
Andrew Dupont
ba588195c5 Merge origin/master 2023-03-28 17:23:32 -07:00
Andrew Dupont
9ce12ab554 Add JSON grammar 2023-03-28 17:12:21 -07:00
wesinator
5dcdb04d37 json language - add .har extension 2023-02-23 12:17:03 -05:00
Maurício Szabo
beb1701753 Changed config for tree-sitter to be grammar-based 2023-01-14 17:53:41 -03:00
confused_techie
2eab519e23
Merge pull request #209 from Sertonix/add-or-update-packages-package-lock.js
add or update `packages/*/package-lock.json`
2022-12-13 18:21:25 -08:00
confused_techie
8dac21178f
Merge pull request #190 from Daeraxa/pkg-brand-licence
Re-brand and re-licence core packages
2022-12-10 18:36:17 -08:00
Sertonix
aecb3cc5c3 add or update packages/*/package-lock.json 2022-12-10 19:13:50 +01:00
confused_techie
61d85c19a8
Merge branch 'master' into remove-coffeelint 2022-12-03 20:45:45 -08:00
Daeraxa
e5c40b5f35 rebrand and relicence 2022-12-03 02:46:08 +00:00
confused_techie
4359a15530
Merge pull request #157 from Sertonix/cleanup-packages-package.json
cleanup `packages/*/package.json`
2022-11-28 00:34:37 -08:00
confused_techie
c15f52be3f
Merge pull request #161 from Sertonix/remove-packages-readme-badges
remove badges `packages/*/README.md`
2022-11-21 19:36:26 -08:00
Sertonix
d9e092f16f remove badges from packages readme 2022-11-19 23:43:16 +01:00
Sertonix
457f1c90cb cleanup packages package.json 2022-11-19 17:06:46 +01:00
Sertonix
dc38473c26 remove packages ci 2022-11-19 16:37:54 +01:00
Sertonix
74f2f6d339 remove packages no-response.yaml 2022-11-19 16:21:08 +01:00
Sertonix
fdb78ea44c remove coffeelint 2022-11-19 16:10:43 +01:00
Sertonix
c131849694 remove unused .md 2022-10-28 12:48:13 +02:00
Maurício Szabo
18164b324e Bumped all languages to recent tree-sitter 2022-06-26 11:58:28 -03:00
steven nguyen
477b075db5 ➡️ Migrate all language packages
To make https://github.com/atom-community/atom/pull/386 reviewable,
that pr will be separated into many simpler prs. This is one of them.

This first commit does the following:
- update package.json
- update package-lock.json using `./script/build` which also seems to update `apm/package-lock.json`
- update packages/README.md
- clone all language packages. Specifically:
    - `mkdir packages/language-<all of them>`
    - `cd packages/about`
    - For all languages:
        - `cd ../language-<>`
        - `git clone language-<>`
        - Move all files except `.git` from `language-<>/language-<>`
          to `language-<>`
        - delete `language-<>/language-<>`

Since at first I accidentally updated `dependencies` then
`packageDependencies`, it appears that since the versions of language-c,
language-css, language-go, language-javascript, and language-sass don't
match, `dependencies` was reset for those versions.

[Those repos just happen to be precisely the ones that have tree-sitter v19](https://github.com/icecream17/atom-update-backlog/blob/main/Languages.md), (sans language-sass),
which [currently breaks atom](https://github.com/atom/atom/issues/22129). So even though their repos are now
in `packages`, **I've decided to not use them**.

This is done by updating `packageDependencies` only for non-breaking
languages.
2022-06-25 19:58:57 +00:00