• 0 Posts
  • 235 Comments
Joined 2 years ago
cake
Cake day: June 13th, 2023

help-circle



  • ctrl v is convention for paste, but plenty of things (ex terminals) use that for something else. this is a universal (wrt the app receiving it) keycode that means paste. it lets you bind a key, or a keyboard shortcut, to the paste key and paste in any app. without this it isn’t possible.

    it doesn’t even have to be a new programmable keyboard. there exist software key remappers for linux.

    you could remap a mouse button to paste, you could remap ctrl v to always paste regardless of the app, etc., all in software, all not possible before.






  • well the language server plugins all run a binary language server out of sandbox so zed doesn’t really do anything safer in particular there either. no ide has solutions, solutions don’t really exist right now. it’s not a problem of features of the language as much as it is features developers expect in extensions. I suppose there is a hypothetical “the extension wants to make this change to this file, approve” type flow like AI tools have now, but that sounds unpleasant to use. it still doesn’t get around things like language servers being designed to run as standalone processes out of sandbox.

    by audits I meant you individually go and read all the code of all the extensions you use. of course that’s impossible too, but that was my point


  • I can’t imagine a sandbox would help. what can an an extension do that doesn’t touch some arbitrary code that gets run? it could add a line to the middle of a giant file right before you run and remove it immediately after. even if you run the whole editor in a sandbox you do eventually deploy that code somewhere, it can change something inconspicuous like a url in a dependency file that might not get caught in a pr

    the only solution is to audit everything you install, know all the code you run, etc. ofc that’s not reasonable, but idk what else there is. better automated virus check things maybe? identity verification for extension publishers? idk if there’s an actual solution








  • yeah there isn’t really a general purpose react way to do that.

    if order didn’t matter then you could just have a Header component that registers itself in a context but there’s no way to know where each component is relative to its siblings.

    the other way is to break out of react and just walk the dom. pass a ref to your component and use that as the root to walk. only works assuming normal react dom renderer and no portals.

    you can combine those two options too, use context for registration so you can attach extra info, then dom for position.

    there are some libs that let you walk a component tree, but they’re all focused on ssr and idk how they work in a browser. wouldn’t go this route for anything prod.

    last option is just store your content as data. have md/mdx/json/whatever files that are the content for your page, then as you parse them build up the tree. probably the most robust if it fits your use case. if you use MDX it seems like they already have some solutions