zls icon indicating copy to clipboard operation
zls copied to clipboard

Move to file action

Open Jarred-Sumner opened this issue 7 months ago • 0 comments

It would be really nice if there was a "move this struct to a new file" LSP action that becomes available when you select const Foo = struct {.... This would involve:

  • Copying all the referenced identifiers as imports in the new file
  • Adding pub in front of referenced identifiers and functions that are not public
  • Adding a pub const Foo = @import("./${target}.zig")

This is a feature that the TypeScript LSP has (when you click "Refactor")

Image

When you click "Move to file", it causes the editor to prompt the user for a file path

Image

Jarred-Sumner avatar May 25 '25 23:05 Jarred-Sumner