Skip to content

distributed-lab/simplicityhl-lsp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SimplicityHL LSP

Language Server for SimplicityHL language.

Features

  • Basic diagnostic for SimplicityHL code

diagnostics

  • Completions of built-ins, jets and functions

completion

  • Hover for built-ins, jets and functions, with support of documentation

hover

  • Go to definition for functions

goto-definition

Installation

Clone this repository and install using Cargo:

https://github.com/distributed-lab/simplicityhl-lsp
cd simplicityhl-lsp
cargo install --path .

Integration with editors

Neovim

LSP

  1. Install simplicityhl-lsp to your PATH.

  2. Include this Lua snippet to your Neovim config:

vim.filetype.add({
	extension = {
		simf = "simf",
	},
})

vim.lsp.config["simplicityhl-lsp"] = { cmd = { "simplicityhl-lsp" }, filetypes = { "simf" }, settings = {} }
vim.lsp.enable("simplicityhl-lsp")
  1. Open .simf file and check that LSP is active ("attached"):
:checkhealth vim.lsp

Tree-sitter (Highlighting)

Currently, the Language Server does not provide any syntax highlighting on its own, but you can install tree-sitter for SimplicityHL:

  1. Set up the nvim-treesitter plugin.

  2. Include this Lua snippet in your Neovim config to register parser:

vim.api.nvim_create_autocmd("User", {
	pattern = "TSUpdate",
	callback = function()
		require("nvim-treesitter.parsers").simplicityhl = {
			install_info = {
				url = "https://github.com/distributed-lab/tree-sitter-simplicityhl",
				queries = "queries",
			},
			filetype = "simf",
			tier = 0,
		}
	end,
})

vim.treesitter.language.register("simplicityhl", { "simf" })

vim.api.nvim_create_autocmd("FileType", {
	pattern = { "simf" },
	callback = function()
		vim.treesitter.start()
	end,
})
  1. Restart Neovim and run:
:TSInstall simplicityhl

If everything is working correctly, you should see syntax highlighting in .simf files.

Note: This method is compatible only with nvim-treesitter v0.10 or newer.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages