Skip to content

Commit

Permalink
feat(solidity_ls)!: switch to first-party npm package
Browse files Browse the repository at this point in the history
The unofficial npm package was only uploaded once, two years ago:

https://www.npmjs.com/package/solidity-language-server

There is now a first-party package:

juanfranblanco/vscode-solidity#432 (comment)
https://www.npmjs.com/package/vscode-solidity-server
  • Loading branch information
llllvvuu committed Feb 14, 2024
1 parent ede4114 commit e8a7ef4
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions lua/lspconfig/server_configurations/solidity_ls.lua
Original file line number Diff line number Diff line change
@@ -1,24 +1,36 @@
local util = require 'lspconfig.util'

local bin_name = 'solidity-language-server'
if vim.fn.has 'win32' == 1 then
bin_name = bin_name .. '.cmd'
end
local root_files = {
'hardhat.config.js',
'hardhat.config.ts',
'foundry.toml',
'remappings.txt',
'truffle.js',
'truffle-config.js',
'ape-config.yaml',
}

return {
default_config = {
cmd = { bin_name, '--stdio' },
cmd = { 'vscode-solidity-server', '--stdio' },
filetypes = { 'solidity' },
root_dir = util.root_pattern('.git', 'package.json'),
root_dir = util.root_pattern(unpack(root_files)) or util.root_pattern('.git', 'package.json'),
single_file_support = true,
},
docs = {
description = [[
npm install -g solidity-language-server
https://github.com/juanfranblanco/vscode-solidity
`vscode-solidity-server` can be installed via `npm`:
```sh
npm install -g vscode-solidity-server
```
solidity-language-server is a language server for the solidity language ported from the vscode solidity extension
`vscode-solidity-server` is a language server for the Solidity language ported from the VSCode "solidity" extension.
]],
default_config = {
root_dir = [[root_pattern(".git", "package.json")]],
root_dir = [[root_pattern("]] .. table.concat(root_files, '", "') .. [[", ".git", "package.json")]],
},
},
}

0 comments on commit e8a7ef4

Please sign in to comment.