News for hackers. Stuff that matters.
Re:Zed now predicts your next edit with Zeta, our new open m... by boxed on Friday February 14, 2025 @04:03AM (#43046376)
I tried CoPilot a while and my biggest gripe was tab for accepting the suggestion. I very often got a ton of AI garbage when I was just trying to indent some code.

Tab just doesn't seem like the proper interface for something like this.

Re:Zed now predicts your next edit with Zeta, our new open m... by ljm on Friday February 14, 2025 @04:12AM (#43046428)
I actually wish more editors had emacs style indenting where hitting tab anywhere on the line would re-indent it or otherwise cycle through indent levels if it was unclear, especially because you’re unlikely to get copilot suggestions in the middle of a word. Plus, it doesn’t break if there’s a syntax error elsewhere in the file.
Re:Zed now predicts your next edit with Zeta, our new open m... by fhd2 on Friday February 14, 2025 @05:05AM (#43046799)
It's one of those weird Emacs things that you get _so_ used to that everything else seems to waste your time.

Using code formatters and formatting on save or with a shortcut is OK, but not really the same to me.

That's probably why I'm stuck with Emacs:

1. No need to use the mouse.

2. Extremely efficient keyboard usage (maybe not the most efficient, but compared with common IDEs, certainly).

Makes it feel like I'm actually using a brain computer interface. The somewhat regular yak shaving is a bit of a bummer though. I like that I can modify everything to be exactly how I like it, but I wouldn't mind sensible defaults. Haven't found a distribution yet that works well without tinkering.

Re:Zed now predicts your next edit with Zeta, our new open m... by ljm on Friday February 14, 2025 @07:00AM (#43047504)
Exactly, and sometimes I don't want to save a file just for indentation to happen as a side-effect, especially if I can do `C-x H TAB` to correctly re-indent the entire thing.

That's particularly more helpful when some formatters will actually rewrite your code to either break lines up or squish things back into a one-liner.

Re:Zed now predicts your next edit with Zeta, our new open m... by boxed on Friday February 14, 2025 @07:05AM (#43047531)
Oh, didn't know about that. That makes a lot of sense. Reminds me of how hitting cmd+c on a line in PyCharm copies the entire line if there is no selection. Because what else would make sense?
Re:Zed now predicts your next edit with Zeta, our new open m... by yencabulator on Friday February 14, 2025 @11:48AM (#43050303)
I thought that was a great feature. Now I'm writing mostly languages with well-defined formatting rules and simply never need tab. This is even better.
Re:Zed now predicts your next edit with Zeta, our new open m... by fstephany on Friday February 14, 2025 @04:11AM (#43046422)
You are not alone!
Re:Zed now predicts your next edit with Zeta, our new open m... by janaagaard on Friday February 14, 2025 @04:31AM (#43046564)
After using Prettier to format my code and turning on format-on-save, I pretty much don’t use the tab key anymore. This doesn’t invalidate your point, - I am merely guessing as to why the tab key seemingly has been reassigned.
Re:Zed now predicts your next edit with Zeta, our new open m... by moritzruth on Friday February 14, 2025 @04:37AM (#43046605)
Ctrl+Return works quite well for me in IntelliJ.
Re:Zed now predicts your next edit with Zeta, our new open m... by Mashimo on Friday February 14, 2025 @04:51AM (#43046707)
> to indent some code.

Why are you manually indenting code?

I don't remember ever doing that in IDEA or VS Code for ~~python,~~ java or ts.

Edit: I borked about python, my bad.

Re:Zed now predicts your next edit with Zeta, our new open m... by rfoo on Friday February 14, 2025 @05:06AM (#43046803)
For example, you have

    if check_something():
        wall_of_text = textwrap.dedent("""
    this
    is
    a
    multiline
    string
    """.strip("\n"))
I hope you agree it's ugly. And you want to make it

    if check_something():
        wall_of_text = textwrap.dedent("""\
            this
            is
            a
            multiline
            string
        """.strip("\n"))
But I don't know any formatter which does this automatically. Because the change here not only changes the looking, it changes semantic. The formatter has to understand that after `textwrap.dedent(_.strip("\n"))` the result does not change and that's hard. So formatter just leave it alone. But it's extremely obvious to a human. Or maybe extremely obvious to a LLM too.
Re:Zed now predicts your next edit with Zeta, our new open m... by Mashimo on Friday February 14, 2025 @05:33AM (#43046996)
Yeah, string """ blocks I also have to do manually. Though that example never interfered with AI autocomplete in my experience.
Re:Zed now predicts your next edit with Zeta, our new open m... by oneeyedpigeon on Friday February 14, 2025 @05:35AM (#43047010)
Isn't indentation 'non deterministic' in Python? E.g. if I have the following:

    if (foo):
        bar()
    hum()
how can anything other than a human decide if that 3rd line should be indented as it is or by one more level?
Re:Zed now predicts your next edit with Zeta, our new open m... by yurishimo on Friday February 14, 2025 @07:04AM (#43047528)
And this is one reason I still don't understand the use of python in large teams!

I suppose with very good tests, you might be able to catch something like this, but it seems impossible to me how a PR reviewer might catch a "bug" like this and not just assume that it's intentional.

Re:Zed now predicts your next edit with Zeta, our new open m... by DemetriousJones on Friday February 14, 2025 @08:01AM (#43047887)
One of my biggest gripes with python is the fact that the only way to create a local scope for variables is with functions.

I understand if statements not having their own scope for simplicity's sake, but the fact that `with` blocks don't is simply mind-bobbling to me. ``` with open("text.txt", 'w') as f: f.write("hello world") f.write("hello world") # at least the handle was automatically closed so it will give an IO error ```

Re:Zed now predicts your next edit with Zeta, our new open m... by orf on Friday February 14, 2025 @08:11AM (#43047951)
It’s actually very useful to have context managers outlive their with blocks. They are not only used for files:

One example would be a timing context manager:

   with Timer() as t:
      …
   print(t.runtime)
Another example is mocks, where you want to inspect how many times a mock was called and with what arguments, after the mock context manager has finished.
Re:Zed now predicts your next edit with Zeta, our new open m... by DemetriousJones on Friday February 14, 2025 @10:53AM (#43049660)
I know it makes sense in the "scope-less" python philosopy but it still feels weird for me as a scope (ab)user in C++ and has caused me one headache or two in the past
Re:Zed now predicts your next edit with Zeta, our new open m... by DemetriousJones on Friday February 14, 2025 @08:04AM (#43047910)
Sorry for the borked code formatting
Re:Zed now predicts your next edit with Zeta, our new open m... by neongreen on Friday February 14, 2025 @06:01PM (#43054012)
I learned about the `scoping` package today. Idk if it works exactly as I expect from other langs, though.
Re:Zed now predicts your next edit with Zeta, our new open m... by kstrauser on Friday February 14, 2025 @10:38AM (#43049440)
OTOH I’ve written Python professionally for about 25 years and I truly don’t think I’ve ever seen a bug due to accidental mis-indentation like that.
Re:Zed now predicts your next edit with Zeta, our new open m... by lostdog on Friday February 14, 2025 @03:41PM (#43052860)
When I worked in python I made this exact mistake monthly.
Re:Zed now predicts your next edit with Zeta, our new open m... by kstrauser on Friday February 14, 2025 @03:58PM (#43053008)
How, though? Every code editor I've used supports holding indentation at a certain level until you change it, so if you write:

  if foo:
      bar()
and hit enter after the "bar()", it would drop you down so that the next thing you type would be under the "b". It's not really different from using curly brackets from the perspective of typing in code.
Re:Zed now predicts your next edit with Zeta, our new open m... by lostdog on Friday February 14, 2025 @05:27PM (#43053793)
Cut and pasting code to move it around. Every editor was just slightly jittery about keeping the indentation levels consistent.
Re:Zed now predicts your next edit with Zeta, our new open m... by lukaslalinsky on Saturday February 15, 2025 @02:03AM (#43056515)
Completely agree, this is a common argument ever since Python existed. I've also used it for almost 25 years and these kind of indentation errors just don't happen. I see it the same as forgetting closing brace. Python programming writing C code might forget it initially, but C programmer absolutely will not forget it, it's in their muscle memory. And the same applies for dealing with indentation.
Re:Zed now predicts your next edit with Zeta, our new open m... by saghm on Friday February 14, 2025 @06:36AM (#43047343)
Even humans have trouble with that sometimes: https://www.blackduck.com/blog/understanding-apple-goto-fail...
Re:Zed now predicts your next edit with Zeta, our new open m... by oneeyedpigeon on Friday February 14, 2025 @07:03AM (#43047516)
Although, not in Python of course! :)
Re:Zed now predicts your next edit with Zeta, our new open m... by fragmede on Friday February 14, 2025 @05:39AM (#43047026)
How does the IDEA/VSCode know when you're done with the if?

    if foo:
        bar # Obviously this is indented
        but_is_this() # supposed to be under the if?
        how.about(this) #?
    how.do_you(de) # indent in Python, if not manually?
Re:Zed now predicts your next edit with Zeta, our new open m... by MaikuMori on Friday February 14, 2025 @06:24AM (#43047284)
Doesn't exactly fix the issue, bout you can cancel the suggestion with ESC and then press Tab.

Changing the shortcut should be possible, but I haven't tried.

Re:Zed now predicts your next edit with Zeta, our new open m... by boxed on Friday February 14, 2025 @07:06AM (#43047536)
It's a timing issue too. Your hand can be travelling to the keyboard and between that and registering in the OS the AI suggestion inserted itself inbetween.
Re:Zed now predicts your next edit with Zeta, our new open m... by madmulita on Friday February 14, 2025 @06:48AM (#43047410)
Don't give them ideas! I can already see the useless AI key next to Fn in my next keyboard.
Re:Zed now predicts your next edit with Zeta, our new open m... by card_zero on Friday February 14, 2025 @07:00AM (#43047498)
That already happened, just over a year ago, we have Copilot keys now.

I guess it invokes the AI rather than controling it, maybe there'll be another key soon.

Re:Zed now predicts your next edit with Zeta, our new open m... by yencabulator on Friday February 14, 2025 @11:49AM (#43050314)
See, you're thinking of Microsoft Copilot, but code completion is provided by Github Copilot, so it'll need its own key. Which will also be labeled Copilot.
Re:Zed now predicts your next edit with Zeta, our new open m... by as-cii on Friday February 14, 2025 @07:23AM (#43047663)
Hey! Zed founder here.

We totally agree with this and that's why Zed will switch the keybinding for accepting an edit prediction to `alt-tab` when the cursor is in the leading whitespace of a line. This way you can keep using `tab` for indenting in that situation.

Also, when there's both an edit prediction and and LSP completion, Zed switches the keybinding to `alt-tab` to prevent the conflict with accepting an LSP completion.

Curious to hear what you think!

Re:Zed now predicts your next edit with Zeta, our new open m... by maxloh on Friday February 14, 2025 @07:40AM (#43047771)
Hi. Could you explain how you plan to make money with the model while open-sourcing it?

It seems contradicting to me.

Re:Zed now predicts your next edit with Zeta, our new open m... by recov on Friday February 14, 2025 @11:32AM (#43050125)
Not everyone can, or wants to set up running a local model. And it'll probably be slower on most users GPUs then what zed runs it on.
Re:Zed now predicts your next edit with Zeta, our new open m... by danielsamuels on Friday February 14, 2025 @08:20AM (#43048006)
For reasons that should be obvious, that's not going to work on Windows.
Re:Zed now predicts your next edit with Zeta, our new open m... by as-cii on Friday February 14, 2025 @08:26AM (#43048050)
Sorry, I assumed macOS: but you're right! For Linux (and Windows, once we ship support for it) the keybinding is alt-l to avoid conflicting with tab switching.
Re:Zed now predicts your next edit with Zeta, our new open m... by VWWHFSfQ on Friday February 14, 2025 @08:55AM (#43048278)
Is there way to change this key binding (tab for accept) right now? Because otherwise I have to stop using this program. It is absolutely obnoxious.
Re:Zed now predicts your next edit with Zeta, our new open m... by awfulneutral on Friday February 14, 2025 @09:54AM (#43048919)
Ohhh, is that why I keep pressing tab and it doesn't accept the prediction lately? I thought it was a bug. It feels weird for tab to double-indent when it could be accepting a prediction - I wonder if alt-tab to do a manual indent rather than accept the current prediction might be preferable?

Edit - On the other hand, a related issue is that if the prediction itself starts with whitespace, in that case it would be good if tab just indents like normal; otherwise you can't indent without accepting the prediction.

Re:Zed now predicts your next edit with Zeta, our new open m... by daliusd on Friday February 14, 2025 @08:26AM (#43048047)
Yes, copilot's tab in vim is that made me think that AI is useless. However next iteration of AI coding tools made me rethink this (I am using https://github.com/olimorris/codecompanion.nvim with nvim now).
Re:Zed now predicts your next edit with Zeta, our new open m... by windward on Friday February 14, 2025 @10:50AM (#43049619)
AI coding tool implementers seem to be fans of novel editor fonts.
Re:Zed now predicts your next edit with Zeta, our new open m... by marcosdumay on Friday February 14, 2025 @08:31AM (#43048080)
It's way better than the other Microsoft favorites of space and enter...

It's as if people developing autocomplete doesn't really code.

Re:Zed now predicts your next edit with Zeta, our new open m... by relistan on Friday February 14, 2025 @09:30AM (#43048681)
Yeah, IMO tab makes no sense for this as the default.

Since I code in Go and use tabs regularly, I remapped my auto-complete AI key for Supermaven in Neovim to ctrl-L which I have no other occasion to use regularly. Now tab works properly and I can get auto-complete.