Commit Graph
379 Commits
Author SHA1 Message Date
Antonio Scandurra c6254247c3 Allow providing an external format in format_on_save setting 2022-07-07 11:04:03 +02:00
Antonio ScandurraandMax Brunsfeld 2c1906d710 Normalize line endings when parsing completions
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-07-06 19:32:45 +02:00
Antonio Scandurra d3db700db4 Fix panic on paste when editing with auto-indent
Instead of accepting text as it's input by the user, we will read it
out of the edit operation after it gets sanitized by the buffer.
2022-07-06 19:00:11 +02:00
Max BrunsfeldandKeith Simmons 7e9beaf4bb Strip carriage returns from all text in text::Buffer
* Moving the logic from Rope to text::Buffer makes it easier
  to keep the Rope in sync with the fragment tree.
* Removing carriage return characters is lossier, but is much
  simpler than incrementally maintaining the invariant that
  there are no carriage returns followed by newlines. We may
  want to do something smarter in the future.

Co-authored-by: Keith Simmons <keith@zed.dev>
2022-07-05 17:25:09 -07:00
Max Brunsfeld 116fa92e84 Change Buffer constructors to construct the History internally 2022-07-05 14:51:52 -07:00
Antonio Scandurra eac76df0ac Transmit new line ending when buffer is reloaded 2022-07-05 08:01:14 +02:00
Max Brunsfeld 9804c683c0 Rename NewlineStyle -> LineEnding 2022-07-04 12:47:40 -07:00
Max Brunsfeld 0ba12eab22 Handle a file's line endings changing on disk 2022-07-04 12:30:28 -07:00
Antonio Scandurra d80ecb6f98 Ignore carriage returns when reloading buffer 2022-07-04 17:40:35 +02:00
Antonio Scandurra 3480b50920 Detect buffer newline style and honor it when saving 2022-07-04 17:40:26 +02:00
Max Brunsfeld fae1cc36d6 In most languages, use prev non-empty line as basis for preserving indent 2022-06-28 12:21:54 -07:00
Max Brunsfeld 929615964d Add new indentation features to support Python 2022-06-27 22:34:14 -07:00
Max Brunsfeld c0dbd8f9b9 Add python outline and bracket queries 2022-06-22 16:28:09 -07:00
Max BrunsfeldandAntonio Scandurra e9d19457d6 Add failing test for replication of lsp statuses
Co-authored-by: Antonio Scandurra <me@as-cii.com>
2022-06-21 11:27:08 -07:00
Antonio Scandurra ae2273b40a Merge pull request #1204 from zed-industries/accurate-is-dirty
Determine `Buffer::is_dirty` based on the rope's fingerprint
2022-06-17 16:08:07 +02:00
Antonio Scandurra 4f215a77cd Don't compute fingerprint for every text summary 2022-06-17 15:15:27 +02:00
Antonio Scandurra 6f7a893ec9 Determine Buffer::is_dirty based on the rope's fingerprint 2022-06-17 12:38:25 +02:00
Max Brunsfeld 216a275ef2 Disable auto-indent entirely for markdown 2022-06-16 14:20:09 -07:00
Antonio Scandurra dc75b70724 Use word boundaries instead of syntax to infer completion edit ranges 2022-06-16 11:27:22 +02:00
Antonio Scandurra 4e4210ac39 Open a buffer for every language server error when clicking on status 2022-06-16 10:00:29 +02:00
Keith Simmons dddfc7beae Add hover test and tweak dismiss logic 2022-06-09 17:03:45 -07:00
Max Brunsfeld 87ba68e3ea Merge pull request #1155 from zed-industries/golang
Add Go support
2022-06-09 14:18:37 -07:00
Max Brunsfeld 7bb7187619 Add tests and fix bugs for editor indent/outdent commands w/ hard tabs 2022-06-09 10:26:09 -07:00
Max Brunsfeld 77b9ab0885 Add buffer test for autoindent with hard tabs 2022-06-09 09:05:07 -07:00
Antonio Scandurra 36a1a7a819 Start/stop language servers when enable_language_server changes 2022-06-09 10:08:11 +02:00
Max Brunsfeld f62fd3cddd Add support for hard tabs
* Add a `hard_tabs` setting that causes indentation to be performed
  using a tab instead of multiple spaces.
* Change Buffer's indentation-related APIs to return an `IndentSize`
  struct with a length and a kind, instead of just a single u32.
