#Getting Snippet Context

13 messages · Page 1 of 1 (latest)

distant relic
#

Is anyone aware of how to get context (in LaTeX terms "math mode") from Tinymist or from typst-preview in neovim?

Something like this is how I used to do it with vimtex in ultisips,

def math():
    return vim.eval('vimtex#syntax#in_mathzone()') == '1'
distant relic
#

Would appreciate any help, this is really the only thing blocking me from fully jumping ship

flat flame
distant relic
flat flame
#

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.

distant relic
#

only looks like they setup the vscode bind but dont have a LSP query yet

flat flame
#

what do you mean? It is a regular LSP command instead of a LSP (standard) query.

distant relic
#

Trying to figure out how to call it

flat flame
#

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).

distant relic
buoyant heart
#

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.