Commit graph

10799 commits

Author SHA1 Message Date
Nathan Sobo
33e49b4962 WIP 2023-07-27 23:00:52 -06:00
Nathan Sobo
480401d65d WIP 2023-07-27 18:23:23 -06:00
Nathan Sobo
2ef19e48bc WIP 2023-07-27 13:00:28 -06:00
Nathan Sobo
70c9959ebc WIP 2023-07-27 12:35:54 -06:00
Nathan Sobo
ab8906551d WIP 2023-07-26 22:37:59 -06:00
Nathan Sobo
c602d98680 WIP 2023-07-26 13:34:57 -06:00
Nathan Sobo
0374bc66ce WIP 2023-07-26 12:54:23 -06:00
Nathan Sobo
c48d8af204 Merge branch 'paint-context' into cells 2023-07-25 17:36:05 -06:00
Nathan Sobo
1b03c5d69c Pass PaintContext to Element::paint
I want to use this on another branch, but it's a sweeping change,
so this prepares the ground for it. This can always be reverted if
it doesn't work out.
2023-07-25 17:32:31 -06:00
Nathan Sobo
df9c17176e WIP 2023-07-25 16:33:58 -06:00
Joseph T. Lyons
cc23360bab
Add sort lines command (#2786)
This PR adds command palette actions for:

- `sort lines case sensitive`
- `sort lines case insensitive`
- `reverse lines`
- `shuffle lines`

Closes out:

- https://github.com/zed-industries/community/issues/658

and partially closing out:

- https://github.com/zed-industries/community/issues/57 (which is
currently a top-ranked issue)

There are issues with dedupe lines and I didn't try to tackle converting
variable names between different conventions. I'll likely close out 57
with a note to just upvote the remaining individual issues

Release Notes:

