Commit Graph

1157 Commits

Author SHA1 Message Date
Max Brunsfeld
46429426ef Avoid accidental gpui transitive dependency in collab
* Make Fs depend on Text, not vise versa

Co-authored-by: Joseph <joseph@zed.dev>
Co-authored-by: Mikayla <mikayla@zed.dev>
2023-08-30 13:16:01 -07:00
Piotr Osiewicz
07b9c6c302
language: Make Buffer::new take an explicit ID (#2900)
See Linear description for the full explanation of the issue. This PR is
mostly a mechanical change, except for the one case where we do pass in
an explicit `next_id` instead of `model_id` in project.rs.

Release Notes:
- Fixed a bug where some results were not reported in project search in
presence of unnamed buffers.
2023-08-28 11:51:50 +02:00
Kirill Bulatov
ddd7ab116f Do not convert lsp::Location of hint labels before resolve 2023-08-26 02:45:08 +03:00
Piotr Osiewicz
2495d6581e
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
Joseph T. Lyons
c1fd648390
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. Lyons
507a5db09c WIP
Co-Authored-By: Mikayla Maki <mikayla.c.maki@gmail.com>
2023-08-25 15:06:31 -04:00
Max Brunsfeld
f798be6e27 Fix rust 1.72 warnings about shadowed glob re-exports 2023-08-25 10:25:21 -07:00
Max Brunsfeld
404f76739c Format let-else statements 2023-08-25 10:11:32 -07:00
Kirill Bulatov
e44516cc6c Add hover tests 2023-08-25 14:26:17 +03:00
Kirill Bulatov
3c55c933d4 Be more lenient with hint resolution, always return some hint 2023-08-25 14:26:17 +03:00
Kirill Bulatov
dcf570bb03 Fix resolve status conversion 2023-08-25 14:26:17 +03:00
Kirill Bulatov
bcaff0a18a Propagate inlay background highlights to data storage 2023-08-25 14:26:17 +03:00
Kirill Bulatov
477fc865f5 Properly resolve inlay label parts' locations and buffers 2023-08-25 14:26:17 +03:00
Kirill Bulatov
80e8714241 Send inlay hint resolve requests 2023-08-25 14:26:17 +03:00
Kirill Bulatov
3434990b70 Store inlay hint resolve data 2023-08-25 14:26:17 +03:00
Kirill Bulatov
e4b78e322e Revert "Strip off inlay hints data that should be resolved"
Without holding all hints in host's cache, this is impossile.
Currenly, we keep hint caches separate and isolated, so this will not
work when we actually resolve.
2023-08-25 14:26:17 +03:00
Joseph T. Lyons
0801e5e437 Merge branch 'main' into add-setting-to-automatically-enable-virtual-environment 2023-08-25 01:50:57 -04:00
Joseph T. Lyons
9fe580acb6 WIP 2023-08-25 01:50:54 -04:00
Max Brunsfeld
24141c2f16 Ensure collaborators cursor colors are the same in channel buffers as in projects
Co-authored-by: Mikayla <mikayla@zed.dev>
2023-08-24 11:31:41 -07:00
Max Brunsfeld
7e83138805
Start work on showing consistent replica ids for channel buffers
Co-authored-by: Mikayla <mikayla@zed.dev>
2023-08-23 18:37:01 -07:00
Joseph T. Lyons
7b170304df Shorten setting name 2023-08-23 04:07:10 -04:00
Joseph T. Lyons
711f156308 WIP 2023-08-23 04:04:36 -04:00
Joseph T. Lyons
471810a3c2 WIP
Co-Authored-By: Julia <30666851+ForLoveOfCats@users.noreply.github.com>
2023-08-22 15:29:25 -04:00
Piotr Osiewicz
d27cebd977
Z 2819 (#2872)
This PR adds new config option to language config called
`word_boundaries` that controls which characters should be recognised as
word boundary for a given language. This will improve our UX for
languages such as PHP and Tailwind.

Release Notes:

- Improved completions for PHP
[#1820](https://github.com/zed-industries/community/issues/1820)

---------

Co-authored-by: Julia Risley <julia@zed.dev>
2023-08-22 10:35:20 +02:00
Kirill Bulatov
269dad5a9c Respect completion resolve server capabilities
Only query for additional edits if the server supports it

Co-Authored-By: Julia Risley <julia@zed.dev>
2023-08-18 16:55:47 +03:00
Mikayla
afebe3faf8
Merge branch 'main' into project_search_design 2023-08-17 01:56:05 -07:00
Kirill Bulatov
f9131f657e Use InlayHint instead of Inlay where appropriate 2023-08-16 23:38:11 +03:00
KCaverly
aeda5d9842 fix semantic search panic which is created via incompatible build_search_query path
Co-authored-by: Piotr <piotr@zed.dev>
2023-08-16 15:50:54 +01:00
Kirill Bulatov
27bf01c3a8 Strip off inlay hints data that should be resolved 2023-08-14 22:50:55 +03:00
Nathan Sobo
0a4633f88f Remove more window id usage 2023-08-08 11:20:09 -06:00
Max Brunsfeld
4e33654aba Make LspAdapter::process_diagnostics synchronous
Co-authored-by: Nathan <nathan@zed.dev>
2023-08-07 13:53:41 -07:00
Max Brunsfeld
a127b0d3e6 Fix warnings surfaced in Rust 1.71 2023-08-02 09:19:23 -07:00
Kirill Bulatov
cf6e524c9a Make project search includes and excludes more user-friendly
Allow search results that start with the include/exclude path part
2023-07-28 12:56:44 +03:00
Max Brunsfeld
a01d973477
More git status optimizations (#2779)
Follow-up to https://github.com/zed-industries/zed/pull/2777
Refs https://github.com/zed-industries/community/issues/1770

In this PR, I reworked the way that git statuses are retrieved. In a
huge repository like `WebKit`, the really slow part of computing a list
of git statuses is the *unstaged* portion of the diff. For the *staged*
diff, `git` can avoid comparing the contents of unchanged directories,
because the index contains hashes of every tree. But for the *unstaged*
portion, Git needs to compare every file in the worktree against the
index. In the common case, when there are no changes, it's enough to
check the `mtime` of every file (because the index stores the mtimes of
files when they are added). But this still requires an `lstat` call to
retrieve each file's metadata.

I realized that this is redundant work, because the worktree is
*already* calling `lstat` on every file, and caching their metadata. So
in this PR, I've changed the `Repository` API so that there are separate
methods for retrieving a file's *staged* and *unstaged* statuses. The
*staged* statuses are retrieved in one giant batch, like before, to
reduce our git calls (which also have an inherent cost). But the
`unstaged` statuses are retrieved one-by-one, after we load files'
mtimes. Often, all that's required is an index lookup, and an mtime
comparison.

With this optimization, it once again becomes pretty responsive to open
`WebKit` or `chromium` in Zed.

Release Notes:

- Optimized the loading of project file when working in very large git
repositories
2023-07-24 11:23:32 -07:00
Kirill Bulatov
f05095a6dd Focus project panel on directory select 2023-07-23 00:12:25 +03:00
Max Brunsfeld
6c09782aa2 Optimize full file status via passing in known file mtime 2023-07-22 11:53:26 -07:00
Max Brunsfeld
51d311affd Compute unstaged git status separately, to take advantage of our cached file mtimes 2023-07-21 17:58:43 -07:00
Max Brunsfeld
ff0864026e Only fetch statuses for changed paths 2023-07-21 17:08:31 -07:00
Max Brunsfeld
05b161118c Don't call git status when ignored files change 2023-07-21 17:05:42 -07:00
Max Brunsfeld
4bd415f2b6 Retrieve git statuses in one batch when scanning dirs 2023-07-21 13:50:54 -07:00
Kirill Bulatov
6349d90cac Properly open project directories 2023-07-18 22:59:41 +03:00
Kirill Bulatov
9aeb970f09 Ignore empty hover contents, trim final hover label text 2023-07-18 22:53:44 +03:00
Piotr Osiewicz
8642a1d074 Remove dbg! calls 2023-07-17 13:03:57 +02:00
Piotr Osiewicz
11173b2199 Merge branch 'main' into piotr/z-2588-php 2023-07-17 11:47:08 +02:00
Piotr Osiewicz
dc557e1647 Add scaffolding of php language server 2023-07-17 11:43:32 +02:00
Max Brunsfeld
b9e0074793 Perform only one git statuses call when reloading a git repo after it changes 2023-07-14 14:29:22 -07:00
Max Brunsfeld
2e2333107a Find the layer with the smallest enclosing node in language_scope_at 2023-07-14 09:11:56 -07:00
Kirill Bulatov
d164034198
Allow all completions with preresolved additional text edits (#2711)
Deals with https://github.com/zed-industries/community/issues/752
Deals with https://github.com/zed-industries/community/issues/566

Currently, when converting from LSP to Zed objects, completions with
non-empty `additional_text_edits` are filtered out.
Later, all other completions form a list and the selected one gets the
`Editor::confirm_completion` call, which always queries an LSP
completion resolve request to get the `additional_text_edits` field.

Otherwise, `additional_text_edits` field is ignored entirely for the
rest of the completion lifetime — and we always pass the selected
completion through the resolve request.

The PR changes the logic, removing the `additional_text_edits` filtering
and instead of resolving every completion, now we check for
`additional_text_edits` in the completion before resolving: resolve
happens only if the data is absent.

Generally, feels like resolve has to happen before the completion
selection: LSP servers may send us markdown for completion documentation
preview pop ups and similar extra info.
Also, the server may lack resolve capabilities entirely, always sending
the request seems dangerous.
For now, the PR does not attempt to change either.

Release Notes:

- Brings rust-analyzer's postfix completions and others completions with
preresolved additional text edits
2023-07-12 22:10:18 +03:00
Kirill Bulatov
0c7949bdee Force resolve all completions, to ensure their edits are up-to-date
co-authored-by: Max Brunsfeld <max@zed.dev>
2023-07-12 21:10:01 +03:00
Kirill Bulatov
c732aa1617 Do not resolve completions if extra edits are available 2023-07-12 20:28:16 +03:00