Commit Graph

869 Commits

Author SHA1 Message Date
Piotr Osiewicz
b272db9e21
editor: Add language setting for comment continuations (#2605)
Per @JosephTLyons request I've added a language setting for comment
continuations.

Release Notes:

- Added a language setting for comment continuations.
2023-06-13 18:59:46 +02:00
Max Brunsfeld
01bd5c30fc Fix syntax map bug with combined injections inside of other injections 2023-06-12 17:32:20 -07:00
Max Brunsfeld
ac1882b99b Move SyntaxMap tests to their own file 2023-06-12 16:24:17 -07:00
Max Brunsfeld
56b749788f Improve the look of the syntax tree view UI 2023-06-12 15:14:57 -07:00
Max Brunsfeld
086cfe57c5 Start work on a syntax tree view 2023-06-12 15:14:56 -07:00
Max Brunsfeld
4b9a3c66e6 Show function parameters in elixir outline view
Introduce a new capture in the outline query called 'context.extra', which
causes text to appear in the outline, but not in the breadcrumbs.
2023-06-06 16:27:05 -07:00
Max Brunsfeld
6737ee1495 Avoid panic when failing to load a language's queries 2023-06-06 16:06:16 -07:00
Max Brunsfeld
7bfb51ee76 Live-reload tree-sitter queries in development 2023-06-06 14:20:21 -07:00
Joseph Lyons
7c60f636d5 Fix typos 2023-06-02 22:02:19 -04:00
Max Brunsfeld
0d281c1b89 🎨 2023-05-31 15:13:01 -07:00
Max Brunsfeld
0dd7694ff5 Make language_settings take a language, not a language name 2023-05-31 15:10:30 -07:00
Max Brunsfeld
03a351fb26 Make language settings accessors take an arc dyn file 2023-05-31 14:57:04 -07:00
Max Brunsfeld
a2ab7c9eb9 Respect project-specific settings for copilot 2023-05-31 14:42:15 -07:00
Max Brunsfeld
89446c7fd4 Start work on respecting project-specific settings 2023-05-29 14:25:49 -07:00
Max Brunsfeld
2db57b5139 Adjust diagnostic transformation test to not wait for two buffer notifications 2023-05-26 15:47:37 -07:00
Julia
5e39ba596e Clean up final remaining code paths calling old diff update method 2023-05-25 14:41:09 -04:00
Julia
8d662edb6c Remove concept of git diff refresh from Item trait 2023-05-25 14:29:28 -04:00
Julia
cede296b04 Project level git diff recalc handling
This avoids an issue where in a many-buffer multi-buffer, each modified
buffer could complete its recalc independently, causing a cascade of
repeated notifies

Now all recalcs started at the same time must complete before
 A: Starting another recalc pass
 B: The master notify occurring

Each buffer can still show its new diff if something else triggers it
to notify earlier, this is desirable and does not have the same negative
effects as the notify cascade as those re-layouts would need to happen
anyway

Co-Authored-By: Max Brunsfeld <max@zed.dev>
2023-05-25 14:10:27 -04:00
Max Brunsfeld
54421b11f3 wip 2023-05-25 14:10:27 -04:00
Nathan Sobo
747322a02d Merge remote-tracking branch 'origin/main' into zmd 2023-05-24 11:04:07 -06:00
Nathan Sobo
30de64845f WIP 2023-05-22 23:11:27 -06:00
Max Brunsfeld
7689cdf3f9 Clear old diagnostics when restarting a language server 2023-05-22 12:53:22 -07:00
Max Brunsfeld
e129ed2d91
Fix spurious setting error log messages (#2498)
Fixes a bug introduced in
https://github.com/zed-industries/zed/pull/2448, where error messages
would be logged if the user config didn't specify certain fields like
`journal` or `telemetry`.
2023-05-22 11:44:21 -07:00
Mikayla Maki
bbb68c523c
Refactored apart the forward and the backwards iterator for diff hunks 2023-05-19 18:09:47 -07:00
Max Brunsfeld
e32233c826 Fix spurious setting error logs on non-existent setting keys 2023-05-19 17:15:05 -07:00
Max Brunsfeld
847d1e73a3 Replace remaining usages of glob crate with globset 2023-05-19 09:36:46 -07:00
Julia
bd29812391
Avoid panic in get_injections (#2486) 2023-05-18 13:35:10 -04:00
Julia
5ab1ae1521 Avoid panic in get_injections 2023-05-18 12:23:49 -04:00
Max Brunsfeld
258723566f Rename settings::register_setting -> settings::register 2023-05-17 15:06:11 -07:00
Max Brunsfeld
2d5f03e148 Remove optional path argument when getting settings 2023-05-17 15:05:20 -07:00
Max Brunsfeld
67a25126d4 Define theme/ui text style settings in theme crate 2023-05-17 14:44:59 -07:00
Max Brunsfeld
d2ba18eae9 Customize language settings JSON schema in language crate 2023-05-17 09:26:36 -07:00
Max Brunsfeld
39618ae32d Define language settings in the language crate 2023-05-16 17:29:53 -07:00
Max Brunsfeld
4f8607039c Add is_tab field to chunks
Co-authored-by: Antonio Scandurra <antonio@zed.dev>
2023-05-08 19:36:51 +03:00
Kirill Bulatov
6cb0bc89d2 Remove unused dependencies 2023-05-07 21:07:55 +03:00
Julia
1883e260ce Offload text::Buffer construction to background worker
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2023-05-04 12:32:31 -04:00
Julia
3f7533a0b4 Show source of diagnostic hovers 2023-04-27 14:35:34 -04:00
Max Brunsfeld
ebbe52e6b0 🎨 Specify more dependencies at the workspace level 2023-04-24 17:41:55 -07:00
Max Brunsfeld
abdccf7393 Use a workspace dependency for the futures crate 2023-04-24 09:43:31 -07:00
Max Brunsfeld
32c57bcd22 Store buffer's diagnostic sets in a smallvec 2023-04-20 08:58:41 -07:00
Max Brunsfeld
0ebe44bfd5 Handle multiple language servers for a given path in project diagnostics view 2023-04-20 08:58:41 -07:00
Max Brunsfeld
4dd917c123 Introduce a LanguageServerId wrapper type
Clarify the meaning of all the usizes in use in all of these
struct fields an method signatures.
2023-04-20 08:58:41 -07:00
Julia
9e2949e7ba Refactor language server startup
Avoid parallel vecs

Co-Authored-By: Max Brunsfeld <max@zed.dev>
2023-04-20 08:58:41 -07:00
Julia
df94aee758 Fix failing tests
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2023-04-20 08:58:41 -07:00
Julia
6156dbced0 Finish getting multiple diagnostics sources building and running 2023-04-20 08:58:41 -07:00
Julia
bb4de47b15 Start getting diagnostics sets to work with multiple servers
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2023-04-20 08:58:41 -07:00
Julia
ba7233f265 Incomplete refactor to allow for multiple adapters per language 2023-04-20 08:58:39 -07:00
Antonio Scandurra
34bcf6f072 Reopen file in Copilot language server when language or URI changes 2023-04-20 09:34:20 +02:00
Max Brunsfeld
5934e882b8
Merge pull request #2379 from zed-industries/shebang
Select language based on a file's first content line in addition to its path
2023-04-18 17:31:19 -07:00
Max Brunsfeld
bd7d50f339 Fix 'invalid insertion' panic when following
Wait for the necessary buffer operations to arrive before attempting to
set selections and scroll top.
2023-04-18 16:13:18 -07:00
Max Brunsfeld
1dcd4717b1 Select language based on a file's first content line in addition to its path 2023-04-16 12:28:27 -07:00
Max Brunsfeld
25e3c4e586 Fix leak when project is unshared while LSP handler waits for edits 2023-04-10 17:03:58 -07:00
Nathan Sobo
de9bf6dfbd Merge MutableAppContext into AppContext
There may have been a good reason for the difference at some point, or I was
still learning Rust. But now it's just &mut AppContext vs &AppContext.
2023-04-06 15:49:03 -06:00
Mikayla Maki
81411b9114 Merge branch 'main' into copilot 2023-03-30 16:57:18 -07:00
Julia
cdde523ea4 Allow each language adapter to provide their own code action kinds array 2023-03-30 15:41:54 -04:00
Mikayla Maki
ae3b3ea458 Merge branch 'main' into copilot 2023-03-29 16:57:38 -07:00
Antonio Scandurra
a64296938d Delete unused code 2023-03-29 09:04:13 +02:00
Antonio Scandurra
5471217089 Use the same serde version across the entire workspace 2023-03-28 09:42:00 -07:00
Mikayla Maki
455cdc8b37 Add copilot crate
Refactor HTTP and github release downloading into util
Lazily download / upgrade the copilot LSP from Zed

Co-authored-by: Max <max@zed.dev>
Co-Authored-By: Antonio <antonio@zed.dev>
2023-03-28 09:41:59 -07:00
Julia
d4560fe321 Prevent deadlock when multiple languages attempt to install Node at once 2023-03-28 10:18:22 -04:00
Julia
df4380b066 Download aarch64 or x64 Node binary according to system architecture 2023-03-27 11:05:17 -04:00
Julia
c72d33e029 Initial impl of NodeRuntime w/JSON borked and a deadlock :)
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2023-03-27 00:00:16 -04:00
Julia
1a2e509e35 Remove server_args from LspAdapter
Prepare to remove concept of a runtime from greater server startup code,
which is important for future language server extensibility

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2023-03-27 00:00:16 -04:00
Julia
edd6c85af7 Initial running of servers on downloaded Node 2023-03-27 00:00:16 -04:00
Julia
b579211861 Report if language server requires Node or not 2023-03-27 00:00:16 -04:00
Nathan Sobo
195215f1e0 Add "editor: copy highlight json" command
Nate needs this to feed to Figma for highlighted code in designs.
2023-03-24 16:37:57 -06:00
Max Brunsfeld
361b7c3a0c Clear auto-indent requests when replacing a buffer's entire text 2023-03-22 15:10:16 -07:00
Max Brunsfeld
5da2b123b5 Allow refreshing worktree entries while the initial scan is in-progress 2023-03-21 15:15:12 -07:00
Max Brunsfeld
cbeb6e692d Move postage crate version specification to workspace Cargo.toml 2023-03-21 11:26:13 -07:00
Antonio Scandurra
1af8f4be19 Deserialize Theme directly into the heap to avoid stack overflow
Co-Authored-By: Julia Risley <julia@zed.dev>
2023-03-17 15:58:52 +01:00
Julia
757f05042d Fix deadlock while initializing JSON language server
As it turns out both parking-lot and std's `RwLock` disallows taking
multiple read locks on the same thread

Co-Authored-By: Max Brunsfeld <max@zed.dev>
2023-03-16 17:32:51 -04:00
Antonio Scandurra
88e664bfd9 Add test for language registration and loading 2023-03-16 10:46:55 +01:00
Antonio Scandurra
4d52fc0d12 Remove available language only when it has loaded
This also ensures that, if you load the same language more than once,
a future that resolves to the language (or an error) is returned at
all times. Previously, we would only return it the first time the language
was loaded.
2023-03-16 10:46:55 +01:00
Antonio Scandurra
a8ac08f5bd Coalesce multiple RwLocks into one LanguageRegistryState struct 2023-03-16 10:46:55 +01:00
Antonio Scandurra
e30ea43a14 Include loaded languages when computing lsp workspace configuration 2023-03-16 10:46:55 +01:00
Antonio Scandurra
60d3fb48e2 Start computing workspace configuration more dynamically 2023-03-16 10:46:55 +01:00
Joseph Lyons
3c7237e600 Sort language names case agnostically 2023-03-14 21:45:17 -04:00
Antonio Scandurra
7a600e7a65 Allow waiting for language to be loaded in LanguageRegistry APIs 2023-03-10 12:17:47 +01:00
Antonio Scandurra
a00ce3f286 Add randomized test to remove active selections from buffer 2023-03-09 07:47:05 +01:00
Antonio Scandurra
a435dc1339 Clear selections on buffer only if they hadn't been cleared already 2023-03-08 17:04:01 +01:00
Max Brunsfeld
124aa74b03
Merge pull request #2234 from zed-industries/error-on-combined-injections-in-injections
Fix range relativization when combined injections occur inside of other injections
2023-03-03 11:58:13 -08:00
Max Brunsfeld
a366ba19af 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
Max Brunsfeld
70cb2fa8d7 Apply external command formatting if buffer has changed while computing it 2023-03-01 10:17:04 -08:00
Max Brunsfeld
1deff43639 Avoid calling edits_since in apply_diff 2023-02-28 21:52:00 -08:00
Max Brunsfeld
a890b8f3b7 Add a setting for ensuring a single final newline on save 2023-02-28 21:52:00 -08:00
Max Brunsfeld
7faa0da5c7 Avoid finalizing transactions inside Buffer::apply_diff 2023-02-28 21:52:00 -08:00
Max Brunsfeld
ff85bc6d42 Add setting for removing trailing whitespace on save 2023-02-28 21:52:00 -08:00
Max Brunsfeld
b00e467ede Add APIs for stripping trailing whitespace from a buffer 2023-02-28 21:52:00 -08:00
Max Brunsfeld
a11165ad0a Add unit test for auto-closing quotation marks with overrides 2023-02-20 13:46:17 -08:00
Max Brunsfeld
8be844a13f Add test that loads all bundled languages 2023-02-20 10:53:37 -08:00
Max Brunsfeld
8922156923 Restructure how bracket pairs are overridden to unify lists
This way, a bracket pair that is disabled in a given scope can still be skipped, if
it was auto-closed before that scope existed.
2023-02-20 10:53:37 -08:00
Max Brunsfeld
2982a98d1c
Merge pull request #2187 from zed-industries/save-untitled-buffer-bugs
Fix newly-discovered bugs in saving untitled buffers
2023-02-20 10:05:58 -08:00
Max Brunsfeld
56b7eb6b6f Only send UpdateBufferFile messages for buffers whose files have changed
Send that message when saving a buffer as a new path.
2023-02-20 09:41:59 -08:00
Kay Simmons
ac3e8f61ef
Merge pull request #2186 from zed-industries/better-vim-matching-motion
Better vim matching motion
2023-02-17 22:10:28 -08:00
Kay Simmons
fc811d14b1 Fix failing test 2023-02-17 22:00:39 -08:00
Max Brunsfeld
3a7cfc3901 Move the save and save_as code paths close together 2023-02-17 17:21:48 -08:00
Kay Simmons
5e4d113308 fix bracket ranges failing test 2023-02-17 17:19:23 -08:00
Kay Simmons
57a7ff9a6f fix vim percent motion to better match the docs and observed behavior 2023-02-17 14:55:19 -08:00
Max Brunsfeld
eebce28b32 Respect UpdateBufferFile messages on guest buffers without file
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2023-02-17 12:38:04 -08:00
Max Brunsfeld
98b51634c4
Merge pull request #2182 from zed-industries/faster-injections
Fix syntax-related performance problems on gigantic files
2023-02-16 12:52:13 -08:00
Kay Simmons
eac33d732e wip 2023-02-16 12:23:45 -08:00
Kay Simmons
0ba051a754 use more predictable rules for selecting which bracket to jump to and where 2023-02-15 14:04:16 -08:00
Antonio Scandurra
6703264600 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
ddf4e1a316 Load languages lazily in the background 2023-01-25 17:47:46 -08:00
Max Brunsfeld
678ee26c5e Merge branch 'main' into markdown-fenced-blocks 2023-01-24 14:13:50 -08:00
Antonio Scandurra
dff08d3cfe Merge branch 'main' into markdown-fenced-blocks 2023-01-24 15:43:35 +01:00
Antonio Scandurra
c48e3f3d05 Reparse unknown injection ranges in buffer when adding a new language 2023-01-24 15:29:59 +01:00
Antonio Scandurra
f3509824e8 WIP: Start on SyntaxMapSnapshot::unknown_injection_languages 2023-01-24 12:55:49 +01:00
Antonio Scandurra
14c72cac58 Store syntax layers even if a language for the injection can't be found 2023-01-24 12:25:12 +01:00
Nathan Sobo
96ffe84edb Document Buffer::reparse 2023-01-23 21:51:10 -07:00
Mikayla Maki
d060114f00 Added complete scripts for generating third party license files 2023-01-23 12:47:12 -08:00
Antonio Scandurra
8dabdd1baa 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
79cf6fb8b6 WIP: Add test for dynamic language injection 2023-01-23 09:45:36 +01:00
Antonio Scandurra
cb610f37f2 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
36e4dcef16 Avoid allocating a string to compare language names 2023-01-23 08:56:41 +01:00
Antonio Scandurra
c49dc8d6e5 Rename LanguageRegistry::get_language to language_for_name 2023-01-23 08:56:41 +01:00
Max Brunsfeld
56080771e6 Add test for avoiding indent adjustment inside newly-created errors 2023-01-20 17:02:38 -08:00
Max Brunsfeld
f7ceebfce3 Avoid adjusting indentation of lines inside newly-created errors 2023-01-20 15:56:45 -08:00
Max Brunsfeld
8dcef46842 Drop 'override.' prefix from capture names in override query
Co-authored-by: Julia Risley <julia@zed.dev>
2023-01-20 10:44:33 -08:00
Max Brunsfeld
2aa7a9e95b Add overrides for all languages
Co-authored-by: Julia Risley <julia@zed.dev>
2023-01-20 10:39:31 -08:00
Max Brunsfeld
2967b46a17 Implement scope-specific bracket matching and comment toggling
Co-authored-by: Julia Risley <julia@zed.dev>
2023-01-19 15:04:27 -08:00
Max Brunsfeld
1851e2e77c Start work on language config overrides
Co-authored-by: Julia Risley <julia@zed.dev>
2023-01-19 12:32:08 -08:00
Antonio Scandurra
a58b39f884 Merge branch 'main' into optimize-large-multi-buffers 2023-01-19 16:18:21 +01:00
Max Brunsfeld
d9948bf772 Prevent outline items from accidentally spanning multiple lines 2023-01-18 16:43:18 -08:00
Antonio Scandurra
a653e87658 WIP: Avoid converting RopeFingerprint into a string
Co-Authored-By: Petros Amoiridis <petros@zed.dev>
2023-01-18 12:22:08 +01:00
Max Brunsfeld
1a6a807db5
Merge pull request #2035 from zed-industries/always-auto-indent-block-on-paste
Always auto-indent in block-wise mode when pasting
2023-01-17 10:24:41 -08:00
Antonio Scandurra
bb200aa082 Relay saved version metadata to ensure buffers modified state converges 2023-01-17 16:32:54 +01:00
Antonio Scandurra
467e5691b9 Include saved mtime and fingerprint when serializing buffers
This still doesn't include:

- An assertion in the randomized test to ensure buffers are not spuriously
marked as modified
- Sending an update when synchronizing buffers after a reconnection
2023-01-17 10:46:19 +01:00
Max Brunsfeld
0bd6f9b6ce Add a test for block-wise auto-indent without original indent info 2023-01-16 18:06:58 -08:00
Max Brunsfeld
244f259331 Always auto-indent in block-wise mode when pasting
If the text was copied outside of Zed, so the original indent column is unknown,
then act as if the first line was copied in its entirety.
2023-01-16 17:42:06 -08:00
Antonio Scandurra
ad7eaca443 Make Buffer::diff_base available outside of tests 2023-01-08 09:36:58 -07:00
Nathan Sobo
213658f1e9 Fix tests that failed due to defaulting the grouping interval to zero in tests 2023-01-06 17:56:21 -07:00
Max Brunsfeld
c321f5d94a Assert that buffers' file state matches in randomized collab test
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-12-21 15:38:44 -08:00
Antonio Scandurra
47348542ef Synchronize buffers when either the host or a guest reconnects 2022-12-21 14:20:56 +01:00
Julia
de9c58d216
Merge pull request #1983 from zed-industries/multi-buffer-git-gutter
Multi buffer git gutter
2022-12-19 10:53:42 -05:00
Julia
f88b413f6a Rewrite multi-buffer aware git hunks in range to be more correct
Less ad-hoc state tracking, rely more on values provided by the
underlying data

Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-12-15 17:09:09 -05:00
Julia
0dedc1f3a4 Get tests building again 2022-12-15 00:17:28 -05:00
Julia
00b7c78e33 Initial hacky displaying of git gutter in multi-buffers 2022-12-13 12:35:58 -05:00
Max Brunsfeld
6d9b55a654 Send full multibuffer anchors to following peers 2022-11-28 18:00:38 -08:00
Max Brunsfeld
0b0fe91545
Merge pull request #1912 from zed-industries/matching-brackets-must-contain-range
Fix enclosing-bracket bug that appeared in JS for loops
2022-11-23 13:44:48 -08:00
Max Brunsfeld
aeea47323a Fix enclosing-bracket bug that appeared in JS for loops
Previously, we were relying on the tree-sitter query's range restriction to
avoid returning brackets that did not contain the given range. But the
query's range restriction only guarantees that we don't descend into parent
nodes unless they intersect the range.
2022-11-23 13:37:22 -08:00
Julia
03cfd23ac5 Bump protocol version back down as proto changes are non-breaking 2022-11-23 13:40:49 -05:00
Julia
b58ae8bdd7 Clip diagnostic range before and during empty range expansion
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-11-23 13:21:05 -05:00
Julia
e51cbf67ab Fixup compile errors 2022-11-22 02:49:47 -05:00
Julia
8c75df30cb Wrap a bunch of traits for Unclipped<T> 2022-11-21 15:58:44 -05:00
Julia
1c84e77c37 Start adding concept of Unclipped text coordinates
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-11-21 15:48:25 -05:00
Julia
bb32599ded Clamp for all UTF-16 to offset conversions which used to use ToOffset 2022-11-21 14:25:01 -05:00
Max Brunsfeld
bca635e5d3 Add LspAdapter hook for processing completions, fix completion sorting from Pyright 2022-11-17 15:26:46 -08:00
Max Brunsfeld
b222e8eb5a Use a longer example text in random combined injections test 2022-11-14 16:56:21 -08:00
Max Brunsfeld
ee66adbb49 SyntaxMap - Don't ignore deletions at the boundaries of layers 2022-11-11 16:43:57 -08:00
Max Brunsfeld
9ad8731897 Fix boundary condition where injection was not found after an edit 2022-11-10 17:04:40 -08:00
Max Brunsfeld
7dcd6c920f Add randomized test for syntax map with combined injections 2022-11-08 11:29:23 -08:00
Max Brunsfeld
ea42bc3c9b Rename some sum_tree seek targets in SyntaxMap 2022-11-08 10:36:44 -08:00
Max Brunsfeld
86f51ade60 Fix panic in handling edits to combined injections 2022-11-07 17:32:15 -08:00
Max Brunsfeld
c838a7d973 Get combined injections basically working
Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Mikayla Maki <mikayla@zed.dev>
2022-11-07 16:58:12 -08:00
Max Brunsfeld
5efe2ed6d3 Start work on handling combined injections in SyntaxMap 2022-11-07 14:45:17 -08:00
Max Brunsfeld
be6ee3cbff Start work on ERB language support 2022-11-04 09:33:59 -07:00
Max Brunsfeld
d222904471 Add basic support for ruby
Co-authored-by: Kay Simmons <kay@zed.dev>
2022-11-03 15:52:33 -07:00
Julia
259a758849
Merge pull request #1800 from zed-industries/go-to-diff-hunk
Add action to go to next/previous git diff in editor
2022-10-31 14:38:52 -04:00
Max Brunsfeld
9cbb698b96 Fix panic when hitting tab at the beginning of a line with mixed tab/space indent 2022-10-31 10:51:20 -07:00
Julia
8361b4d47a Add test for go-to hunk and fix discovered bugs 2022-10-28 15:08:13 -04:00
Julia
c4b21a0ab5 Add action to go to next/previous git diff in editor
Co-Authored-By: Kay Simmons <kay@zed.dev>
2022-10-28 15:08:13 -04:00
Antonio Scandurra
476020ae84 Show shared screen as a pane item 2022-10-24 10:04:08 +02:00
Mikayla Maki
895aeb033f
Merge branch 'main' into breadcrumbs 2022-10-17 16:51:38 -07:00
K Simmons
40c3e925ad Add cursor blink setting and replicate cursor shape to remote collaborators 2022-10-17 16:20:47 -07:00
Mikayla Maki
19c98bb5ad fixed a bug where files outside of the project would show 'untitled' in the search bar 2022-10-17 12:58:48 -07:00
Max Brunsfeld
6cdf4e98fc Re-export basic text types from text and language crates
Also avoid production dependencies on fs and rope in collab
2022-10-12 15:48:19 -07:00
Antonio Scandurra
83d3fad80d Clear auto-indent requests if they couldn't be computed 2022-10-12 10:53:44 +02:00
Mikayla Maki
5487f99ac7 Moved settings_file.rs into settings crate. Should be ready to start now :D 2022-10-11 16:03:38 -07:00
Mikayla Maki
0beb97547e Finished refactoring out fs and rope 2022-10-11 15:25:54 -07:00
Julia
e15f27106d Reset buffer git diff when setting diff base to None
Co-Authored-By: Joseph Lyons <joseph@zed.dev>
2022-10-07 15:37:37 -04:00
Max Brunsfeld
63e1c839fe Rename language::tests -> language::buffer_tests 2022-10-06 13:32:49 -07:00
Max Brunsfeld
fe7a39ba5c Apply buffer diff edits as a single batch 2022-10-06 11:54:28 -07:00
Max Brunsfeld
51fa06cc8d
Merge pull request #1404 from zed-industries/html-support
Basic html support
2022-10-06 10:32:44 -07:00
Max Brunsfeld
b7e115a6a1 Add a test for multi-language auto-indent 2022-10-05 17:59:31 -07:00
Max Brunsfeld
7fb5fe036a Derive indent size from the language at the cursor when auto-indenting 2022-10-05 17:07:35 -07:00
Max Brunsfeld
aa86806408 Finish generalizing ToggleComments to support block comments 2022-10-05 12:25:32 -07:00
Max Brunsfeld
d9fb8c90d8 Start work on toggling block comments for HTML 2022-10-04 17:27:03 -07:00
Max Brunsfeld
c354b9b959 Add assertions to test for autoclose with embedded languages 2022-10-03 13:24:37 -07:00
Julia
e6487de069 Rename head text to indicate that it's not always going to be from head
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
2022-10-03 15:11:06 -04:00
Julia
c95646a298 WIP Start refactoring separation of concerns for repo metadata
Co-Authored-By: Max Brunsfeld <max@zed.dev>
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
2022-09-30 18:25:25 -04:00
Julia
ce7f6dd082 Start a test for remote git data updating
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-09-30 15:51:32 -04:00
Mikayla Maki
71b2126eca WIP, re-doing fs and fake git repos 2022-09-29 13:16:02 -04:00
Julia
d5fd531743 Move git related things into specialized git crate
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
2022-09-29 13:16:02 -04:00
Julia
bf3b3da6ed Build again 2022-09-29 13:16:02 -04:00
Julia
7e5d49487b WIP Notifying buffers of head text change
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
2022-09-29 13:16:02 -04:00
Julia
a679557e40 Avoid racing git diffs & allow for "as fast as possible" diff updating
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
2022-09-29 13:16:02 -04:00
Julia
b18dd8fcff Fully qualify outside git-related code when a diff is a git diff 2022-09-29 13:16:02 -04:00
Julia
6633c0b328 Perform initial file load git diff async 2022-09-29 13:16:02 -04:00
Julia
6825b6077a Properly invalidate when async git diff completes 2022-09-29 13:16:02 -04:00
Julia
9c82954877 Changed diffs to be async and dropped git delay 2022-09-29 13:16:02 -04:00
Julia
c4da8c46f7 Disable unnecessary libgit2 cargo features
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
2022-09-29 13:16:02 -04:00
Julia
b9d84df127 Track buffer row divergence while iterating through diff lines
This allows for offsetting head row index of deleted lines to normalize
into buffer row space
2022-09-29 13:16:02 -04:00
Julia
446bf88655 Use row range while building buffer range during diff line iteration 2022-09-29 13:16:02 -04:00
Julia
03b6f3e0bf Reorganize for for purely file level invalidation 2022-09-29 13:16:02 -04:00
Julia
e72e132ce2 Clear out commented code & once again perform full file diff on update 2022-09-29 13:16:02 -04:00
Julia
c1249a3d84 Handle deletions more robustly and correctly 2022-09-29 13:16:02 -04:00
Julia
96917a8007 Small clean 2022-09-29 13:16:02 -04:00
Julia
2f7283fd13 buffer_divergence doesn't seem to be a concept that needs to be tracked 2022-09-29 13:16:02 -04:00
Julia
e0ea932fa7 Checkpoint preparing for a more organized approach to incremental diff 2022-09-29 13:16:02 -04:00
Julia
4b2040a7ca Move diff logic back into BufferDiff::update 2022-09-29 13:16:02 -04:00
Julia
a2e8fc79d9 Switch head range from row range to byte offset range
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-09-29 13:16:02 -04:00
Julia
61ff24edc8 Move cloneable diff state into new snapshot type
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-09-29 13:16:02 -04:00
Julia
a86e93d46f Checkpoint on incremental diff sumtree shenanigans 2022-09-29 13:16:02 -04:00
Julia
883d5b7a08 Update git gutter status after debounced delay
Co-authored-by: Max Brunsfeld <max@zed.com>
2022-09-29 13:16:02 -04:00
Julia
fdda2abb78 Correct start/end of git diff hunks 2022-09-29 13:16:02 -04:00
Julia
55ca02351c Start painting some sort of hunk info, it's wrong but it's close
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-09-29 13:16:01 -04:00
ForLoveOfCats
2a14af4cde Load a file's head text on file load just to get started 2022-09-29 13:16:01 -04:00
Max Brunsfeld
4f44375abd Make Buffer::language_at fall back to Buffer::language
For languages with no grammar (plain text), there
will be no layers.
2022-09-28 13:38:54 -07:00
Max Brunsfeld
67e188a015 Add Buffer::language_at, update MultiBuffer to use it
Co-authored-by: Julia Risley <floc@unpromptedtirade.com>
2022-09-28 12:32:04 -07:00
Max Brunsfeld
21fb2b9bf1 Tweak HTML indents and highlights 2022-09-28 12:32:04 -07:00
Max Brunsfeld
0777af1dd3 Fix crash when querying for enclosing brackets at EOF 2022-09-02 10:23:46 -07:00
Mikayla Maki
ebae991cb2 Finished terminal search 2022-09-01 13:45:46 -07:00
Max Brunsfeld
d4bbf21650
Merge pull request #1559 from zed-industries/language-injection
Add language injection support
2022-08-30 11:54:00 -07:00
Max Brunsfeld
a38c6015db Fix bugs in SyntaxMap::interpolate found by the randomized test 2022-08-29 16:52:58 -07:00
Max Brunsfeld
1746ec573a Check invariants after interpolating tree in random syntax map test 2022-08-29 16:16:11 -07:00
Max Brunsfeld
74a2b093ab Start work on randomized test for SyntaxMap, fix discovered bugs 2022-08-25 17:49:39 -07:00
Max Brunsfeld
1f12186e3c Update to latest tree-sitter commit
This is needed for https://github.com/tree-sitter/tree-sitter/pull/1845
2022-08-25 10:58:46 -07:00
Max Brunsfeld
61b70b7e2d Fix re-parsing when buffer's language has changed 2022-08-24 15:32:42 -07:00
Max Brunsfeld
015b6c4a31 Fix test about auto-indent with no indent query 2022-08-24 15:29:07 -07:00
Max Brunsfeld
b3f4c73264 Clean up some of buffer's syntax-related methods 2022-08-24 15:11:26 -07:00
Max Brunsfeld
3245e4f8d7 Fix out-of-range panic when requesting outline items at EOF 2022-08-24 15:10:53 -07:00
Max Brunsfeld
587175d0ea Update syntax map's interpolated version when a parse completes 2022-08-24 15:09:10 -07:00
Max Brunsfeld
ced45cbb0a Use SyntaxMap in Buffer 2022-08-24 13:00:27 -07:00
Max Brunsfeld
9113c94371 Add SyntaxMap methods for running queries and combining their results 2022-08-23 14:26:09 -07:00
Max Brunsfeld
71e17a54ae Fix case where layers were processed linearly when reparsing 2022-08-23 09:38:03 -07:00
Antonio Scandurra
f0d35ccc50 Move operation serialization off the main thread 2022-08-23 16:34:25 +02:00
Antonio Scandurra
954695f5fe Stream buffer ops in the background when creating buffer for peers 2022-08-23 16:05:56 +02:00
Antonio Scandurra
ec48ffc9da Simplify proto::Buffer to express its fields in terms of operations 2022-08-23 12:40:20 +02:00
Max Brunsfeld
ae9e1338f6 Fix more bugs in syntax map interpolation 2022-08-22 17:52:14 -07:00
Max Brunsfeld
58fda5ac1c Test more editing patterns of SyntaxMap, fix bugs 2022-08-22 15:36:58 -07:00
Max Brunsfeld
e8548e7732 Restructure handling of changed regions when reparsing 2022-08-21 11:39:02 -07:00
Max Brunsfeld
5209e2d68c Fix off-by-one in handling edits, start on more edit unit tests 2022-08-21 11:37:17 -07:00
Max Brunsfeld
02f8705f2e Start work on handling edits in the SyntaxMap 2022-08-21 11:37:10 -07:00
Max Brunsfeld
f6a817a0f3 Start work on a SyntaxMap data structure 2022-08-21 11:37:10 -07:00
Antonio Scandurra
9c9bf07e40 Create buffers for remote collaborators out of band
Previously, we would use `Project::serialize_buffer_for_peer` and
`Project::deserialize_buffer` respectively in the host and in the
guest to create a new buffer or just send its ID if the host thought
the buffer had already been sent.

These methods would be called as part of other methods, such as
`Project::open_buffer_by_id` or `Project::open_buffer_for_symbol`.
However, if any of the tasks driving the futures that eventually
called `Project::deserialize_buffer` were dropped after the host
responded with the buffer state but (crucially) before the guest
deserialized it and registered it, there could be a situation where
the host thought the guest had the buffer (thus sending them just the
buffer id) and the guest would wait indefinitely.

Given how crucial this interaction is, this commit switches to creating
remote buffers for peers out of band. The host will push buffers to guests,
who will always refer to buffers via IDs and wait for the host to send them,
as opposed to including the buffer's payload as part of some other operation.
2022-08-17 11:55:36 +02:00
Antonio Scandurra
ab236a6008 Fix divergence bug in undo/redo
As part of #1405, we changed the way we performed undo and redo to
support combining transactions that were not temporally adjacent for
IME purposes.

We introduced a bug with that release that caused divergence
when performing undo: the bug was caused by only changing the visibility
of fragments whose insertion id was contained in the undo operation. However,
an undo operation also affects deletions which we were mistakenly not
considering. Randomized tests caught this but I guess we didn't run enough
of them.
2022-08-17 11:30:04 +02:00
K Simmons
9aa3f2d777 clippy fixes for focus change 2022-08-10 16:51:01 -07:00
ForLoveOfCats
8ba2f77148 One big cleanup pass of clippy lints
Co-authored-by: Mikayla <mikayla@zed.dev>
2022-08-10 16:51:01 -07:00
Julia
8115c1ab24
Merge pull request #1451 from zed-industries/tab-auto-indent
Auto-indent on tab for cursors left of the suggested indent level
2022-08-02 15:52:12 -04:00
Antonio Scandurra
71128d2ee6 Compute diffs based on characters rather than lines
Previously, a change on a given line would cause that whole line to be
replaced. In turn, this caused anchors on that line to go to the start
of that line because they would lie inside of a deleted region after applying
the diff.

By switching to a character-wise diff, we perform smaller edits to the buffer
which stabilizes anchor positions.
2022-08-02 16:52:37 +02:00
Max Brunsfeld
115677ec5d Start work on auto-indenting lines on tab
Co-authored-by: Julia Risley <floc@unpromptedtirade.com>
2022-08-01 16:47:59 -07:00
Max Brunsfeld
04e40608a0 Fix mistakes in editor auto-indent test 2022-08-01 11:02:29 -07:00
Max Brunsfeld
868c460620 🎨 Rename and simplify some autoindent stuff 2022-07-28 22:40:30 -07:00
Max Brunsfeld
7a26fa18c7 Record start columns when writing to the clipboard from Zed 2022-07-28 22:13:32 -07:00
Max Brunsfeld
2d05f906f1 Start work on adjusting pasted text based on old start column 2022-07-28 17:29:42 -07:00
Max Brunsfeld
fa5af4383d Introduce AutoindentMode parameter to Buffer::edit
This controls whether or not we preserve the relative indentation
of inserted text blocks.

Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
2022-07-28 14:03:31 -07:00
Max Brunsfeld
cdf6ae25bb Remove indent_size parameter from Buffer::edit_with_autoindent
Instead, compute the indent size by reading the settings inside that method.

Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
2022-07-28 13:00:05 -07:00
Max Brunsfeld
b1b252ee45 Fix error in autoindent range calculation 2022-07-28 11:51:03 -07:00
Max Brunsfeld
f547c268ce Restructure autoindent to preserve relative indentation of inserted text 2022-07-26 17:43:43 -07:00