42 个版本
0.2.12 | 2024年6月3日 |
---|---|
0.2.11 | 2023年12月27日 |
0.2.10 | 2023年11月20日 |
0.2.9 | 2023年5月8日 |
0.1.4 | 2019年11月26日 |
#125 在 开发工具 中排名
每月 300 次下载
150KB
408 行
svls
SystemVerilog 语言服务器
功能
- 基于 svlint 的代码检查器。
安装
下载二进制文件
从 发布页面 下载,并将其解压缩到 PATH 目录中。
snapcraft
您可以从 snapcraft 安装。
sudo snap install svls
Cargo
您可以通过 cargo 安装。
cargo install svls
配置
语言服务器
svls 使用位于仓库根目录的 .svls.toml
。以下为 .svls.toml
的示例
[verilog]
include_paths = ["src/header"]
defines = ["DEBUG", "VAR=1"]
plugins = ["path/to/libfoo.so", "path/to/libbar.so"]
[option]
linter = true
[verilog]
部分
include_paths
是从仓库根目录的包含路径。 defines
是定义字符串。 plugins
是从工作目录到 svlint 插件的路径。
[option]
部分
linter
显示是否启用了代码检查功能。
代码检查器
代码检查器使用位于仓库根目录的 .svlint.toml
。如果无法使用 .svlint.toml
,则启用所有代码检查规则。有关详细信息,请参阅 svlint#configuration。
用法
Visual Studio Code
请从市场安装 svls-vscode 扩展。
Vim/Neovim 与 LanguageClient-neovim
let g:LanguageClient_serverCommands = {
\ 'systemverilog': ['svls'],
\ }
Vim/Neovim 与 vim-lsp
if executable('svls')
au User lsp_setup call lsp#register_server({
\ 'name': 'svls',
\ 'cmd': {server_info->['svls']},
\ 'whitelist': ['systemverilog'],
\ })
endif
Vim/Neovim 与 coc.nvim
在配置文件中
"languageserver": {
"svls": {
"command": "svls",
"filetypes": ["systemverilog"]
}
}
Emacs 与 lsp-mode
(use-package flycheck
:ensure t
:defer t
:init (global-flycheck-mode t))
(use-package company
:ensure t
:defer t
:init (global-company-mode t)
:config
;; Company Flx adds fuzzy matching to company, powered by the sophisticated
;; sorting heuristics in =flx=
(use-package company-flx
:ensure t
:after company
:init (company-flx-mode t))
;; Company Quickhelp
;; When idling on a completion candidate the documentation for the
;; candidate will pop up after `company-quickhelp-delay' seconds.
(use-package company-quickhelp
:after company
:ensure t
;; :init (company-quickhelp-mode t)
:hook (prog-mode . (lambda ()
(when (window-system)
(company-quickhelp-local-mode))))
:config
(setq company-quickhelp-delay 0.2
company-quickhelp-max-lines nil)))
(use-package lsp-mode
:defer t
:ensure t
:commands lsp
:config
(setq lsp-log-io nil
lsp-auto-configure t
lsp-auto-guess-root t
lsp-enable-completion-at-point t
lsp-enable-xref t
lsp-prefer-flymake nil
lsp-use-native-json t
lsp-enable-indentation t
lsp-response-timeout 10
lsp-restart 'auto-restart
lsp-keep-workspace-alive t
lsp-eldoc-render-all nil
lsp-enable-snippet nil
lsp-enable-folding t)
;;; lsp-ui gives us the blue documentation boxes and the sidebar info
(use-package lsp-ui
:defer t
:ensure t
:after lsp
:commands lsp-ui-mode
:config
(setq lsp-ui-sideline-ignore-duplicate t
lsp-ui-sideline-delay 0.5
lsp-ui-sideline-show-symbol t
lsp-ui-sideline-show-hover t
lsp-ui-sideline-show-diagnostics t
lsp-ui-sideline-show-code-actions t
lsp-ui-peek-always-show t
lsp-ui-doc-use-childframe t)
:bind
(:map lsp-ui-mode-map
([remap xref-find-definitions] . lsp-ui-peek-find-definitions)
([remap xref-find-references] . lsp-ui-peek-find-references))
:hook
((lsp-mode . lsp-ui-mode)
(lsp-after-open . (lambda ()
(lsp-ui-flycheck-enable t)
(lsp-ui-sideline-enable t)
(lsp-ui-imenu-enable t)
(lsp-lens-mode t)
(lsp-ui-peek-enable t)
(lsp-ui-doc-enable t)))))
;;; company lsp
;; install LSP company backend for LSP-driven completion
(use-package company-lsp
:defer t
:ensure t
:after company
:commands company-lsp
:config
(setq company-lsp-cache-candidates t
company-lsp-enable-recompletion t
company-lsp-enable-snippet t
company-lsp-async t)
;; avoid, as this changes it globally do it in the major mode instead (push
;; 'company-lsp company-backends) better set it locally
:hook (lsp-after-open . (lambda()
(add-to-list (make-local-variable 'company-backends)
'company-lsp)))))
(use-package verilog-mode
:defer t
:config
(require 'lsp)
(lsp-register-client
(make-lsp-client :new-connection (lsp-stdio-connection '("svls"))
:major-modes '(verilog-mode)
:priority -1
))
:hook (verilog-mode . (lambda()
(lsp)
(flycheck-mode t)
(add-to-list 'lsp-language-id-configuration '(verilog-mode . "verilog")))))
Emacs 与 verilog-ext
(require 'verilog-ext)
(verilog-ext-mode-setup)
(verilog-ext-eglot-set-server 've-svls) ;`eglot' config
(verilog-ext-lsp-set-server 've-svls) ; `lsp' config
Helix
在 languages.toml
中
[language-server.svls]
command = "svls"
[[language]]
name = "verilog"
language-servers = ["svls"]
依赖项
~14–26MB
~408K SLoC