Commit Graph
11610 Commits
Author SHA1 Message Date
Kirill Bulatov 2b2e52bbbd Log LSP inlay hint path 2023-08-26 13:46:55 +03:00
Kirill Bulatov a04aa82af7 Limit LSP non-invalidating queries 2023-08-26 13:06:50 +03:00
Kirill Bulatov ae553a89cc Remove query ranges for failed inlay hint requests 2023-08-26 12:09:12 +03:00
Mikayla Maki e357027d4c Server-sent feature flags (#2894)
This PR adds the wiring to both the server and the client for sending
and receiving individual feature flags, as well as a client side API for
convenient access to these feature flags.

Release Notes:

- N/A
2023-08-25 17:11:33 -07:00
Kirill Bulatov 5ad700bde4 Fix inlay hint bugs (#2895)
* https://github.com/zed-industries/zed/pull/2891

Fixes ranges pointing at incorrect positions inside multi-codepoint
characters

* https://github.com/zed-industries/zed/pull/2890

Defers hint links' document URL resolution into buffer up until the
hover & cmd-click is made by the user.

Release Notes:

- N/A
2023-08-26 03:09:19 +03:00
Mikayla 1aa69013de Add feature flags handling to the client, rewrite staff mode to a trait extension style 2023-08-25 17:00:53 -07:00
Kirill Bulatov 9672f8a9fe Fix the test 2023-08-26 03:00:53 +03:00
Kirill Bulatov e317b0cfef Properly clip request offsets 2023-08-26 02:54:50 +03:00
Kirill Bulatov eab9b71703 Consider padding during hint highlight range mapping 2023-08-26 02:45:08 +03:00
Kirill Bulatov e9d47670f7 Defer navigation target buffer opening 2023-08-26 02:45:08 +03:00
Kirill Bulatov 302d90f819 Do not convert lsp::Location of hint labels before resolve 2023-08-26 02:45:08 +03:00
Max Brunsfeld 768fffa61b Fix bugs in autoscroll with 'fit' strategy (#2893)
This fixes a bug where text moved up and down by one pixel in the buffer
search query editor, while typing.

Release  notes:
* Fixed a bug where editors didn't auto-scroll when typing if all
cursors could not fit within the viewport.
2023-08-25 16:36:33 -07:00
Piotr OsiewiczandJulia Risley f5c0e79be1 Un serialize project search (#2857)
This is the first batch of improvements to current project search. There
are few things we can do better still, but I want to get this out in
next Preview.
Most of the slowness at this point seems to stem from updating UI too
often.

Release Notes:
- Improved project search by making it report results sooner.

---------

Co-authored-by: Julia Risley <julia@zed.dev>
2023-08-26 01:31:52 +02:00
Max BrunsfeldandNathan b50ee14c60 Fix bugs in autoscroll with 'fit' strategy
* Scroll to the newest cursor if all cursors can't fit in the viewport.
* Refuse to layout an editor less tall than one line height.

Co-authored-by: Nathan <nathan@zed.dev>
2023-08-25 16:13:12 -07:00
Mikayla 60ecd0b28d Update database and RPC to provide configured feature flags 2023-08-25 14:34:32 -07:00
Conrad Irwin 548218effc relative line numbers (#2887)
- Add relative_line_mode
- vim change for wrapped lines

Release Notes:

- Add a `relative_line_numbers` setting
([#988](https://github.com/zed-industries/community/issues/998)).
2023-08-25 14:17:41 -06:00
Joseph T. Lyons b5dc58887d Add setting to automatically enable virtual environment (#2882)
This isn't ready to go - I'm opening a PR to ask for some advice. When
activating a python virtual environment, the typical command used is
`source path_to_venv/bin/activate`. The problem is, the activatate
script isn't portable to all shells, so some additional scripts are
bundled in the env, for example, `activate.fish`. We don't have a good
way of knowing what shell we are in, in order to know what script to
run.

Julia gave the alternative of simply activating the virtual environment
while in the zsh context, before the user's custom shell is launched,
which I think does work, but because we activate the virtual environment
before we launch the custom shell, the shell isn't really aware that we
are in the virtual environment and it fails to display the information
in the prompt that is typically shown after activating.

Is there a clean way for us to know for a fact what shell is being ran,
so we know what script to run?

Check out the code comments below for more context.

---


https://github.com/zed-industries/zed/assets/19867440/ddb76aaa-152b-4c93-a513-3cd580b7c40f

I've used Zed to write Python scripts, but working on an actual project
has really magnified where Python dev is falling short. A huge
quality-of-life thing we can do is provide a setting to automaticaly
search for and activate virtual environments when found, when terminals
are created. Manually starting these up in every terminal instance is
such a drag.

A few quirks:
- We don't have a way of knowing if the prompt is ready before we try
run the command, which means we see the text inserted at the top of the
terminal and on the prompt - I dont think this should be a blocker
though.
- If a user has multiple python projects with mutliple virtual
environments, we only detect and activate the first one, since can't
really make any assumptions about which one to activate. I dont think
this should be a blocker either, as I think most users will have a
single project open in Zed.

Release Notes:

- Added a `detect_venv` setting for the terminal. When configured, the
Zed terminal will automatically activate Python virtual environments on
terminal creation.
2023-08-25 15:14:24 -04:00
Joseph T. LyonsandMikayla Maki 4218484d0f WIP
Co-Authored-By: Mikayla Maki <mikayla.c.maki@gmail.com>
2023-08-25 15:06:31 -04:00
Conrad Irwin e29325168c Fix merge-conflict 2023-08-25 11:59:16 -06:00
Conrad Irwin a6408e95cf Fix zed-industries/community#1950 (#2892)
Release Notes:

- vim: fix goal preservation of visual block selections
([#1950](https://github.com/zed-industries/community/issues/1950)).
2023-08-25 11:55:48 -06:00
Conrad Irwin 7bd7a4728a Fix relative line numbers in vim visual mode
In visual mode when your selection ends with a newline we show the
cursor at the end of the previous line (not the start of the current
line). We had only been accounting for this if the cursor was on-screen.
2023-08-25 11:50:41 -06:00
Conrad Irwin 9604cbd934 Fix relative line numbers when newest cursor offscreen 2023-08-25 11:50:41 -06:00
Conrad Irwinand af7c4ea748 Add relative_line_mode
Co-Authored-By: joseph@zed.dev
2023-08-25 11:50:41 -06:00
Conrad Irwin c591a6b231 Fix zed-industries/community#1950 2023-08-25 11:34:07 -06:00
Max Brunsfeld cf311455ba Fix rust 1.72 warnings about shadowed glob re-exports 2023-08-25 10:25:21 -07:00
Max Brunsfeld 0596c2f103 Format let-else statements 2023-08-25 10:11:32 -07:00
Max Brunsfeld 4523a2eb28 Upgrade to rust 1.72 2023-08-25 09:59:16 -07:00
Kirill Bulatov 75dda334bb Properly invalidate the hint cache 2023-08-25 17:33:17 +03:00
Kirill Bulatov 589e342301 Query certain editor ranges for inlays with a delay (#2891)
Part of
https://linear.app/zed-industries/issue/Z-2750/investigate-performance-of-collaborating-on-large-files-with-inlay
Fixes
https://linear.app/zed-industries/issue/Z-2824/inlay-hints-affect-code-layout-in-multibuffer

We query hints for visible part of the screen, and two parts above and
below the visible range, of the same range (if applicable, we can be on
the edge of the document).

When rapidly typing, we do not care about the invisible range updates,
yet still query a lot of them + rust-analyzer sends /refresh hint
requests shortly after every modification too, forcing us to re-query.

Instead querying both visible and invisible ranges altogether, wait for
visible range query first and wait add a `400ms` delay afterwards before
querying the invisible ranges.
This allows any /refresh requests or rapid typing to avoid 2 extra
requests, cancelling them before they start.
Visible part of the screen is still queried after every change, without
any debouncing.

Release Notes:

- Delay certain inlay hint requests to reduce general LSP server load
2023-08-25 16:33:21 +03:00
Kirill Bulatov 778c3a1bb5 Fix the tests 2023-08-25 16:25:43 +03:00
Kirill Bulatov 07c8ade871 Only invalidate when doing first, visible range query 2023-08-25 15:16:55 +03:00
Kirill Bulatov f277151d26 Defer querying inlay hints for invisible editor ranges
This way, only the visible part gets frequently queried on typing (and
hint /refresh requests that follow), with queries for invisible ranges
cancelled eagerly.
2023-08-25 15:16:55 +03:00
Kirill Bulatov 118e9c04fd Handle inlay hints resolve, support dynamic hints (#2890)
Resolves inlay hints on hover, shows hint label parts' tooltips, allows
cmd+click to navigate to the hints' parts with locations,
correspondingly highlight the hints.

Release Notes:

- Support dynamic inlay hints
2023-08-25 15:16:13 +03:00
Kirill Bulatov bee25d93e0 Use stricter inlay range checks to avoid stuck highlights
Often, hint ranges are separated by a single '<` char as in
`Option<Vec<u32>>`. When moving the caret from left to right, avoid
inclusive ranges to faster update the matching hint underline.
2023-08-25 14:46:39 +03:00
Kirill Bulatov ec6c6ab815 Rebase fixes 2023-08-25 14:30:07 +03:00
Kirill Bulatov 02560f7a1a Add hover tests 2023-08-25 14:26:17 +03:00
Kirill Bulatov efb47adc94 Add link_go_to_definition test for inlays 2023-08-25 14:26:17 +03:00
Kirill Bulatov f6ae590f9a Properly binary search cached inlay hints 2023-08-25 14:26:17 +03:00
Kirill Bulatov 595c32b583 Be more lenient with hint resolution, always return some hint 2023-08-25 14:26:17 +03:00
Kirill Bulatov f1eaa9e4cd Use inlay highlights in randomized tests 2023-08-25 14:26:17 +03:00
Kirill Bulatov 5261180929 Simplify and restore client resolve capabilities 2023-08-25 14:26:17 +03:00
Kirill Bulatov 6b7c2f1dc0 Fix resolve status conversion 2023-08-25 14:26:17 +03:00
Kirill Bulatov 05b8754d9f Propagate inlay background highlights to data storage 2023-08-25 14:26:17 +03:00
Kirill Bulatov bca725ef71 Prepare background highlights for inlay highlights 2023-08-25 14:26:17 +03:00
Kirill Bulatov 9aa19291bb Unify text and inlay highlights 2023-08-25 14:26:17 +03:00
Kirill Bulatov a4bf016b0c Prepare for inlay and text highlight unification 2023-08-25 14:26:17 +03:00
Kirill BulatovandAntonio 46253415c2 Highlight inlay hint parts on cmd-hover
Co-Authored-By: Antonio <antonio@zed.dev>
2023-08-25 14:26:17 +03:00
Kirill Bulatov 92ceaeaa9d Attempt to highlight inlays 2023-08-25 14:26:17 +03:00
Kirill Bulatov a950eb41dd Pass inlay highlight information 2023-08-25 14:26:17 +03:00
Kirill Bulatov a2a60c6d84 Properly resolve inlay label parts' locations and buffers 2023-08-25 14:26:17 +03:00