#Getting Snippet Context
13 messages · Page 1 of 1 (latest)
Would appreciate any help, this is really the only thing blocking me from fully jumping ship
There is a tinymist.interactCodeContext if you use tinymist. uri is the file uri of current buffer, query is a batch array of queries to be executed on a same state of the server. The modeAt query gets a position in the file and responses a mode, one of math, markup, comment, string, raw, code.
You can also query the treesitter if you use it I think.
I just found this too. Looks like a good place to start. Thank you!
We need some documentation about it, because I think it won't be changed in future. There is some remaining problem about some nested context like:
///
/// $ A math equation in the doc comments. $
///
When you process above code, you may also love to get that you are in a math equation (mode) in a doc comments. This needs further design.
Hmm I can't tell if they actually have a query for interactCodeContext
https://github.com/Myriad-Dreamin/tinymist/blob/f503298f483f128a48ce1b9436c0d6bafe00f8de/crates/tinymist/src/lsp/query.rs
only looks like they setup the vscode bind but dont have a LSP query yet
what do you mean? It is a regular LSP command instead of a LSP (standard) query.
Ah okay thank you
Trying to figure out how to call it
I think it is less meaningful to tell whether it is called a "LSP query" because standard doesn't define query. This is also not related to your question. We should be able to call it as a LSP command, via client:exec_cmd (nvim >= v0.11) or vim.lsp.buf.execute_command (nvim < v0.11).
Sounds good, thank you so much for your help.
Hi! If you still are curious about this. This is how I get the math context to have custom automatic snippets. I use tree sitter and it works well for me.