ZIm/crates
Finn Evers 06794f35bc
assistant: Do not create new context on load (#29480)
Closes https://github.com/zed-industries/zed/issues/27673
Closes https://github.com/zed-industries/zed/issues/29344
Closes #29863 

This PR fixes an issue where Zed was showing no language and `4:1` as a
line/column value on startup, as described in the linked issues. You can
actually see in the first issue that the user also experiences the same
issue as described in the second one, as his line/column value is
noticably also `4:1`.


https://github.com/user-attachments/assets/bb60e387-f4b8-4e05-80b3-4dadf1a01262

This issue arises because on assistant panel load, a new context is
created and its editor focused. However, the editor is not visible
despite having focus. The content for the editor for a new context is
`\n\n\n` and the cursor is inserted directly after that - this is where
the line:column position `4:1` comes from. For the assistant panel
editor, the language is intentionally hidden, this is why the language
is not shown on workspace load.
The issue is only present for as long as the user does not focus and
edit another editor, then that instance is focused and everything starts
to work properly again.

As this issue only arises with the old assistant panel, some staff
members were unable to reproduce in the linked issues. Once you set
`export ZED_DISABLE_STAFF=1` in your environment, you should also be
able to reproduce this issue consistently.

--- 

This PR fixes the issue by not creating a new context on assistant panel
load. This should not cause any regressions; every other code path I
checked creates a new context if no context is yet present.
Additionally, this also seems somewhat more reasonable, as users which
have the assistant panel disabled will never need a new context anyway,
so no context should be created.

In the following video, you can see this fixes the issue when the
assistant panel was not open the last time Zed was opened. If the panel
was open before Zed was closed, we will still properly focus the panel
and then the `4:1` will show again, which in that case is correct. The
assistant panel editor is focused and the missing language as well as
the line number then match what the user sees, experiences and expects.


https://github.com/user-attachments/assets/224a786b-52c7-4212-bccb-dff6d9db62c3


Release Notes:

- Fixed an issue where Zed would show no language and an incorrect
line/column value on startup.

Co-authored-by: Peter Tripp <peter@zed.dev>
2025-05-06 11:38:08 +02:00
..
activity_indicator Git activity indicator (#28204) 2025-04-07 18:10:01 +00:00
agent Fix toolbar spacing regressions (#29964) 2025-05-05 22:28:35 -03:00
anthropic anthropic: Remove list of supported countries (#29346) 2025-04-24 15:17:33 +00:00
askpass Fix license symlinks (#29758) 2025-05-01 19:24:14 +00:00
assets Add workspace-hack (#27277) 2025-04-02 13:26:34 -07:00
assistant assistant: Do not create new context on load (#29480) 2025-05-06 11:38:08 +02:00
assistant_context_editor Update assistant to agent in settings and keymaps (#29943) 2025-05-06 01:02:56 +00:00
assistant_settings Update assistant to agent in settings and keymaps (#29943) 2025-05-06 01:02:56 +00:00
assistant_slash_command Add workspace-hack (#27277) 2025-04-02 13:26:34 -07:00
assistant_slash_commands assistant_slash_commands: Be more precise in content type matching (#29124) 2025-05-06 04:38:03 +00:00
assistant_tool Restore original file content when rejecting an overwritten file (#29974) 2025-05-06 07:05:55 +00:00
assistant_tools Restore original file content when rejecting an overwritten file (#29974) 2025-05-06 07:05:55 +00:00
audio Add workspace-hack (#27277) 2025-04-02 13:26:34 -07:00
auto_update VSCode Settings import (#29018) 2025-04-23 20:54:09 +00:00
auto_update_helper Update block diagnostics (#28006) 2025-04-15 09:35:13 -06:00
auto_update_ui Add searchable global tab switcher (#28047) 2025-04-28 09:21:27 +00:00
aws_http_client Add workspace-hack (#27277) 2025-04-02 13:26:34 -07:00
bedrock bedrock: Preserve thinking blocks for Bedrock (#29602) 2025-04-29 12:18:32 -04:00
breadcrumbs breadcrumbs: Update multibuffer to match singleton (#28267) 2025-04-07 20:26:55 +00:00
buffer_diff Fix diff recalculation hang (#28377) 2025-04-10 22:58:41 +00:00
call VSCode Settings import (#29018) 2025-04-23 20:54:09 +00:00
channel Add workspace-hack (#27277) 2025-04-02 13:26:34 -07:00
cli Try to weak-link ScreenCaptureKit always (#28585) 2025-04-11 17:38:14 +00:00
client client: Implement Socks identification and authorization (#29591) 2025-05-06 08:03:56 +00:00
clock Add the ability to follow the agent as it makes edits (#29839) 2025-05-04 08:28:39 +00:00
collab context_store: Refactor state management (#29910) 2025-05-05 21:36:12 +02:00
collab_ui Add the ability to follow the agent as it makes edits (#29839) 2025-05-04 08:28:39 +00:00
collections Add workspace-hack (#27277) 2025-04-02 13:26:34 -07:00
command_palette Simplify the SerializableItem::cleanup implementation (#29567) 2025-04-28 22:15:24 +00:00
command_palette_hooks Add workspace-hack (#27277) 2025-04-02 13:26:34 -07:00
component component: Component crate cleanup (#29967) 2025-05-06 03:41:52 +00:00
component_preview component: Component crate cleanup (#29967) 2025-05-06 03:41:52 +00:00
context_server context_store: Refactor state management (#29910) 2025-05-05 21:36:12 +02:00
copilot lsp: Don't log oneshot channel errors from notify (#29857) 2025-05-05 08:21:45 -04:00
credentials_provider Add workspace-hack (#27277) 2025-04-02 13:26:34 -07:00
dap debugger: Enable setting debug panel dock position to the side (#29914) 2025-05-05 21:27:20 +00:00
dap_adapters debugger/tasks: Remove TaskType enum (#29208) 2025-04-26 01:44:56 +02:00
db Simplify the SerializableItem::cleanup implementation (#29567) 2025-04-28 22:15:24 +00:00
debugger_tools debugger: Run build in terminal (#29645) 2025-05-05 20:08:14 +00:00
debugger_ui debugger: Fix debug scenario's defined in debug.json not using passed in build task (#29973) 2025-05-06 08:54:57 +02:00
deepseek Default to fast model for thread summaries and titles + don't include system prompt / context / thinking segments (#29102) 2025-04-19 23:26:29 +00:00
diagnostics Open diagnostics editor faster when fetching cargo diagnostics (#29787) 2025-05-02 12:10:01 +00:00
docs_preprocessor Add workspace-hack (#27277) 2025-04-02 13:26:34 -07:00
editor Fix panic in update_selection_occurrence_highlights (#29979) 2025-05-06 10:23:51 +01:00
eval Terminal tool improvements (#29924) 2025-05-05 15:57:03 -04:00
extension context_store: Refactor state management (#29910) 2025-05-05 21:36:12 +02:00
extension_api zed_extension_api: Release v0.5.0 (#29802) 2025-05-02 15:58:54 +00:00
extension_cli Add workspace-hack (#27277) 2025-04-02 13:26:34 -07:00
extension_host context_store: Refactor state management (#29910) 2025-05-05 21:36:12 +02:00
extensions_ui Suggest nim extension for *.nim files (#29912) 2025-05-05 11:46:42 +00:00
feature_flags feature_flags: Add a constant to control Agent-related feature flags (#29853) 2025-05-03 20:16:25 +00:00
feedback feedback: Update issue template URL (#28790) 2025-04-15 21:36:30 -04:00
file_finder Properly score fuzzy match queries with multiple chars in lower case (#29794) 2025-05-02 15:02:53 +00:00
file_icons Add workspace-hack (#27277) 2025-04-02 13:26:34 -07:00
fs Improve handling of remote-tracking branches in the picker (#29744) 2025-05-01 21:24:26 -04:00
fsevent Add workspace-hack (#27277) 2025-04-02 13:26:34 -07:00
fuzzy Properly score fuzzy match queries with multiple chars in lower case (#29794) 2025-05-02 15:02:53 +00:00
git Improve handling of remote-tracking branches in the picker (#29744) 2025-05-01 21:24:26 -04:00
git_hosting_providers VSCode Settings import (#29018) 2025-04-23 20:54:09 +00:00
git_ui Fix toolbar spacing regressions (#29964) 2025-05-05 22:28:35 -03:00
go_to_line VSCode Settings import (#29018) 2025-04-23 20:54:09 +00:00
google_ai Add support for getting the token count for all parts of Gemini generation requests (#29630) 2025-05-04 21:32:45 +00:00
gpui gpui: Update argument name of the from_corners method (#29968) 2025-05-06 07:17:39 +03:00
gpui_macros Rename regex search tool to grep and accept an include glob pattern (#29100) 2025-04-20 00:53:30 +00:00
gpui_tokio Add workspace-hack (#27277) 2025-04-02 13:26:34 -07:00
html_to_markdown Add workspace-hack (#27277) 2025-04-02 13:26:34 -07:00
http_client reqwest_client: Only register proxies with valid proxy URIs (#27773) 2025-04-28 11:12:16 -04:00
http_client_tls Add workspace-hack (#27277) 2025-04-02 13:26:34 -07:00
icons agent: Add design adjustments to message editor (#29891) 2025-05-04 20:21:30 -03:00
image_viewer Add the ability to follow the agent as it makes edits (#29839) 2025-05-04 08:28:39 +00:00
indexed_docs Add --user-data-dir CLI flag and propose renaming support_dir to data_dir (#26886) 2025-04-10 21:16:43 +00:00
inline_completion Show edit predictions usage in status bar menu (#29046) 2025-04-18 14:15:19 +00:00
inline_completion_button Fix profile menu hover flickering due to documentation asides (#29958) 2025-05-05 23:05:47 +00:00
install_cli install_cli: Show feedback when installing CLI from welcome screen (#28532) 2025-04-11 01:47:40 +05:30
journal VSCode Settings import (#29018) 2025-04-23 20:54:09 +00:00
language language: Fix larger syntax node when cursor is at end of word or line (#29978) 2025-05-06 14:43:28 +05:30
language_extension Add workspace-hack (#27277) 2025-04-02 13:26:34 -07:00
language_model Change cloud language model provider JSON protocol to surface errors and usage information (#29830) 2025-05-04 17:37:42 +00:00
language_model_selector Update assistant to agent in settings and keymaps (#29943) 2025-05-06 01:02:56 +00:00
language_models openai: Don't append tool calls to prior assistant messages (#29969) 2025-05-05 22:04:56 -07:00
language_selector Add workspace-hack (#27277) 2025-04-02 13:26:34 -07:00
language_tools Add searchable global tab switcher (#28047) 2025-04-28 09:21:27 +00:00
languages Improve Rust macro highlighting (#28182) 2025-05-05 23:50:57 +03:00
livekit_api Add workspace-hack (#27277) 2025-04-02 13:26:34 -07:00
livekit_client Fix deafening new participants (#28330) 2025-04-08 16:01:27 +00:00
lmstudio Add workspace-hack (#27277) 2025-04-02 13:26:34 -07:00
lsp lsp: Don't log oneshot channel errors from notify (#29857) 2025-05-05 08:21:45 -04:00
markdown Make code block eval resilient to indentation (#29633) 2025-04-30 02:13:13 +00:00
markdown_preview Use image cache to stop leaking images (#29452) 2025-04-29 19:30:16 +00:00
media chore: Make objc a workspace level crate (#28258) 2025-04-07 18:46:09 +00:00
menu agent: Add new panel navigation dropdown (#29539) 2025-04-29 21:58:45 -03:00
migrator Update assistant to agent in settings and keymaps (#29943) 2025-05-06 01:02:56 +00:00
mistral Switch from open-codestral-mamba to codestral-latest for default mistral model (#29104) 2025-04-19 23:29:36 +00:00
multi_buffer agent: Review edits in single-file editors (#29820) 2025-05-02 17:57:16 -03:00
node_runtime reqwest_client: Only register proxies with valid proxy URIs (#27773) 2025-04-28 11:12:16 -04:00
notifications Merge Component and ComponentPreview trait (#28365) 2025-04-08 16:09:06 -06:00
ollama ollama: Add tool call support (#29563) 2025-05-05 17:52:23 +00:00
open_ai open_ai: Remove list of supported countries (#29347) 2025-04-24 14:55:37 +00:00
outline Highlight merge conflicts and provide for resolving them (#28065) 2025-04-23 12:38:46 -04:00
outline_panel editor: Remove extra quotes from outline search term (#29829) 2025-05-06 10:50:33 +03:00
panel Add workspace-hack (#27277) 2025-04-02 13:26:34 -07:00
paths VSCode Settings import (#29018) 2025-04-23 20:54:09 +00:00
picker debugger: Add debug task picker to new session modal (#29702) 2025-05-02 08:38:29 +00:00
prettier Add workspace-hack (#27277) 2025-04-02 13:26:34 -07:00
project debugger: Fix debug scenario's defined in debug.json not using passed in build task (#29973) 2025-05-06 08:54:57 +02:00
project_panel Add the ability to follow the agent as it makes edits (#29839) 2025-05-04 08:28:39 +00:00
project_symbols Add workspace-hack (#27277) 2025-04-02 13:26:34 -07:00
prompt_store Manual no tool calls (#29745) 2025-05-01 16:11:13 -04:00
proto collab: Pass down billing information in UpdatePlan message (#29929) 2025-05-05 11:48:31 -04:00
recent_projects Properly restore window position for SSH projects (#29904) 2025-05-05 08:46:49 +00:00
refineable Add workspace-hack (#27277) 2025-04-02 13:26:34 -07:00
release_channel Fix handling of --system-specs argument so it happens before Application::new (#29240) 2025-04-22 21:32:32 +00:00
remote Add workspace-hack (#27277) 2025-04-02 13:26:34 -07:00
remote_server Improve handling of remote-tracking branches in the picker (#29744) 2025-05-01 21:24:26 -04:00
repl Add the ability to follow the agent as it makes edits (#29839) 2025-05-04 08:28:39 +00:00
reqwest_client Fix license symlinks (#29758) 2025-05-01 19:24:14 +00:00
rich_text Add workspace-hack (#27277) 2025-04-02 13:26:34 -07:00
rope chore: Bump Rust version to 1.86 (#28021) 2025-04-03 23:32:50 +02:00
rpc rpc: Remove llm module in favor of zed_llm_client (#28900) 2025-04-16 20:22:44 +00:00
rules_library agent: Add "max mode" toggle (#29549) 2025-04-28 16:50:47 +00:00
schema_generator Add workspace-hack (#27277) 2025-04-02 13:26:34 -07:00
search project_search: Ensure filter row aligns with other search rows (#29886) 2025-05-05 09:35:48 +03:00
semantic_index agent: Add "max mode" toggle (#29549) 2025-04-28 16:50:47 +00:00
semantic_version Add workspace-hack (#27277) 2025-04-02 13:26:34 -07:00
session Avoid unnecessary DB writes (#29417) 2025-04-25 17:41:49 +03:00
settings Refactor markdown formatting utilities to avoid building intermediate strings (#29511) 2025-04-27 19:04:51 +00:00
settings_ui Add searchable global tab switcher (#28047) 2025-04-28 09:21:27 +00:00
snippet Add workspace-hack (#27277) 2025-04-02 13:26:34 -07:00
snippet_provider snippet_provider: Use proper casing of VsCode in identifiers (#29038) 2025-04-18 12:11:54 +00:00
snippets_ui Add workspace-hack (#27277) 2025-04-02 13:26:34 -07:00
sqlez Simplify the SerializableItem::cleanup implementation (#29567) 2025-04-28 22:15:24 +00:00
sqlez_macros Add workspace-hack (#27277) 2025-04-02 13:26:34 -07:00
story Add workspace-hack (#27277) 2025-04-02 13:26:34 -07:00
storybook Merge Component and ComponentPreview trait (#28365) 2025-04-08 16:09:06 -06:00
streaming_diff Introduce a new StreamingEditFileTool (#29733) 2025-05-01 17:37:43 +02:00
sum_tree Add workspace-hack (#27277) 2025-04-02 13:26:34 -07:00
supermaven Add workspace-hack (#27277) 2025-04-02 13:26:34 -07:00
supermaven_api Add workspace-hack (#27277) 2025-04-02 13:26:34 -07:00
tab_switcher Add searchable global tab switcher (#28047) 2025-04-28 09:21:27 +00:00
task debugger: Fix debug scenario's defined in debug.json not using passed in build task (#29973) 2025-05-06 08:54:57 +02:00
tasks_ui debugger: Add debug task picker to new session modal (#29702) 2025-05-02 08:38:29 +00:00
telemetry Add workspace-hack (#27277) 2025-04-02 13:26:34 -07:00
telemetry_events Add new action to run agent eval (#29158) 2025-04-21 21:30:21 -07:00
terminal agent: Improve terminal tool card design (#29712) 2025-05-05 18:50:53 +00:00
terminal_view agent: Improve terminal tool card design (#29712) 2025-05-05 18:50:53 +00:00
text format: Re-implement support for formatting with code actions that contain commands (#28392) 2025-04-09 01:53:54 +00:00
theme Allow the agent panel font size to be customized (#29954) 2025-05-05 16:13:14 -06:00
theme_extension Add workspace-hack (#27277) 2025-04-02 13:26:34 -07:00
theme_importer theme_importer: Handle comma-separated token scopes (#27740) 2025-04-23 14:06:58 +00:00
theme_selector theme_selector: Don't select last theme when fuzzy searching (#28278) 2025-04-28 14:29:17 +00:00
time_format Add workspace-hack (#27277) 2025-04-02 13:26:34 -07:00
title_bar title_bar: Add icon for project branch trigger button (#29494) 2025-05-06 08:38:24 +00:00
toolchain_selector toolchain: Respect currently focused file when querying toolchains (#28875) 2025-04-16 19:05:57 +02:00
ui component: Component crate cleanup (#29967) 2025-05-06 03:41:52 +00:00
ui_input Merge Component and ComponentPreview trait (#28365) 2025-04-08 16:09:06 -06:00
ui_macros Merge Component and ComponentPreview trait (#28365) 2025-04-08 16:09:06 -06:00
ui_prompt markdown: Don't retain MarkdownStyle in favor of using MarkdownElement directly (#28255) 2025-04-07 19:03:24 +00:00
util agent: Create TerminalToolCard and display shell output while it's running (#29546) 2025-04-29 16:06:43 +00:00
util_macros Fix license symlinks (#29758) 2025-05-01 19:24:14 +00:00
vim Update assistant to agent in settings and keymaps (#29943) 2025-05-06 01:02:56 +00:00
vim_mode_setting VSCode Settings import (#29018) 2025-04-23 20:54:09 +00:00
web_search agent: Expose web search tool to beta users (#29273) 2025-04-23 15:30:20 +00:00
web_search_providers agent: Switch to new web search provider (#29951) 2025-05-06 00:47:11 +02:00
welcome welcome: Theme preview tile (#29689) 2025-04-30 17:46:11 +00:00
workspace Fix toolbar spacing regressions (#29964) 2025-05-05 22:28:35 -03:00
worktree Fix agent rules files for remote project by loading via buffer (#29440) 2025-04-25 20:06:40 +00:00
zed Fix toolbar spacing regressions (#29964) 2025-05-05 22:28:35 -03:00
zed_actions Update assistant to agent in settings and keymaps (#29943) 2025-05-06 01:02:56 +00:00
zeta Use u64 instead of usize in ElementId (#29493) 2025-04-27 02:31:25 +00:00
zlog zlog: Fall back to printing module path instead of *unknown* or just crate name (#29691) 2025-05-01 10:59:51 -04:00
zlog_settings VSCode Settings import (#29018) 2025-04-23 20:54:09 +00:00