File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,3 +30,73 @@ cd simplicityhl-lsp
3030cargo install --path .
3131```
3232
33+ ## Integration with editors
34+
35+ ### Neovim
36+
37+ #### LSP
38+
39+ 0 . Install ` simplicityhl-lsp ` to your ` PATH ` .
40+
41+ 1 . Include this Lua snippet to your Neovim config:
42+
43+ ``` lua
44+ vim .filetype .add ({
45+ extension = {
46+ simf = " simf" ,
47+ },
48+ })
49+
50+ vim .lsp .config [" simplicityhl-lsp" ] = { cmd = { " simplicityhl-lsp" }, filetypes = { " simf" }, settings = {} }
51+ vim .lsp .enable (" simplicityhl-lsp" )
52+ ```
53+
54+ 2 . Open ` .simf ` file and check that LSP is active ("attached"):
55+
56+ ``` vim
57+ :checkhealth vim.lsp
58+ ```
59+
60+ #### Tree-sitter (Highlighting)
61+
62+ Currently, the Language Server does not provide any syntax highlighting on its own, but you can install tree-sitter for SimplicityHL:
63+
64+ 0 . Set up the [ ` nvim-treesitter ` ] ( https://github.com/nvim-treesitter/nvim-treesitter/tree/main ) plugin.
65+
66+ 1 . Include this Lua snippet in your Neovim config to register parser:
67+
68+ ``` lua
69+ vim .api .nvim_create_autocmd (" User" , {
70+ pattern = " TSUpdate" ,
71+ callback = function ()
72+ require (" nvim-treesitter.parsers" ).simplicityhl = {
73+ install_info = {
74+ url = " https://github.com/distributed-lab/tree-sitter-simplicityhl" ,
75+ queries = " queries" ,
76+ },
77+ filetype = " simf" ,
78+ tier = 0 ,
79+ }
80+ end ,
81+ })
82+
83+ vim .treesitter .language .register (" simplicityhl" , { " simf" })
84+
85+ vim .api .nvim_create_autocmd (" FileType" , {
86+ pattern = { " simf" },
87+ callback = function ()
88+ vim .treesitter .start ()
89+ end ,
90+ })
91+ ```
92+
93+ 2 . Restart Neovim and run:
94+
95+ ``` vim
96+ :TSInstall simplicityhl
97+ ```
98+
99+ If everything is working correctly, you should see syntax highlighting in ` .simf ` files.
100+
101+ ** Note:** This method is compatible only with ` nvim-treesitter ` v0.10 or newer.
102+
You can’t perform that action at this time.
0 commit comments