Commit Graph
75 Commits
Author SHA1 Message Date
Piotr Osiewicz 9c146ec1dc chore: Clippy fixes for 1.80 (#13987)
The biggest hurdle turned out to be use of `Arc<Language>` in maps, as
`clippy::mutable_key_type` started triggering on it (due to - I suppose
- internal mutability on `HighlightMap`?). I switched over to using
`LanguageId` as the key type in some of the callsites, as that's what
`Language` uses anyways for it's hash/eq, though I've still had to
suppress the lint outside of language crate.

/cc @maxdeviant , le clippy guru.

Release Notes:

- N/A
2024-07-10 17:53:17 +02:00
Piotr Osiewicz e64f48b3f1 chore: Fix clippy for upcoming 1.79 Rust release (#12727)
1.79 is due for release in a week.
Release Notes:

- N/A
2024-06-06 12:46:53 +02:00
Piotr OsiewiczandMikayla 3ebec73bb1 Add support for detecting tests in source files, and implement it for Rust (#11195)
Continuing work from #10873 

Release Notes:

- N/A

---------

Co-authored-by: Mikayla <mikayla@zed.dev>
2024-05-05 16:32:48 +02:00
Max BrunsfeldandMarshall ccd61d72e4 More fixes to the semantic index's chunking (#11376)
This fixes a tricky intermittent issue I was seeing, where failed to
chunk certain files correctly because of the way we reuse Tree-sitter
`Parser` instances across parses.

I've also accounted for leading comments in chunk boundaries, so that
items are grouped with their leading comments whenever possible when
chunking.

Finally, we've changed the `debug project index` action so that it opens
a simple debug view in a pane, instead of printing paths to the console.
This lets you click into a path and see how it was chunked.

Release Notes:

- N/A

---------

Co-authored-by: Marshall <marshall@zed.dev>
2024-05-03 19:00:18 -07:00
Max Brunsfeld 9c01bfd10b Use outline queries to chunk files syntactically (#11283)
This chunking strategy uses the existing `outline` query to chunk files.
We try to find chunk boundaries that are:

* at starts or ends of lines
* nested within as few outline items as possible

Release Notes:

- N/A
2024-05-02 12:28:21 -07:00
Max BrunsfeldandConrad c11e118d04 Don't panic when a tree-sitter parse fails (#11076)
Fixes
https://zed-industries.slack.com/archives/C04S6T1T7TQ/p1714162894982749

Release Notes:
* Fixed a crash that could happen if an error occurred in a parser
provided by an extension.

Co-authored-by: Conrad <conrad@zed.dev>
2024-04-26 16:59:35 -06:00
Marshall Bowers 3b3be0b5fb Enable clippy::iter_overeager_cloned (#8839)
This PR enables the
[`clippy::iter_overeager_cloned`](https://rust-lang.github.io/rust-clippy/master/index.html#/iter_overeager_cloned)
rule and fixes the outstanding violations.

Release Notes:

- N/A
2024-03-04 12:22:11 -05:00
Marshall Bowers 20437044d5 Enable clippy::useless_conversion (#8767)
This PR enables the
[`clippy::useless_conversion`](https://rust-lang.github.io/rust-clippy/master/index.html#/useless_conversion)
rule and fixes the outstanding violations.

Release Notes:

- N/A
2024-03-03 10:22:55 -05:00
Marshall Bowers 9da3eef9e1 Enable clippy::too_many_arguments (#8734)
This PR enables the
[`clippy::too_many_arguments`](https://rust-lang.github.io/rust-clippy/master/index.html#/too_many_arguments)
rule.

I opted to add `#[allow(clippy::too_many_arguments)]` on the individual
violations, as reworking them to take fewer arguments is a more involved
task.

Release Notes:

- N/A
2024-03-02 18:42:05 -05:00
Marshall Bowers 86e31db1fb Enable clippy::clone_on_copy (#8728)
This PR enables the
[`clippy::clone_on_copy`](https://rust-lang.github.io/rust-clippy/master/index.html#/clone_on_copy)
rule and fixes the outstanding violations.

Release Notes:

- N/A
2024-03-02 17:37:48 -05:00
Marshall Bowers aea1b34132 Enable clippy::useless_conversion (#8724)
This PR enables the
[`clippy::useless_conversion`](https://rust-lang.github.io/rust-clippy/master/index.html#/useless_conversion)
rule and fixes the outstanding violations.

Release Notes:

- N/A
2024-03-02 16:31:47 -05:00
Max BrunsfeldandMarshall 6f653d78b2 Unload languages when uninstalling their extension (#7743)
Release Notes:

- N/A

Co-authored-by: Marshall <marshall@zed.dev>
2024-02-13 15:25:54 -05:00
Mikayla MakiandNathan 9941122e44 WIP: Add a setting to visually redact enviroment variables (#7124)
Release Notes:

- Added bash syntax highlighting to `.env` files. 
- Added a `private_files` setting for configuring which files should be
considered to contain environment variables or other sensitive
information.
- Added a `redact_private_values` setting to add or remove censor bars
over variable values in files matching the `private_files` patterns.
-(internal) added a new `redactions.scm` query to our language support,
allowing different config file formats to indicate where environment
variable values can be identified in the syntax tree, added this query
to `bash`, `json`, `toml`, and `yaml` files.

---------

Co-authored-by: Nathan <nathan@zed.dev>
2024-01-31 11:42:09 -08:00
Piotr Osiewicz a8f1c15a1e chore: Fix clippy::needless_borrow up to an editor 2024-01-21 15:03:24 +01:00
Max Brunsfeld f6903874f7 Start work on API docs for the language crate (#3981) 2024-01-19 10:04:45 -08:00
Marshall Bowers 8602fa9ece Update tenses of doc comment summary lines (#4161)
This PR updates the tenses used by the summary line of doc comments to
match the [Rust API documentation
conventions](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#summary-sentence).

Specifically:

> The summary line should be written in third person singular present
indicative form. Basically, this means write ‘Returns’ instead of
‘Return’.

I'm sure there are plenty occurrences that I missed.

Release Notes:

- N/A
2024-01-19 11:18:50 -05:00
Max Brunsfeld 654c04da42 Document DiagnosticSet, SyntaxMap 2024-01-18 15:44:24 -08:00
Max Brunsfeld 3476876292 More docs 2024-01-09 10:53:57 -08:00
Max BrunsfeldandMikayla 8e704c8a47 Remove 2 suffix for lsp, language, fuzzy
Co-authored-by: Mikayla <mikayla@zed.dev>
2024-01-03 11:58:02 -08:00
Max Brunsfeld e9a866b3b6 Start work on supporting custom languages 2024-01-02 08:01:59 -08:00
Max Brunsfeld 0596c2f103 Format let-else statements 2023-08-25 10:11:32 -07:00
Max Brunsfeld 7dd3b13932 Upgrade Tree-sitter for error recovery bug fix 2023-08-18 11:31:40 -07:00
Max Brunsfeld 14a6e54cfb Include newlines in between combined injection ranges on different lines 2023-07-14 09:25:56 -07:00
Max Brunsfeld 5046491590 Find the layer with the smallest enclosing node in language_scope_at 2023-07-14 09:11:56 -07:00
Piotr Osiewicz fc1830dd9b chore: Replace lazy_static Mutex with const. (#2693)
Mutex::new() is const-stable as of Rust 1.63.

Release Notes:
- N/A
2023-07-07 15:07:12 +02:00
Max Brunsfeld 995045efa7 Fix bugs in handling combined injections exposed by HEEx 2023-06-27 15:08:26 -07:00
Nathan Sobo e526fd506e Rename SumTree::push_tree to ::append 2023-06-19 19:49:33 -06:00
Max Brunsfeld 9823a67a47 Fix syntax map bug with combined injections inside of other injections 2023-06-12 17:32:20 -07:00
Max Brunsfeld 9a72f66b72 Move SyntaxMap tests to their own file 2023-06-12 16:24:17 -07:00
Max Brunsfeld a3435cd0b0 Start work on a syntax tree view 2023-06-12 15:14:56 -07:00
Joseph Lyons 4b5a7ec94a Fix typos 2023-06-02 22:02:19 -04:00
Julia df8d555a8e Avoid panic in get_injections 2023-05-18 12:23:49 -04:00
Antonio Scandurra 28df591385 Allow waiting for language to be loaded in LanguageRegistry APIs 2023-03-10 12:17:47 +01:00
Max BrunsfeldandAntonio Scandurra 4781d70974 Fix range relativization when combined injections occur inside of other injections
For example, ERB template inside of a markdown code block

Co-authored-by: Antonio Scandurra <antonio@zed.dev>
2023-03-01 14:38:35 -08:00
Antonio ScandurraandMax Brunsfeld 53d16a50a6 Limit BufferSnapshot::chunks to the outline item range
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2023-02-13 19:57:15 +01:00
Max Brunsfeld 278116bc25 Load languages lazily in the background 2023-01-25 17:47:46 -08:00
Antonio Scandurra ae95a0188e Reparse unknown injection ranges in buffer when adding a new language 2023-01-24 15:29:59 +01:00
Antonio Scandurra cdb95382ec WIP: Start on SyntaxMapSnapshot::unknown_injection_languages 2023-01-24 12:55:49 +01:00
Antonio Scandurra 309d76c932 Store syntax layers even if a language for the injection can't be found 2023-01-24 12:25:12 +01:00
Antonio ScandurraandMax Brunsfeld d1bb98c27b Ensure injection layer is recomputed when language changes
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2023-01-23 19:02:06 +01:00
Antonio Scandurra 4157175324 WIP: Add test for dynamic language injection 2023-01-23 09:45:36 +01:00
Antonio Scandurra 53db679c84 WIP: Search language injections also by file extension
There are still a few things left:

1. Add test to verify we can successfully locate a language by its extension
2. Add test to reproduce bug where changing the fenced code block language
   won't reparse the block with the new language
3. Reparse injections for which we couldn't find a language when the language
   registry changes.
4. Check why the markdown grammar considers the trailing triple backtick as
   `(code_block_content)`, as opposed to being part of the outer markdown.
2023-01-23 08:56:41 +01:00
Antonio Scandurra 366000e263 Rename LanguageRegistry::get_language to language_for_name 2023-01-23 08:56:41 +01:00
Max Brunsfeld 71b684108d Add test for avoiding indent adjustment inside newly-created errors 2023-01-20 17:02:38 -08:00
Max BrunsfeldandJulia Risley 786ff5ab05 Start work on language config overrides
Co-authored-by: Julia Risley <julia@zed.dev>
2023-01-19 12:32:08 -08:00
Max Brunsfeld b395c72047 Use a longer example text in random combined injections test 2022-11-14 16:56:21 -08:00
Max Brunsfeld 7e96dddb53 SyntaxMap - Don't ignore deletions at the boundaries of layers 2022-11-11 16:43:57 -08:00
Max Brunsfeld 791142ab59 Fix boundary condition where injection was not found after an edit 2022-11-10 17:04:40 -08:00
Max Brunsfeld ab63f71a20 Add randomized test for syntax map with combined injections 2022-11-08 11:29:23 -08:00
Max Brunsfeld 9e9f1727ed Rename some sum_tree seek targets in SyntaxMap 2022-11-08 10:36:44 -08:00