mirror of
https://github.com/Ascyii/typstar.git
synced 2026-01-01 05:24:24 -05:00
feat(snip): warning if jsregexp is not installed
This commit is contained in:
@@ -79,7 +79,7 @@ require('typstar').setup({
|
|||||||
|
|
||||||
### Snippets
|
### Snippets
|
||||||
1. Install [LuaSnip](https://github.com/L3MON4D3/LuaSnip/), set `enable_autosnippets = true` and set a visual mode selection key (e.g. `store_selection_keys = '<Tab>'`) in the configuration
|
1. Install [LuaSnip](https://github.com/L3MON4D3/LuaSnip/), set `enable_autosnippets = true` and set a visual mode selection key (e.g. `store_selection_keys = '<Tab>'`) in the configuration
|
||||||
2. Install [jsregexp](https://github.com/kmarius/jsregexp) as described [here](https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md#transformations) (running `:lua require('jsregexp')` in nvim should not result in an error)
|
2. Install [jsregexp](https://github.com/kmarius/jsregexp) as described [here](https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md#transformations) (You will see a warning on startup if jsregexp isn't installed properly)
|
||||||
3. Install [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter) and run `:TSInstall typst`
|
3. Install [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter) and run `:TSInstall typst`
|
||||||
4. Optional: Setup [ctheorems](https://typst.app/universe/package/ctheorems/) with names like [here](./lua/typstar/snippets/markup.lua)
|
4. Optional: Setup [ctheorems](https://typst.app/universe/package/ctheorems/) with names like [here](./lua/typstar/snippets/markup.lua)
|
||||||
|
|
||||||
|
|||||||
@@ -105,6 +105,13 @@ function M.setup()
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
luasnip.add_snippets('typst', autosnippets)
|
luasnip.add_snippets('typst', autosnippets)
|
||||||
|
local jsregexp_ok, _ = pcall(require, "luasnip-jsregexp")
|
||||||
|
if not jsregexp_ok then
|
||||||
|
jsregexp_ok, _ = pcall(require, "jsregexp")
|
||||||
|
end
|
||||||
|
if not jsregexp_ok then
|
||||||
|
vim.notify("WARNING: Most snippets won't work as jsregexp is not installed", vim.log.levels.WARN)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user