`[NSString UTF8String]` sometimes returns null (it's documented as
such), and when it does, zed crashes in `window::insert_text`. I'm
running into this sometimes when using alt-d to delete forward. It
usually only happens with multiple cursors, but sometimes with a single
cursor. It *might* only happen when using the "Unicode Hex Input"
keyboard 'Input Source' (which I started using to avoid entering weird
characters in zed when using emacs meta keybindings that I haven't
defined in zed).
When using the US English input source, alt-d always results in a call
to `insert_text`. When using the Unicode Hex Input source it usually
doesn't, but when it does `text.UTF8String()` returns null. `text` isn't
null. `[text length]` returns 1. `[text characterAtIndex: 0]` seems to
always return `56797` (an undefined utf-16 codepoint).
Release Notes:
- Fixed crash on mac when deleting with alt-d
Fixes multiple issues that prevented window bounds restoration to not
work on Wayland.
Note: Since the display uuid depends on the `wl_output.name` field, this
only works properly on KDE 5.26+ or Gnome 44+ ([kwin
commit](330a02d862),
[mutter](7e838b1115)).
Release Notes:
- N/A
You can opt into using VTSLS instead of typescript-language-server by
pasting the following snippet into your settings:
```
"languages": {
"TSX": {
"language_servers": [
"!typescript-language-server",
"vtsls-language-server"
]
}
},
```
Related to: #5166
Release Notes:
- Added support for using [vtsls](https://github.com/yioneko/vtsls)
language server for Typescript/Javascript.
This fixes#11236 by ignoring the `bounds.origin` values when the window
is only being resized.
The cause for the issue was that the `ConfigureNotify` event would
contain "wrong" values when the window was being resized (by dragging a
corner).
In my case it would *always* contain x:14/y:49, which is I think might
map to the origin of the top bar in GNOME.
We would then persist these wrong values when serializing the workspace.
On restart, we'd use these values and end up with the window decorations
in the wrong place.
What I still don't know:
1. What exactly the 14/49 map to, because it's not the origin of the top
bar in GNOME. I also tried the X11 TranslateCoordinates call but
couldn't get meaningful results back (even taking scale factor into
account).
2. Why the window decorations end up looking wrong vs. the window being
in the first place. But if you look at my screenshot in #11236, it looks
like the decorations are off exactly by 14/49px.
That being said, I think the solution here is a good one for now: we
don't do an additional X11 call and when we're resizing, we're not
interested in the origin changing.
Release Notes:
- N/A
Proof:
[Screencast from 2024-06-03
15-08-36.webm](https://github.com/zed-industries/zed/assets/1185253/90efccfc-8ec6-42d2-8380-1625eff57805)
Using the file system as a database seems like it's easy, but it's
actually a real pain. I'd like to use LMDB to store the prompts locally
so we have more control. We can always add an export option, but I want
the source of truth to be somewhere other than the file system.
So far, I have a PromptStore which is global to the application and can
be initialized on startup. Then there's a `PromptLibrary` which is
intended to be the root of a new kind of Zed window. I haven't actually
seen pixels yet, but I've sketched out the basics needed to create a new
prompt, save, etc.
Still lots to figure out but the foundations of being backed by a DB and
rendering in an independent window are in place.
/cc @iamnbutler @as-cii
Release Notes:
- N/A
---------
Co-authored-by: Antonio Scandurra <me@as-cii.com>
Also fix click handler for "Rerun last task".
Fixes#12580
Release Notes:
- Fixed click handler for "rerun last task" in task modal not working.
- Rebound "picker::UseSelectedQuery" from `opt-E` to `F2`.
@mrnugget spotted that tsconfig.json schema is getting applied on
current Nightly. I've tracked it down to a misconfiguration of JSON
language server. Mea culpa.
No release note as that change has not went out to the public yet.
Release Notes:
- N/A
This PR disables indent guides by default for single line editors. Right
now indent guides show up in the project search editor (which is only a
single line)
<img width="715" alt="image"
src="https://github.com/zed-industries/zed/assets/53836821/0b61da71-6f64-424d-9612-6a34eac4686a">
Release Notes:
- Fixed an issue where indent guides would show up in a single line
editor (e.g. project search, buffer search)
Indent guides can be configured per language, meaning that in a multi
buffer we can get excerpts where indent guides should be
disabled/enabled/styled differently than other excerpts.
Imagine the following scenario, i have indent guides disabled in my
settings, but want to enable them for JS and Python. I also want to use
a different line width for python files. Something like this is now
supported:
<img width="445" alt="image"
src="https://github.com/zed-industries/zed/assets/53836821/0c91411c-145c-4210-a883-4c469d5cb828">
And the relevant settings for the example above:
```json
"indent_guides": {
"enabled": false
},
"languages": {
"JavaScript": {
"indent_guides": {
"enabled": true
}
},
"Python": {
"indent_guides": {
"enabled": true,
"line_width": 5
}
}
}
```
Release Notes:
- Respect language specific settings when showing indent guides in a
multibuffer
- Fixes an issue where indent guide specific settings were not
recognized when specified in local settings
Add runnable tasks for Python, starting with `unittest` from the
standard library. Both `TestCase`s (classes meant to be a unit of
testing) and individual test functions in a `TestCase` will have
runnable icons. For completeness, I also included a task that will run
`unittest` on the current file.
The implementation follows the `unittest` CLI. The unittest module can
be used from the command line to run tests from modules, classes or even
individual test methods:
```
python -m unittest test_module.TestClass
python -m unittest test_module.TestClass.test_method
```
```python
import unittest
class TestStringMethods(unittest.TestCase):
def test_upper(self):
self.assertEqual('foo'.upper(), 'FOO')
def test_isupper(self):
self.assertTrue('FOO'.isupper())
self.assertFalse('Foo'.isupper())
def test_split(self):
s = 'hello world'
self.assertEqual(s.split(), ['hello', 'world'])
# check that s.split fails when the separator is not a string
with self.assertRaises(TypeError):
s.split(2)
if __name__ == '__main__':
unittest.main()
```
From the snippet provided by `unittest` docs, a user may want to run
test_split independently of the other test functions in the test case.
Hence, I decided to make each test function runnable despite `TestCase`s
being the unit of testing.
## Example of running a `TestCase`
<img width="600" alt="image"
src="https://github.com/zed-industries/zed/assets/16619392/7be38b71-9d51-4b44-9840-f819502d600a">
## Example of running a test function in a `TestCase`
<img width="600" alt="image"
src="https://github.com/zed-industries/zed/assets/16619392/f0b6274c-4fa7-424e-a0f5-1dc723842046">
`unittest` will also run the `setUp` and `tearDown` fixtures.
Eventually, I want to add the more commonly used `pytest` runnables
(perhaps as an extension instead).
Release Notes:
- Added runnable tasks for Python `unittest`.
([#12080](https://github.com/zed-industries/zed/issues/12080)).
This commit also removes a bunch of dead code.
Fixes#12544
Release Notes:
- Removed branch popover menu - clicking on the branch name in left-hand
corner now always opens a branch modal
# Summary
Hi. Current `heredoc` injection for Ruby language captures the
`heredoc_end` token. That's a bit incorrect because we want to capture
the content only. Suppose we have the following Ruby code:
```ruby
<<~JS
function myFunc() {
const myConstant = [];
}
let a = '1'
JS
```
And this is its syntax tree:
```
[program] [0, 0] - [7, 0]
[heredoc_beginning] [0, 0] - [0, 5]
[heredoc_body] [0, 5] - [6, 2]
[heredoc_content] [0, 5] - [6, 0]
[heredoc_end] [6, 0] - [6, 2]
```
Current injection capture all content of the `heredoc_body`:
![CleanShot 2024-05-31 at 17 03
31@2x](https://github.com/zed-industries/zed/assets/1894248/ff8c5195-b532-42d2-91b1-48405a6d3b50)
But we want to capture the `heredoc_content` only and this PR resolves
that, additionally it downcases the language like Zed does in other
languages like Terraform.
![CleanShot 2024-05-31 at 17 05
17@2x](https://github.com/zed-industries/zed/assets/1894248/e81dabd0-3246-4ef2-9524-a7adcb9242ab)
Release Notes:
- N/A
This PR fixes the location of the `injections.scm` query within the Ruby
extension.
Same as #12532, but without the content changes to `injections.scm`.
Release Notes:
- N/A
$ZED_SYMBOL doesn't really work here once that will try to do something
like this:
mix test MyModule.MyModuleTest
instead of using the path of the file:
mix test test/my_module/my_module_test.exs
Release Notes:
- Fix mix test $ZED_SYMBOL to use ZED_RELATIVE_FILE instead
- Use ZED_RELATIVE_FILE instead of ZED_FILE to improve mix tasks results
on Elixir umbrella projects
Fixed bug introduced in:
https://github.com/zed-industries/zed/pull/12502
Filtering before `enumerate` call breaks project order and instead of
hiding current project it hides some other project.
Release Notes:
- N/A
When indent guides were still WIP, I thought it might be a good idea to
detect the tab size for every line individually, so we can handle files
with mixed indentations. However, while optimizing the performance of
indent guides I found that getting the language at a given anchor was
pretty expensive, therefore I only resolved the language for the first
visible row. However, this could lead to some weird flickering, where
the indent guides would use different tab sizes depending on the first
visible row (see #12492). This can be fixed by just using the primary
buffer language size.
So as of right now indent guides cannot handle files with mixed
indentations. Im not sure if anyone actually does/expects this, but one
use case I could imagine is something like this:
User x has a svelte file, where the tab size is set to `4`. However the
svelte code uses typescript inside a script tag, which User x wants to
use a tab size of `2`. The approach used here would not work for this,
but then again I think our formatter does not even support something
like this. Im probably overcomplicating things, so let's stick with the
simple solution for now.
Release Notes:
- Fixed an issue where indent guides would use an incorrect tab size
([#12492](https://github.com/zed-industries/zed/issues/12492)).
This PR fixes a small issue in `rustdoc_to_markdown` where we could push
a blank space after a newline, leading to an unwanted leading space.
Release Notes:
- N/A
#### Lazily loading channels
I've added a new RPC message called `SubscribeToChannels` that the
client now sends when it first renders the channels panel. This causes
the server to load the channels for that client and send updates to that
client as channels are updated. Previously, the server did this upon
connection.
For backwards compatibility, the server will inspect clients' version,
and continue to do this work immediately for old clients.
#### Optimizations
Running collab locally, I realized that upon connecting, we were running
two concurrent transactions that *both* queried the `channel_members`
table: one for loading your channels, and one for loading your channel
invites. I've combined these into one query. In addition, we now use a
join to load channels + members, as opposed to two separate queries.
Even though `where id in` is efficient, it adds an extra round trip to
the database, keeping the transaction open for slightly longer.
Release Notes:
- N/A
This PR improves `rustdoc_to_markdown`'s paragraph handling to produce
better output.
Specifically, there should now be fewer instances where a space is
missing between words as the result of line breaks in the source HTML.
Release Notes:
- N/A
This PR adds some helper methods to `HtmlElement` to make it easier to
interact with the element's attributes.
This cleans up a bunch of the code by a fair amount.
Release Notes:
- N/A
Previously, each git `Repository` object was held inside of a mutex.
This was needed because libgit2's Repository object is (as one would
expect) not thread safe. But now, the two longest-running git operations
that Zed performs, (`status` and `blame`) do not use libgit2 - they
invoke the `git` executable. For these operations, it's not necessary to
hold a lock on the repository.
In this PR, I've moved our mutex usage so that it only wraps the libgit2
calls, not our `git` subprocess spawns. The main user-facing impact of
this is that the UI is much more responsive when initially opening a
project with a very large git repository (e.g. `chromium`, `webkit`,
`linux`).
Release Notes:
- Improved Zed's responsiveness when initially opening a project
containing a very large git repository.
This PR sorts the `file_types.json` file alphabetically.
This is the command I used to sort it:
```
pnpm --package=json-sort-cli dlx jsonsort assets/icons/file_icons/file_types.json
```
Release Notes:
- N/A