Commit Graph
1125 Commits
Author SHA1 Message Date
Kirill Bulatov 598996eaf3 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 4f2579494c 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 58c3c412d1 Focus project panel on directory select 2023-07-23 00:12:25 +03:00
Max Brunsfeld bf9410bbb7 Optimize full file status via passing in known file mtime 2023-07-22 11:53:26 -07:00
Max Brunsfeld 143e0d5e8b Compute unstaged git status separately, to take advantage of our cached file mtimes 2023-07-21 17:58:43 -07:00
Max Brunsfeld da4f477e1f Only fetch statuses for changed paths 2023-07-21 17:08:31 -07:00
Max Brunsfeld 956a700cb8 Don't call git status when ignored files change 2023-07-21 17:05:42 -07:00
Max Brunsfeld 3146f7052a Retrieve git statuses in one batch when scanning dirs 2023-07-21 13:50:54 -07:00
Kirill Bulatov f35133a0d6 Properly open project directories 2023-07-18 22:59:41 +03:00
Kirill Bulatov 699c5ceb68 Ignore empty hover contents, trim final hover label text 2023-07-18 22:53:44 +03:00
Piotr Osiewicz a6c08cfa79 Remove dbg! calls 2023-07-17 13:03:57 +02:00
Piotr Osiewicz b61f6bc0ae Merge branch 'main' into piotr/z-2588-php 2023-07-17 11:47:08 +02:00
Piotr Osiewicz 9560f20af8 Add scaffolding of php language server 2023-07-17 11:43:32 +02:00
Max Brunsfeld 7614c594fc Perform only one git statuses call when reloading a git repo after it changes 2023-07-14 14:29:22 -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
Kirill Bulatov 5d8950e027 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 BulatovandMax Brunsfeld a05c1daacd 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 65b409547a Do not resolve completions if extra edits are available 2023-07-12 20:28:16 +03:00
Kirill Bulatov 1181f12b44 Draft the postfix completions support 2023-07-12 18:32:03 +03:00
KCaverly 95143f5fe8 Merge branch 'main' of github.com:zed-industries/zed into vector_store 2023-07-11 20:05:29 -04:00
Kirill BulatovandMax Brunsfeld b214a1af15 Refactor LSP restart logic
Instead of storing `initialization_options` in every LSP adapter as
before, store previous LSP settings in `Project` entirely.

This way, we can later have use multiple different project
configurations per single LSP with its associated adapter.

co-authored-by: Max Brunsfeld <max@zed.dev>
2023-07-11 21:56:55 +03:00
KCaverly f2264fb0a9 brought up to speed with main 2023-07-11 14:50:48 -04:00
Kirill Bulatov 6c4b0b2b2f Revert "Fix language servers improper restarts"
This reverts commit 78ecc82fed.
2023-07-11 20:46:45 +03:00
Kirill Bulatov 78ecc82fed Fix language servers improper restarts
Language servers mixed `initialization_options` from hardcodes and user
settings, fix that to ensure we restart servers on their settings
changes only.
2023-07-11 16:36:20 +03:00
KCaverly 29b37b3a27 merged main 2023-07-07 14:24:29 -04:00
Kirill Bulatov c463e0dc55 Restart LSP server on initialization options change 2023-07-06 23:27:22 +03:00
Kirill Bulatov 0ad7efb1b2 Show inlay hints on startup for every language server with work events
Language servers such as typescript-language-servers report a single
work event, ending right after server's startup.

Other servers might send more similar event, also during startup.
The rest of the events are diagnostic-related and we filter them out.

React on such events with /refresh-like hint update, that will check
only the visible part of the editor for hints and might be replaced by
other /refresh requests, if needed.
2023-07-06 13:10:59 +03:00
Kirill Bulatov 19c11a9a49 Use less padding for typescript parameter hints 2023-07-06 11:16:39 +03:00
KCaverlyandmaxbrunsfeld 5c0ef44a23 moved semantic search model to dev and preview only.
moved db update tasks to long lived persistent task.

Co-authored-by: maxbrunsfeld <max@zed.dev>
2023-06-30 18:41:19 -04:00
Max Brunsfeld c57609f656 Fix regression in handling git FS events (#2670)
As part of an optimization in
https://github.com/zed-industries/zed/pull/2663, I changed the way that
the worktree ignores FS events within unloaded directories. But this
accidentally prevented us from detecting some events that occur inside
of `.git` directories.

In this PR, I've made further tweaks to which FS events we can ignore.
We now explicitly opt *in* to scanning `.git` (shallowly) directories
(even though they are ignored). Note that we still don't recursively
scan the git directory (including all of the files inside `objects`
etc). This seems like the correct amount of work to do, and from my
testing (and our unit tests that use the real FS and real git
repositories), it seems to work correctly.

Release Notes:

- Fixed a bug where Zed would not detect some git repository changes
(preview only).
2023-06-30 11:40:49 -07:00
Max Brunsfeld a7fc19a618 Fix accidental ignoring of git FS events 2023-06-30 11:20:50 -07:00
Mikayla Maki 591d6643a2 Fix method header 2023-06-29 23:53:57 -07:00
Mikayla Maki d228dc2d8a fix failing test 2023-06-29 23:50:24 -07:00
Mikayla Maki 9cbcdeb523 Added more tests and minimal file updates 2023-06-29 18:21:35 -07:00
Mikayla Maki 6584785a50 Make path updates minimal 2023-06-29 18:15:40 -07:00
Mikayla Maki 91f2a5401c fmt and update dependency 2023-06-29 17:49:42 -07:00
Mikayla Maki f416d9ef00 Add the ability to make new directories by adding slashes to a file name 2023-06-29 17:35:22 -07:00
Kirill Bulatov b56e2b4a28 Remove a flacky test, fix the failing one 2023-06-29 22:45:04 +03:00
Kirill Bulatov 3a66693941 Post-rebase fixes 2023-06-29 22:39:33 +03:00
Kirill Bulatov ff5645c43b Move hint settings on the language level 2023-06-29 22:39:18 +03:00
Antonio Scandurra 1a0d9873b2 Account for inlay biases when clipping a point 2023-06-29 22:25:50 +03:00
Kirill Bulatov 25129daf7a Forward inlay hint refresh requests to clients, test coop inlay hints 2023-06-29 22:25:49 +03:00
Kirill Bulatov fa1196dabf Remove stale cancelled inlay hints workaround 2023-06-29 22:25:49 +03:00
Kirill Bulatov 901ff983fd Use proper anchors for remote LSP queries 2023-06-29 22:25:49 +03:00
Kirill Bulatov a555d28a65 Move away heavy inlay computations into background tasks 2023-06-29 22:25:49 +03:00
Kirill Bulatov 684a6a5fa4 Forbid extra inlay updates 2023-06-29 22:25:49 +03:00
Kirill Bulatov 02c8e6794b Allow readding inlays with existing ids, move inlay types 2023-06-29 22:25:49 +03:00
Kirill Bulatov 49ac0e0dee Properly update inlay hints when settings are changed 2023-06-29 22:25:49 +03:00
Kirill Bulatov d0c3527705 Store inlays per paths and query on editor open 2023-06-29 22:25:49 +03:00
Kirill Bulatov 851bc593b4 Deserialize more LSP inlay hint information 2023-06-29 22:25:49 +03:00