* Use hard tabs by default in Go.
2022-06-08 18:30:10 -07:00
Antonio Scandurra 712d47d94f Render a "Jump to Buffer" icon on all excerpt headers 2022-06-08 15:31:29 +02:00
Antonio Scandurra eda569d6b2 Snapshot file instead of path when creating a buffer snapshot 2022-06-08 14:29:14 +02:00
Max Brunsfeld 8f4387a252 Start work on installing gopls 2022-06-07 18:38:37 -07:00
Keith Simmons b014352740 Syntax highlighting working. Getting started on markdown support 2022-06-07 11:54:33 -07:00
Antonio Scandurra 70afc06666 Handle out-of-order edits coming from LSP 2022-06-06 16:15:11 +02:00
Antonio Scandurra 8826ad5ddd Make Buffer::edit and MultiBuffer::edit resilient to inverted ranges
Previously, we would accept edits containing out-of-order ranges. When
generating such ranges in our randomized tests, many invariants started
breaking causing e.g. undo/redo to misbehave and operation application
to panic.

In theory, we should never pass inverted ranges, but this commit changes
the above functions to swap the start and the end when that occurs to avoid
breaking the entire system and panicking.
2022-06-06 15:22:36 +02:00
Antonio Scandurra 8ca0127658 Make LspAdapter::process_diagnostics optional 2022-06-03 10:56:26 +02:00
Keith Simmons d7d17b2148 WIP line mode operations 2022-05-26 17:02:05 -07:00
Antonio Scandurra 8ebefa143a Upgrade tree-sitter to v0.20.6
This commit also adds a regression test to verify that with this new
version we don't mistakenly compute a different suggestion on Rust
buffer where the only change is leading whitespace.
2022-05-24 14:13:11 +02:00
Max BrunsfeldandNathan Sobo 3dee656490 Avoid panic when language server is dropped before being initialized in tests
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-05-09 18:05:10 -07:00
Keith Simmons d4bef67cf2 Merge pull request #929 from zed-industries/non-uniform-batched-edits
Allow batched edits where each range is associated with different insertion text
2022-04-29 16:14:38 -07:00
Keith Simmons b4b61b4bbc Consolidate edit and edit_batched functions 2022-04-28 16:52:04 -07:00
Keith Simmons 4c860dc82f Removed unnecessary debug statements 2022-04-28 09:20:56 -07:00
Antonio Scandurra 76d6c00e0c Fix randomized collaboration tests in language 2022-04-28 10:12:10 +02:00
Max BrunsfeldandKeith Simmons e05793b52a Remove Option from Buffer edit APIs
Previously, buffer edits represented empty strings as None
variants of an Option. Now, the edit logic just explicitly
checks for empty strings.

Co-authored-by: Keith Simmons <keith@zed.dev>
2022-04-27 18:00:13 -07:00
Keith Simmons 04fc1d5982 Building, but failing test WIP 2022-04-27 17:25:38 -07:00
Antonio ScandurraandNathan Sobo cde5a45318 Clip scroll_top_row before navigating back to it
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-04-27 16:25:26 +02:00
Max Brunsfeld 45922603f8 Infer completions old ranges based on the syntax tree 2022-04-25 13:14:05 -07:00
Max Brunsfeld d12df4224a Merge pull request #894 from zed-industries/typescript-outline-fixes
Fix missing TypeScript outline entries and breadcrumbs
2022-04-22 14:21:46 -07:00
Max Brunsfeld bfec9e1ec2 Fix missing TypeScript outline entries and breadcrumbs 2022-04-22 13:49:03 -07:00
Max Brunsfeld 03d7035630 Avoid spurious highlight runs in Language::highlight_text 2022-04-22 13:13:54 -07:00
Max Brunsfeld f52050a9ec Use the 'jsonc' language id for all JSON files
This way, comments are allowed by the language server.
2022-04-21 12:08:16 -07:00
Antonio Scandurra f9e0899e58 Fix divergence bug when peer reconnects reusing a prior replica id
We forgot to observe the footprint of the reconnecting replica's prior
undos into the local clock. This could cause the replica to generate
edits with a version strictly smaller than what other peers may have
observed. As such, those peers would think they had already seen those
edits and skip them.
2022-04-11 13:17:47 +02:00
Keith Simmons 3e40b5bead dynamically inject theme names and language properties into schema 2022-04-07 18:15:02 -07:00