Open ghost opened 4 years ago
Not as automatic, but perhaps more in line with LSP, the server could provide code actions that import an undefined variable. That is, if page_allocator
is typed somewhere, but there is nothing by that name in scope, then a code action would be provided that could add a the line
const page_allocator = @import("std").heap.page_allocator;
to the top of the file.
Upon reflection, this isn't really possible in a computationally effective way because it would require us to actively juggle every single declaration in std anytime anybody types something. Feel free to drop any implementation ideas here though, but I'm closing this as not planned for now.
i'm not really sure if this is even possible with the lsp, but it would be cool if one could have this feature like you have it for e.g. java example: you type
page_all<Tab>
in your main function, but you don't havestd.heap.page_allocator
imported then it suggests to add a import at the top which it does automatically when selection that completion