!HCjHPBLFfoFpYNgwdE:matrix.org

Neovim dev

202 Members
Discussion about Neovim development and adjacent topics14 Servers

Load older messages


SenderMessageTime
13 Sep 2024
@fundar:matrix.orgdundargocSure14:51:07
@gpanders:matrix.orggpanders I completely missed https://github.com/neovim/neovim/pull/30313 while it was happening but THANK YOU Riley Bruins for pushing that through 15:37:32
@gpanders:matrix.orggpandersthat has long annoyed me (and I'm pleased to see it was an uncontroversial change)15:38:23
@mfussenegger:matrix.orgMathias huh, how is one supposed to adapt plugins to that if get_parser results in a warning if the parser is missing no matter what? 15:49:45
@gpanders:matrix.orggpanders switch to _get_parser temporarily, then switch back to get_parser (not ideal, but it works) 15:58:49
@gpanders:matrix.orggpanders * switch to _get_parser temporarily, then switch back to get_parser after 0.12 (not ideal, but it works) 15:58:54
@clason:matrix.orgclason
In reply to @mfussenegger:matrix.org
huh, how is one supposed to adapt plugins to that if get_parser results in a warning if the parser is missing no matter what?
Sorry, I don't quite get that.
16:03:22
@clason:matrix.orgclason The warning should not trigger the pcall? 16:03:38
@clason:matrix.orgclason(At least it shouldn't)16:03:48
@clason:matrix.orgclasonI didn't get to review the final state before it got merged, so I'm not sure what the actual behavior is16:04:47
@mfussenegger:matrix.orgMathias Maybe I read the diff wrong, but I think now get_parser will emit a warning whenever you call it on a parser that doesn't exist 16:06:59
@clason:matrix.orgclasonyes, as it should?16:07:36
@mfussenegger:matrix.orgMathiasyes, but how are plugins supposed to migrate so that users don't get a warning?16:07:55
@clason:matrix.orgclasonbefore, it triggered an error16:07:57
@clason:matrix.orgclasonah, I see what you mean16:08:08
@clason:matrix.orgclason(error got slurped by pcall)16:08:44
@clason:matrix.orgclason hmmm, that's a tough one (and one of the reasons the pcall model is so bad): do you want notification, or not? 16:09:19
@mfussenegger:matrix.orgMathiasI don't want notification because I have a fallback logic if the parser doesn't exist16:09:45
@clason:matrix.orgclason Yes, you don't 16:09:56
@clason:matrix.orgclasonBut others may have relied on the explicit error message16:10:08
@clason:matrix.orgclason (not defending the current behavior; I agree that it's suboptimal -- just trying to figure out what the right deprecation approach is here) 16:11:32
@lewis6991:matrix.orglewis6991I'm pretty sure in this case we don't want the error. It's up to the application to deal with that.16:11:41
@clason:matrix.orgclasonbecause pcall needs to die, one way or another16:11:46
@mfussenegger:matrix.orgMathias Could do it like iter_matches and add a parameter? 16:12:12
@clason:matrix.orgclason
In reply to @lewis6991:matrix.org
I'm pretty sure in this case we don't want the error. It's up to the application to deal with that.
No, I mean specifically the deprecation/migration strategy
16:12:17
@mfussenegger:matrix.orgMathias

Otherwise:

  local ok, parser
  if vim.treesitter._get_parser then
    parser = vim.treesitter._get_parser(bufnr)
    ok = parser ~= nil
  else
    ok, parser = pcall(vim.treesitter.get_parser, bufnr)
  end

would do the trick, but that means using private method

16:12:33
@clason:matrix.orgclasonthe new behavior is correct and should become the default16:12:54
@clason:matrix.orgclason
In reply to @mfussenegger:matrix.org
Could do it like iter_matches and add a parameter?
Maybe. I'd like to get an idea how the function is used, though, before we implement a strategy
16:13:44
@clason:matrix.orgclason(learn from mistakes and whatnot)16:13:58
@clason:matrix.orgclasonThinking about it, the current deprecation approach is the worst of both worlds16:14:26

Show newer messages


Back to Room ListRoom Version: 10