Commit Graph
100 Commits
Author SHA1 Message Date
Kirill Bulatov 6a3974ddbb Remove TODOs 2023-10-31 13:08:18 +02:00
Kirill Bulatov 84c5494949 Fix prettier errors around Zed's settings.json/keymap.json files
Ports https://github.com/zed-industries/zed/pull/3191 to zed2

Deals with zed-industries/community#2191
Fix Zed starting too many prettier installations in the beginning, and not being able to format the config files.
2023-10-31 12:26:49 +02:00
Kirill Bulatov 45e695c906 Fix prettier errors around Zed's settings.json/keymap.json files (#3191)
Deals with https://github.com/zed-industries/community/issues/2191

Fix Zed starting too many prettier installations in the beginning, and
not being able to format the config files.

Release Notes:

- Fixed prettier not being able to format Zed's config files and spawning excessive prettier installations
2023-10-31 12:05:32 +02:00
Kirill Bulatov 6ee9beed73 Enqueue default prettier installations 2023-10-31 11:54:40 +02:00
Kirill Bulatov c98a811c0b Only process diagnostics if corresponding project is alive
Part of https://github.com/zed-industries/zed/pull/3128 that is possible
to apply now.
2023-10-31 10:40:49 +02:00
Kirill Bulatov fd6f6cc9f8 Return proper full paths for single file workspaces 2023-10-30 22:33:44 +02:00
Kirill Bulatov 29a32039ba Start message numbering during prettier init, log error message text 2023-10-30 22:26:06 +02:00
Kirill Bulatov 033d0ae610 Remember default prettier and its plugin installation 2023-10-30 22:09:36 +02:00
Kirill Bulatov b3c3adab50 Port prettier panic fix to gpui2 2023-10-30 13:00:49 +02:00
Kirill Bulatov bd30ce837d Do not panic when looking for prettier (#3182)
Fixes
https://zed-industries.slack.com/archives/C04S6T1T7TQ/p1698655595438009

Instead of checking FS, derive the prettier path needed and let prettier
invocation fail in logs instead.
2023-10-30 12:59:46 +02:00
Kirill Bulatov 6aca2289eb Do not panic when looking for prettier (#3182)
Fixes
https://zed-industries.slack.com/archives/C04S6T1T7TQ/p1698655595438009

Instead of checking FS, derive the prettier path needed and let prettier
invocation fail in logs instead.
2023-10-30 12:58:47 +02:00
Kirill Bulatov b46a4b5680 Be more lenient when searching for prettier instance
Do not check FS for existence (we'll error when start running prettier),
simplify the code for looking it up
2023-10-30 12:13:58 +02:00
Kirill Bulatov 249bec3cac Do not panic on prettier search 2023-10-30 12:13:54 +02:00
Kirill Bulatov f16ff79ff8 Properly log prettier paths 2023-10-30 11:17:11 +02:00
Kirill Bulatov 96bbb5cdea Properly log prettier paths 2023-10-30 11:14:00 +02:00
Kirill Bulatov 27d2accb51 Fix the formatting 2023-10-26 13:52:04 +02:00
Kirill Bulatov 0a04c5734b Update mouse position during file drag and drop 2023-10-26 13:50:35 +02:00
Kirill Bulatov 483ac9491a Start fixing room2 2023-10-26 11:27:12 +02:00
Kirill BulatovandNathan Sobo a01b507ef4 Add OS file drop event handler
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2023-10-24 19:26:06 +02:00
Kirill Bulatov 77991ad865 Fix compilation 2023-10-24 18:22:26 +02:00
Kirill Bulatov 18930c33fe Make audio2 2023-10-24 17:15:59 +02:00
Kirill Bulatov 1ad7f3a16d Finish ???-ing project2.rs 2023-10-24 16:35:34 +02:00
Kirill Bulatov b090cefdde Rework prettier tests (#3160)
Do not infuse `FakeNodeRuntime` with prettier exceptions, rather keep
the default formatter installation method as no-op.
2023-10-24 15:34:55 +03:00
Kirill Bulatov e9ce935991 Rework prettier tests
Do not infuse `FakeNodeRuntime` with prettier exceptions, rather keep
the default formatter installation method as no-op.
2023-10-24 14:25:46 +02:00
Kirill Bulatov 0e48465adb Add a draft of the mac platform file drag and drop events 2023-10-24 14:09:46 +02:00
Kirill Bulatov 4d5ca37edb Fix the branch compilation 2023-10-24 14:04:45 +02:00
Kirill Bulatov 26638748bb Move prettier parsers data into languages from LSP adapters (#3150)
Release Notes:

- Fixed incorrect prettier parsers sometimes being applied to certain
files
2023-10-21 02:22:21 +03:00
Kirill Bulatov 7748848b6e Move prettier parsers data into languages from LSP adapters 2023-10-21 01:14:03 +02:00
Kirill Bulatov 40104c06e2 Sort hint request ranges before asserting to avoid flackiness 2023-10-19 11:05:47 +03:00
Kirill Bulatov c380d437c6 Cap every language server logs (#3134)
* on opening a language server's logs, a new editor for server logs is
now created from `\n`-joined `VecDeque` elements instead of a buffer, as
before
* every `VecDeque` entry is a log line we receiver out of stderr or LSP
server, and their general amount is capped with `let
MAX_STORED_LOG_ENTRIES: usize = 2000;`
* currently opened editor with logs (`Editor::multi_line`) keeps getting
log lines appended and may get over this cap, but only last stored 2000
entries will be restored on reopen
* similarly, cap rpc message logs

Release Notes:

- Improved memory usage by storing less language LSP server and rpc logs
2023-10-17 21:51:21 +03:00
Kirill Bulatov a95cce9a60 Reduce max log lines, clean log buffers better 2023-10-17 21:47:21 +03:00
Kirill Bulatov 08af830fd7 Do not create buffers for rpc logs 2023-10-17 21:43:34 +03:00
Kirill Bulatov c872c86c4a Remove another needless log buffer 2023-10-17 21:43:34 +03:00
Kirill Bulatov ba5c188630 Update editor with current buffer logs 2023-10-17 21:43:34 +03:00
Kirill Bulatov 5a4161d293 Do not detach subscriptions 2023-10-17 21:43:34 +03:00
Kirill Bulatov 33296802fb Add a rough prototype 2023-10-17 21:43:34 +03:00
Kirill Bulatov 16d9d77d88 Update diagnostics indicator when diagnostics are udpated (#3128)
Release Notes:

- Fixed diagnostics indicator not showing proper diagnostics count
2023-10-13 12:30:26 +03:00
Kirill Bulatov 803ab81eb6 Update diagnostics indicator when diagnostics are udpated 2023-10-13 12:13:18 +03:00
Kirill Bulatov 634202340b Remove zed -> ... -> semantic_index -> zed Cargo dependency cycle (#3127)
rust-analyzer complains about a bunch of dependency cycles:

```
stderr: [ERROR project_model::workspace] cyclic deps: zed(Idx::<CrateData>(791)) -> assistant(Idx::<CrateData>(35)), alternative path: assistant(Idx::<CrateData>(35)) -> search(Idx::<CrateData>(553)) -> semantic_index(Idx::<CrateData>(556)) -> zed(Idx::<CrateData>(791))
stderr: [ERROR project_model::workspace] cyclic deps: zed(Idx::<CrateData>(791)) -> breadcrumbs(Idx::<CrateData>(88)), alternative path: breadcrumbs(Idx::<CrateData>(88)) -> search(Idx::<CrateData>(553)) -> semantic_index(Idx::<CrateData>(556)) -> zed(Idx::<CrateData>(791))
stderr: [ERROR project_model::workspace] cyclic deps: zed(Idx::<CrateData>(791)) -> collab_ui(Idx::<CrateData>(129)), alternative path: collab_ui(Idx::<CrateData>(129)) -> feedback(Idx::<CrateData>(219)) -> search(Idx::<CrateData>(553)) -> semantic_index(Idx::<CrateData>(556)) -> zed(Idx::<CrateData>(791))
stderr: [ERROR project_model::workspace] cyclic deps: zed(Idx::<CrateData>(791)) -> feedback(Idx::<CrateData>(219)), alternative path: feedback(Idx::<CrateData>(219)) -> search(Idx::<CrateData>(553)) -> semantic_index(Idx::<CrateData>(556)) -> zed(Idx::<CrateData>(791))
stderr: [ERROR project_model::workspace] cyclic deps: zed(Idx::<CrateData>(791)) -> quick_action_bar(Idx::<CrateData>(480)), alternative path: quick_action_bar(Idx::<CrateData>(480)) -> assistant(Idx::<CrateData>(35)) -> search(Idx::<CrateData>(553)) -> semantic_index(Idx::<CrateData>(556)) -> zed(Idx::<CrateData>(791))
stderr: [ERROR project_model::workspace] cyclic deps: zed(Idx::<CrateData>(791)) -> search(Idx::<CrateData>(553)), alternative path: search(Idx::<CrateData>(553)) -> semantic_index(Idx::<CrateData>(556)) -> zed(Idx::<CrateData>(791))
stderr: [ERROR project_model::workspace] cyclic deps: zed(Idx::<CrateData>(791)) -> semantic_index(Idx::<CrateData>(556)), alternative path: semantic_index(Idx::<CrateData>(556)) -> zed(Idx::<CrateData>(791))
stderr: [ERROR project_model::workspace] cyclic deps: zed(Idx::<CrateData>(791)) -> terminal_view(Idx::<CrateData>(643)), alternative path: terminal_view(Idx::<CrateData>(643)) -> search(Idx::<CrateData>(553)) -> semantic_index(Idx::<CrateData>(556)) -> zed(Idx::<CrateData>(791))
stderr: [ERROR project_model::workspace] cyclic deps: zed(Idx::<CrateData>(791)) -> vim(Idx::<CrateData>(748)), alternative path: vim(Idx::<CrateData>(748)) -> search(Idx::<CrateData>(553)) -> semantic_index(Idx::<CrateData>(556)) -> zed(Idx::<CrateData>(791))
stderr: [ERROR project_model::workspace] cyclic deps: zed(Idx::<CrateData>(791)) -> welcome(Idx::<CrateData>(775)), alternative path: welcome(Idx::<CrateData>(775)) -> vim(Idx::<CrateData>(748)) -> search(Idx::<CrateData>(553)) -> semantic_index(Idx::<CrateData>(556)) -> zed(Idx::<CrateData>(791))
stderr: [ERROR project_model::workspace] cyclic deps: zed(Idx::<CrateData>(791)) -> assistant(Idx::<CrateData>(35)), alternative path: assistant(Idx::<CrateData>(35)) -> search(Idx::<CrateData>(553)) -> semantic_index(Idx::<CrateData>(556)) -> zed(Idx::<CrateData>(791))
stderr: [ERROR project_model::workspace] cyclic deps: zed(Idx::<CrateData>(791)) -> breadcrumbs(Idx::<CrateData>(88)), alternative path: breadcrumbs(Idx::<CrateData>(88)) -> search(Idx::<CrateData>(553)) -> semantic_index(Idx::<CrateData>(556)) -> zed(Idx::<CrateData>(791))
stderr: [ERROR project_model::workspace] cyclic deps: zed(Idx::<CrateData>(791)) -> collab_ui(Idx::<CrateData>(129)), alternative path: collab_ui(Idx::<CrateData>(129)) -> feedback(Idx::<CrateData>(219)) -> search(Idx::<CrateData>(553)) -> semantic_index(Idx::<CrateData>(556)) -> zed(Idx::<CrateData>(791))
stderr: [ERROR project_model::workspace] cyclic deps: zed(Idx::<CrateData>(791)) -> feedback(Idx::<CrateData>(219)), alternative path: feedback(Idx::<CrateData>(219)) -> search(Idx::<CrateData>(553)) -> semantic_index(Idx::<CrateData>(556)) -> zed(Idx::<CrateData>(791))
stderr: [ERROR project_model::workspace] cyclic deps: zed(Idx::<CrateData>(791)) -> quick_action_bar(Idx::<CrateData>(480)), alternative path: quick_action_bar(Idx::<CrateData>(480)) -> assistant(Idx::<CrateData>(35)) -> search(Idx::<CrateData>(553)) -> semantic_index(Idx::<CrateData>(556)) -> zed(Idx::<CrateData>(791))
stderr: [ERROR project_model::workspace] cyclic deps: zed(Idx::<CrateData>(791)) -> search(Idx::<CrateData>(553)), alternative path: search(Idx::<CrateData>(553)) -> semantic_index(Idx::<CrateData>(556)) -> zed(Idx::<CrateData>(791))
stderr: [ERROR project_model::workspace] cyclic deps: zed(Idx::<CrateData>(791)) -> semantic_index(Idx::<CrateData>(556)), alternative path: semantic_index(Idx::<CrateData>(556)) -> zed(Idx::<CrateData>(791))
stderr: [ERROR project_model::workspace] cyclic deps: zed(Idx::<CrateData>(791)) -> terminal_view(Idx::<CrateData>(643)), alternative path: terminal_view(Idx::<CrateData>(643)) -> search(Idx::<CrateData>(553)) -> semantic_index(Idx::<CrateData>(556)) -> zed(Idx::<CrateData>(791))
stderr: [ERROR project_model::workspace] cyclic deps: zed(Idx::<CrateData>(791)) -> vim(Idx::<CrateData>(748)), alternative path: vim(Idx::<CrateData>(748)) -> search(Idx::<CrateData>(553)) -> semantic_index(Idx::<CrateData>(556)) -> zed(Idx::<CrateData>(791))
stderr: [ERROR project_model::workspace] cyclic deps: zed(Idx::<CrateData>(791)) -> welcome(Idx::<CrateData>(775)), alternative path: welcome(Idx::<CrateData>(775)) -> vim(Idx::<CrateData>(748)) -> search(Idx::<CrateData>(553)) -> semantic_index(Idx::<CrateData>(556)) -> zed(Idx::<CrateData>(791))
```

so move the example into `zed` instead.
2023-10-13 10:35:35 +03:00
Kirill Bulatov 525ff6bf74 Remove zed -> ... -> semantic_index -> zed Cargo dependency cycle 2023-10-13 10:27:08 +03:00
Kirill Bulatov ef73bf799c Fix license issue 2023-10-12 16:26:28 +03:00
Kirill Bulatov 7aea95704e Revert unnecessary style changes 2023-10-12 16:17:41 +03:00
Kirill Bulatov 09ef3ccf67 Fix tailwind prettier plugin discovery 2023-10-12 15:58:00 +03:00
Kirill Bulatov 12d7d8db0a Make all formatting to happen on the client's buffers, as needed 2023-10-12 15:29:57 +03:00
Kirill Bulatov 1bfde4bfa2 Add more tests 2023-10-12 15:14:51 +03:00
Kirill Bulatov 7f4ebf50d3 Make the first prettier test pass 2023-10-12 13:30:49 +03:00
Kirill Bulatov a528c6c686 Prettier server style fixes 2023-10-12 12:31:30 +03:00
Kirill Bulatov e50f4c0ee5 Add prettier tests infrastructure 2023-10-11 19:13:28 +03:00
Kirill Bulatov 4a88a9e253 Initialize prettier right after the buffer gets it language 2023-10-11 14:48:32 +03:00
Kirill Bulatov 986a516bf1 Small style fixes 2023-10-11 12:56:29 +03:00
Kirill Bulatov 9bf22c56cd Rebase fixes 2023-10-11 12:56:29 +03:00
Kirill Bulatov b5705e079f Draft remote prettier formatting 2023-10-11 12:56:29 +03:00
Kirill Bulatov 2ec2036c2f Invoke remote Prettier commands 2023-10-11 12:56:29 +03:00
Kirill Bulatov faf1d38a6d Draft local and remote prettier separation 2023-10-11 12:56:29 +03:00
Kirill Bulatov 6c1c7eaf75 Better detect Svelte plugins 2023-10-11 12:56:29 +03:00
Kirill Bulatov 2d5741aef8 Better prettier format logging 2023-10-11 12:56:29 +03:00
Kirill Bulatov a9f80a603c Resolve prettier config before every formatting 2023-10-11 12:56:29 +03:00
Kirill Bulatov 658b58378e Properly use WorktreeId 2023-10-11 12:56:29 +03:00
Kirill Bulatov 8a807102a6 Properly support prettier plugins 2023-10-11 12:56:29 +03:00
Kirill Bulatov afee29ad3f Do not clear cache for default prettiers 2023-10-11 12:56:29 +03:00
Kirill Bulatov 6ec3927dd3 Allow to configure default prettier 2023-10-11 12:56:29 +03:00
Kirill Bulatov b109075bf2 Watch for prettier file changes 2023-10-11 12:56:29 +03:00
Kirill Bulatov f4667cbc33 Resolve prettier config on server init 2023-10-11 12:56:29 +03:00
Kirill Bulatov d021842fa1 Properly log pre-lsp prettier_server events 2023-10-11 12:56:29 +03:00
Kirill Bulatov f42cb109a0 Improve prettier_server LSP names in the log panel 2023-10-11 12:56:29 +03:00
Kirill Bulatov 1b70e7d0df Before server startup, log to stderr 2023-10-11 12:56:29 +03:00
Kirill Bulatov b687270207 Implement missing prettier_server clear method 2023-10-11 12:56:29 +03:00
Kirill Bulatov 06cac18d78 Return message id in prettier_server error responses 2023-10-11 12:56:29 +03:00
Kirill Bulatov 6cac58b34c Add prettier language servers to LSP logs panel 2023-10-11 12:56:29 +03:00
Kirill Bulatov 4b15a2bd63 Rebase fixes 2023-10-11 12:56:29 +03:00
Kirill Bulatov e8409a0108 Even more generic header printing in prettier_server 2023-10-11 12:56:29 +03:00
Kirill Bulatov 39ad3a625c Generify prettier properties, add tabWidth 2023-10-11 12:56:29 +03:00
Kirill Bulatov 2a5b9b635b Better pass prettier options 2023-10-11 12:56:29 +03:00
Kirill Bulatov e2056756ef Calculate the diff 2023-10-11 12:56:29 +03:00
Kirill Bulatov 6a8e3fd02d Add more parameters into prettier invocations 2023-10-11 12:56:29 +03:00
Kirill Bulatov 2a68f01402 Draft prettier_server formatting 2023-10-11 12:56:29 +03:00
Kirill Bulatov dca93fb177 Initialize prettier_server.js wrapper along with default prettier 2023-10-11 12:56:29 +03:00
Kirill Bulatov 010bb73ac2 Use LSP-like protocol for prettier wrapper commands 2023-10-11 12:56:29 +03:00
Kirill Bulatov bb2cc2d157 Async-ify prettier wrapper 2023-10-11 12:56:29 +03:00
Kirill Bulatov 86618a64c6 Require prettier argument and library in the wrapper 2023-10-11 12:56:29 +03:00
Kirill Bulatov 1ff17bd15d Install default prettier and plugins on startup 2023-10-11 12:56:29 +03:00
Kirill Bulatov 12ea12e4e7 Make language adapters able to require certain bundled formatters 2023-10-11 12:56:29 +03:00
Kirill Bulatov 4f956d71e2 Slightly better prettier settings and discovery 2023-10-11 12:56:29 +03:00
Kirill Bulatov ce6b31d938 Make NodeRuntime non-static for prettier runner 2023-10-11 12:56:29 +03:00
Kirill Bulatov a8387b8b19 Use proper NodeRuntime in the formatter interface 2023-10-11 12:56:28 +03:00
Kirill Bulatov a420d9cdc7 Add prettier search 2023-10-11 12:56:28 +03:00
Kirill Bulatov a8dfa01362 Prepare prettier file lookup code infra 2023-10-11 12:56:28 +03:00
Kirill Bulatov 92f23e626e Properly connect prettier lookup/creation methods 2023-10-11 12:56:28 +03:00
Kirill Bulatov 553abd01be Draft a project part of the prettier 2023-10-11 12:56:28 +03:00
Kirill Bulatov 639ae671ae Omit history files with path that does not exist on disk anymore 2023-10-10 12:26:48 +03:00
Kirill Bulatov bb85d6f63e Detect file paths that end with : (#3109)
New rustc messages look like

```
thread 'tests::test_history_items_vs_very_good_external_match' panicked at crates/file_finder/src/file_finder.rs:1902:13:
assertion `left == right` failed: Only one history item contains collab_ui, it should be present and others should be filtered out
  left: 0
 right: 1
```

now and we fail to parse that `13:` bit properly, fix that.

One caveat is that we highlight the entire word including the trailing
`:`:
<img width="914" alt="image"
src="https://github.com/zed-industries/zed/assets/2690773/d653a8ff-3e6e-4e3d-b6ea-dad0c8db0f06">

this is unfortunate, but better than nothing (as now).
This is due to the fact, that we detect words with regex inside the
`terminal.rs` and send events to other place that's able to check paths
for existence (and whether that's a path at all), currently there's no
way to detect a path and sanitize it in `terminal.rs`

Release Notes:

- N/A
2023-10-09 23:16:03 +02:00
Kirill Bulatov ba4f4e0a3e Detect file paths that end with :
New rustc messages look like

```
thread 'tests::test_history_items_vs_very_good_external_match' panicked at crates/file_finder/src/file_finder.rs:1902:13:
assertion `left == right` failed: Only one history item contains collab_ui, it should be present and others should be filtered out
  left: 0
 right: 1
```

now and we fail to parse that `13:` bit properly, fix that.
2023-10-09 23:55:58 +03:00
Kirill Bulatov 0823a18cff Ignore history items' paths when matching search queries (#3107)
Follow-up of https://github.com/zed-industries/zed/pull/3059 

Before: 

![image](https://github.com/zed-industries/zed/assets/2690773/4eb2d2d1-1aa3-40b8-b782-bf2bc5f17b43)

After:

![image](https://github.com/zed-industries/zed/assets/2690773/5587d46b-9198-45fe-9372-114a95d4b7d6)

Release Notes:

- N/A
2023-10-09 22:35:11 +02:00
Kirill Bulatov 9cba45910e Ignore history items' paths when matching search queries 2023-10-09 23:14:32 +03:00
Kirill Bulatov 38d53a6fe2 Bump curl-sys to fix Sonoma issues with it
See https://github.com/alexcrichton/curl-rust/issues/524
2023-10-09 17:09:58 +03:00
Kirill Bulatov a8188a2f33 Improve file finder ergonomics (#3059)
Deals with https://github.com/zed-industries/community/issues/2086
Part of https://github.com/zed-industries/community/issues/351

Initial:
<img width="585" alt="Screenshot 2023-09-28 at 09 50 05"
src="https://github.com/zed-industries/zed/assets/2690773/e0149312-dfe3-4b7c-948c-0f593d6f540c">
First query letter input (only two history items match that, both are
preserved on top, with their order preserved also)
<img width="603" alt="Screenshot 2023-09-28 at 09 50 08"
src="https://github.com/zed-industries/zed/assets/2690773/85ab2f4c-bb9c-4811-b8b0-b5c14a370ae2">
Second query letter input, no matching history items:
<img width="614" alt="Screenshot 2023-09-28 at 09 50 11"
src="https://github.com/zed-industries/zed/assets/2690773/6d380403-a43c-4f00-a05b-88f43f91fefb">
Remove second query letter, history items match again and pop to the
top:
<img width="574" alt="Screenshot 2023-09-28 at 09 50 15"
src="https://github.com/zed-industries/zed/assets/2690773/5981ca53-6bc8-4305-ae36-27144080e1a2">


* allows `file_finder::Toggle` (cmd-p by default) to cycle through file
finder items (ESC closes the modal still)
* on query typing, preserve history items that match the query and keep
them on top, with their ordering preserved
* show history items' matched letters

Release Notes:

- Improve file finder ergonomics: allow cycle through items with the
toggle action, preserve matching history items on query input
2023-09-28 19:53:09 +03:00
Kirill Bulatov d30385f07c Show path matches inside history items matching the query 2023-09-28 09:49:25 -07:00
Kirill Bulatov 1b5ff68c43 Show matching search history whenever possible 2023-09-28 09:34:20 -07:00
Kirill Bulatov 97eabe6f81 Add tests 2023-09-28 09:00:25 -07:00
Kirill Bulatov 57a95d1799 Preserve matching history items and their order 2023-09-28 06:55:49 -07:00