chipsenkbeil / vimwiki-rs

Rust library and tooling to parse, render, and modify vimwiki text and files.
56 stars 2 forks source link

Support querying edited buffers not saved to a file #75

Closed chipsenkbeil closed 3 years ago

chipsenkbeil commented 3 years ago

When in vim and editing a buffer, we may want to perform actions like selecting and deleting elements, inspecting a link, etc. without needing to first save the file.

Couple of ways to do this:

  1. Whenever an action is triggered that needs to inspect something within an edited buffer, we save the file immediately before querying the server
  2. As seen with vim-ale, we create a temporary file representing the current buffer contents and query it instead of the file itself while the buffer has not been saved to disk
  3. We provide some field like buffer(text:"...") {...} that will parse the text, generate a forest, and provide a page back that we can access
  4. We monitor what has been changed to only send the lines for the root element(s) that have been modified; would need to duplicate our file forest so we can modify it with the changed pieces
chipsenkbeil commented 3 years ago

This has been handled on the plugin side via https://github.com/chipsenkbeil/vimwiki-server.nvim/issues/15 and https://github.com/chipsenkbeil/vimwiki-server.nvim/commit/28195658c1a01d84fe954c1635df5e7e9bc6df3a.

The ask on this side at this point is to be able to map a file to a wiki even if it does not belong there. No copying of the file will take place, but operations like resolving outgoing links (#15) for the file would assume the specified wiki.