I love cool useless stuff :))
- Crab-Pilled
- Prolog Connoisseur
- Proud Neovim User
I'm interested in Blockchain Technology, Smart-Contracts, and Zero-Knowledge. If you like Cellular Autometa and zkSnarks be sure to read this awesome article
A Language Server Protocol Implementation for Circom
License: GNU General Public License v3.0
I love cool useless stuff :))
I'm interested in Blockchain Technology, Smart-Contracts, and Zero-Knowledge. If you like Cellular Autometa and zkSnarks be sure to read this awesome article
Hello, I am trying to enable this lsp as a custom server since it does not belong to the mason lsp server registry as of right now.
here is my current setup but no luck...
-- import lspconfig plugin safely
local lspconfig_status, lspconfig = pcall(require, "lspconfig")
if not lspconfig_status then
return
end
-- import cmp-nvim-lsp plugin safely
local cmp_nvim_lsp_status, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
if not cmp_nvim_lsp_status then
return
end
-- import typescript plugin safely
local typescript_setup, typescript = pcall(require, "typescript")
if not typescript_setup then
return
end
local keymap = vim.keymap -- for conciseness
-- enable keybinds only for when lsp server available
local on_attach = function(client, bufnr)
-- keybind options
local opts = { noremap = true, silent = true, buffer = bufnr }
-- set keybinds
keymap.set("n", "gf", "<cmd>Lspsaga lsp_finder<CR>", opts) -- show definition, references
keymap.set("n", "gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", opts) -- got to declaration
keymap.set("n", "gd", "<cmd>Lspsaga peek_definition<CR>", opts) -- see definition and make edits in window
keymap.set("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts) -- go to implementation
keymap.set("n", "<leader>ca", "<cmd>Lspsaga code_action<CR>", opts) -- see available code actions
keymap.set("n", "<leader>rn", "<cmd>Lspsaga rename<CR>", opts) -- smart rename
keymap.set("n", "<leader>D", "<cmd>Lspsaga show_line_diagnostics<CR>", opts) -- show diagnostics for line
keymap.set("n", "<leader>d", "<cmd>Lspsaga show_cursor_diagnostics<CR>", opts) -- show diagnostics for cursor
keymap.set("n", "[d", "<cmd>Lspsaga diagnostic_jump_prev<CR>", opts) -- jump to previous diagnostic in buffer
keymap.set("n", "]d", "<cmd>Lspsaga diagnostic_jump_next<CR>", opts) -- jump to next diagnostic in buffer
keymap.set("n", "K", "<cmd>Lspsaga hover_doc<CR>", opts) -- show documentation for what is under cursor
keymap.set("n", "<leader>o", "<cmd>LSoutlineToggle<CR>", opts) -- see outline on right hand side
-- typescript specific keymaps (e.g. rename file and update imports)
if client.name == "tsserver" then
keymap.set("n", "<leader>rf", ":TypescriptRenameFile<CR>") -- rename file and update imports
keymap.set("n", "<leader>oi", ":TypescriptOrganizeImports<CR>") -- organize imports (not in youtube nvim video)
keymap.set("n", "<leader>ru", ":TypescriptRemoveUnused<CR>") -- remove unused variables (not in youtube nvim video)
end
end
-- used to enable autocompletion (assign to every lsp server config)
local capabilities = cmp_nvim_lsp.default_capabilities()
-- Change the Diagnostic symbols in the sign column (gutter)
-- (not in youtube nvim video)
local signs = { Error = " ", Warn = " ", Hint = "ﴞ ", Info = " " }
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
end
-- configure lua server (with special settings)
lspconfig["lua_ls"].setup({
capabilities = capabilities,
on_attach = on_attach,
settings = {
-- custom settings for lua
Lua = {
-- make the language server recognize "vim" global
diagnostics = {
globals = { "vim" },
},
workspace = {
-- make language server aware of runtime files
library = {
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
[vim.fn.stdpath("config") .. "/lua"] = true,
},
},
},
},
})
-- @dev this requires nomicfoundation-solidity-language-server to be globally npm installed!
lspconfig["solidity"].setup({
cmd = { "nomicfoundation-solidity-language-server", "--stdio" },
filetypes = { "solidity" },
root_dir = lspconfig.util.find_git_ancestor,
single_file_support = true,
})
-- configure circom lsp, make sure cargo package is installed
-- https://github.com/rubydusa/circom-lsp
local configs = require("lspconfig.configs")
if not configs.circom then
configs.circom = {
default_config = {
cmd = { "circom-lsp" },
filetypes = { "circom" },
name = "circom",
root_dir = function()
return lspconfig.util.find_git_ancestor
or lspconfig.util.root_pattern("package.json")
or vim.api.nvim_buf_get_name(0)
end,
},
}
end
lspconfig["circom"].setup({
capabilities = capabilities,
on_attach = on_attach,
})
Any idea why it is not working ? I get no errors.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.