- added command palette actions for `sort lines case sensitive`, `sort
lines case insensitive`, `reverse lines`, and`shuffle lines`
(([#57](https://github.com/zed-industries/community/issues/57)),
([#658](https://github.com/zed-industries/community/issues/658)))
2023-07-25 15:39:45 -04:00
Joseph T. Lyons
4085df5146 Add tests for manipulate_lines() 2023-07-25 15:17:16 -04:00
Joseph T. Lyons
bf2ca57f55 Remove { and } from single-line closure 2023-07-25 14:48:11 -04:00
Mikayla Maki
c32fd57643
Add support for Elm and GLSL (#2782)
This adds tree-sitter grammars for both Elm and GLSL, with injections
for GLSL embedded within Elm. It also adds an `outline.scm` for Elm,
though limitations in the tree-sitter grammar meant that I wasn't able
to get it looking exactly how I'd have liked.

In particular, it wasn't clear how to nicely annotate functions in the
outline as being functions, or how to prevent the fields of a record
declaration from being increasingly indented.


![image](https://github.com/zed-industries/zed/assets/285821/544bc00b-3bfc-4ec7-be9d-764b9f0292ab)

![image](https://github.com/zed-industries/zed/assets/285821/74e57e95-bf87-4989-ae29-a2f625141bcf)

![image](https://github.com/zed-industries/zed/assets/285821/9e283c78-66d5-4c15-9827-1b5b446cdc37)

fixes https://github.com/zed-industries/community/issues/598

Release Notes:
- Added syntax highlighting for the Elm and GLSL languages
2023-07-25 11:34:22 -07:00
Joseph T. Lyons
93ec73da29 Fix code computing new selections
Co-Authored-By: Mikayla Maki <mikayla.c.maki@gmail.com>
2023-07-25 14:04:25 -04:00
Joseph T. Lyons
299818cde0 Fix rand import and tweak callbacks
Co-Authored-By: Julia <30666851+ForLoveOfCats@users.noreply.github.com>
2023-07-25 11:44:13 -04:00
Joseph T. Lyons
1a84382881 WIP 2023-07-25 10:33:20 -04:00
Nathan Sobo
54a7419fa2 WIP 2023-07-24 23:27:14 -06:00
Joseph T. Lyons
bdd0b9f387
Add open file in project finder via space (#2785)
@mikayla-maki for 👀 

[This PR added in the ability to rename a file via
`enter`](https://github.com/zed-industries/zed/pull/2784). Previously,
`enter` was used to both open a file and confirm a rename, so this PR
changes the opening of a file to use `space`, which is what VS Code
uses. It also makes a bit more sense because now `enter` is just used to
start a rename and confirm the rename, vs being used for 2 different
actions.

N/A on the release notes, as I adjusted the release note in the
previously-tagged PR.

Release Notes:

- N/A
2023-07-24 16:35:01 -04: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
Quinn Wilton
e199a6a3a1
Highlight all Elm function calls 2023-07-24 10:55:15 -07:00
Mikayla Maki
7603659479
Add MacOS standard key binding for file renames (#2784)
Release Notes:

- Added a default keybinding for using enter to rename files in the
project panel
2023-07-24 10:46:43 -07:00
Quinn Wilton
3cc88904bf
Add all Elm functions to the outline, including locals 2023-07-24 10:45:46 -07:00
Quinn Wilton
62ee52a5fc
Highlight qualified Elm function calls 2023-07-24 10:45:15 -07:00
Quinn Wilton
fbe0108959
Highlight Elm arrows as keywords 2023-07-24 10:44:56 -07:00
Mikayla Maki
41105136a4
Add MacOS standard key binding for file renames 2023-07-24 10:20:10 -07:00
Mikayla Maki
d95c4fdb2b
Remove unbound highlight queries 2023-07-24 09:01:15 -07:00
Mikayla Maki
ea74734b0a
Touch up elm tree sitter integration 2023-07-24 08:52:51 -07:00
Kirill Bulatov
52154f76ac
Fixes a crash when SelectAllMatches action was called on no matches (#2783)
Release Notes:

- Fixes a crash when SelectAllMatches action was called on no matches
2023-07-24 15:48:45 +03:00
Kirill Bulatov
7dccb487de Fixes a crash when SelectAllMatches action was called on no matches 2023-07-24 15:42:10 +03:00
Quinn Wilton
6ad0852a70
Add outline.scm for Elm 2023-07-24 00:58:59 -07:00
Quinn Wilton
dd504f5965
Add tree-sitter-glsl 2023-07-23 22:22:11 -07:00
Quinn Wilton
a4914fcf3b
Add tree-sitter-elm 2023-07-23 22:22:11 -07:00
Max Brunsfeld
8fff0b0ff8 Fix pathspec in staged_statuses
Enable non-literal matching so that directory paths match
all files contained within them.
2023-07-23 21:36:29 -07:00
Max Brunsfeld
a3a9d024ba Fix filtering of staged statuses 2023-07-22 17:53:58 -07:00
Max Brunsfeld
b338ffe8d8 Rely on git status for any paths not matching the git index 2023-07-22 17:47:36 -07:00
Kirill Bulatov
e0915190d4
In terminal, open paths starting with ~ and focus on project panel when opening directories (#2780)
Further improves terminal navigation with cmd+click, now allowing to
open paths starting with `~` (if they are present otherwise) and
focusing project panel with highlighted entry for the directories
opened.

Release Notes:

- Further improves terminal navigation with cmd+click, now allowing to
open paths starting with `~` (if they are present otherwise) and
focusing project panel with highlighted entry for the directories
opened.
2023-07-23 00:23:19 +03: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
Kirill Bulatov
dcaf8a9af8 Open paths starting with ~ from terminal click 2023-07-22 01:34:25 +03:00
Max Brunsfeld
7788eabec0
Avoid performance bottlenecks from git status calls during worktree scanning (#2777)
Closes
https://linear.app/zed-industries/issue/Z-2689/huge-slowdown-when-working-in-large-git-repositories-like-webkit
Closes https://github.com/zed-industries/community/issues/1770

In large git repositories (like Webkit), `git status` can be very slow.
And our current approach of retrieving git statuses (one by one as we
load paths), causes catastrophic slowdowns in these repos. This PR
further optimizes our retrieval of git statuses (started in
https://github.com/zed-industries/zed/pull/2728), so that when scanning
a directory, we only load git statuses once, in a single batch, at the
beginning of the scan.

There is still an initial lag when opening `WebKit` in Zed, while the
initial git status runs. But once this call completes, everything is
fast. Let's come back to this problem later.

For now, this makes Zed's directory scanning massively more efficient,
even in the case of normal-sized repos like `zed`. The git status code
was a huge percentage of zed's CPU usage when launching. Here is that
code, highlighted in a flamegraph before and after this change:

Before:

![before](https://github.com/zed-industries/zed/assets/326587/627012f2-6131-44ac-95c2-ea4a4531cb24)

After:

![after](https://github.com/zed-industries/zed/assets/326587/a11a3e1b-e925-4bff-a421-ea71cb4de85d)


Release Notes:

- Fixed a bug where project paths took a very long time to load when
working in large git repositories
([#1770](https://github.com/zed-industries/community/issues/1770))
2023-07-21 14:46:53 -07:00
Kirill Bulatov
bd9118f673
Do not scroll when selecting all (#2778)
In big buffers, when I press `cmd-a`, the view gets scrolled to the very
bottom.
Usually it's now that I want, I can scroll to bottom with `cmd-down`
separately, and selecting all text is used for copy-pasting it
somewhere, no need to scroll anywhere for that — I can get back to the
same place later.

Release Notes:

- Removed the scroll to the end of the editor after `editor::SelectAll`
action
2023-07-22 00:25:37 +03:00
Kirill Bulatov
c538504b9c Do not scroll when selecting all 2023-07-22 00:17:02 +03:00
Max Brunsfeld
4bd415f2b6 Retrieve git statuses in one batch when scanning dirs 2023-07-21 13:50:54 -07:00
Kirill Bulatov
25ea07cd41
When renaming in project panel, select file names without extensions (#2776)
Closes
https://github.com/zed-industries/community/issues/1789#issuecomment-1646061712

<img width="196" alt="Screenshot 2023-07-21 at 23 23 47"
src="https://github.com/zed-industries/zed/assets/2690773/f5c7025b-6dc8-4f0c-81e5-3cc98a3a9c8b">
<img width="197" alt="Screenshot 2023-07-21 at 23 23 52"
src="https://github.com/zed-industries/zed/assets/2690773/596f8ab0-15e0-4285-be34-ce4c276b686f">

When renaming in project panel, select file names without extensions.

Release Notes:

- Improved project panel rename by selecting file names without
extensions
2023-07-21 23:30:55 +03:00
Kirill Bulatov
33b215a288
Add search in directory action in the project panel (#2774)
Part of https://github.com/zed-industries/zed/issues/1153
Closes https://github.com/zed-industries/community/issues/1326

<img width="432" alt="image"
src="https://github.com/zed-industries/zed/assets/2690773/a50ee073-9d2e-4e5c-ae5e-23312693c540">

Adds an `project_panel::NewSearchInDirectory` action ("alt-shift-f"
default) in the project editor context to open a new project search in
the selected directory.

Release Notes:

- Adds an action to open project search in the project panel's directory
2023-07-21 23:25:45 +03:00
Julia
f2c9738a69
Put our downloaded copy of Node in the env for every NPM action (#2775)
Intelephense (PHP language server) has a dependency on `protobufjs`
which invokes `node` in the `postinstall` script and if the user did not
have a system Node runtime installed that would fail. Have this use our
downloaded installation too

Fixes
https://linear.app/zed-industries/issue/Z-2687/php-language-server-failed

Release Notes:
- Fixed PHP language server installation on systems without a system
Node installation.
2023-07-21 16:24:05 -04:00