Skip to main content

A Language Server for Bluespec SystemVerilog

Project description

Bluespec Language Server.

  • Uses bsc for linting.
  • Uses tree-sitter for Completion on .,{ and ( character
  • Includes bsv_format, an opinionated code formatter (like Black for Python)

See it in action

Installation

pip install bsv-language-server

The language server searches upwards from the current folder for for a .bscflags file for setting to use for compilation The tree-sitter parser is not complete, it currently parses most typedef enum/struct, interfaces module instantation and assignment statements and fails on everything else. This subset should be enough for type completion.

How to use

In your project hierarchy create a file .bscflags with compile time options e.g. .bscflags

-p /prj/bsvlib/bdir:bo:+
-bdir bo
-info-dir bo

Formatter

bsv_format is an opinionated formatter installed alongside the language server. It rewrites BSV source files in-place with consistent style — no configuration needed.

Rules

  • 3-space indentation, derived from block structure (module/endmodule, rule/endrule, interface/endinterface, begin/end, etc.)
  • Spaces around operators: x<-foox <- foo, x<=yx <= y
  • Space after control keywords: if(if (, for(for (
  • Struct literal spacing: Foo_st{Foo_st {
  • Continuation indent: multi-line parameter lists and provisos(...) clauses get one extra indent level; closing ) aligns with the opener line
  • Preprocessor blocks: `ifdef/`ifndef/`else/`elsif/`endif are indented as code blocks
  • Blank lines: at most one consecutive blank line preserved
  • Trailing whitespace removed; file always ends with a single newline
  • end*:label suffixes (endmodule:foo, endpackage:bar) handled correctly

Usage

Format one or more files in-place:

bsv_format MyModule.bsv
bsv_format src/*.bsv

Check whether files need formatting without modifying them (exits non-zero if any file would change):

bsv_format --check MyModule.bsv

The formatter is also invoked automatically by the language server when the editor requests document formatting (e.g. "Format Document" in VS Code, gq via vim-lsp).

VIM

In your .vimrc Add the following plugins e.g. using Vundle

Plugin 'prabirshrestha/vim-lsp'
Plugin 'prabirshrestha/asyncomplete.vim'
Plugin 'prabirshrestha/asyncomplete-lsp.vim'
".... other vundle stuff
 if executable('bsv_language_server')
     au User lsp_setup call lsp#register_server({
         \ 'name': 'bsv_language_server',
         \ 'cmd': {server_info->['bsv_language_server']},
         \ 'allowlist': ['bsv'],
         \ 'workspace_config': {
         \   'bluespec': {
         \     'compilerFlags': ['-p', '+:/prj/bsvlib/bdir:bo', '-check']
         \   }
         \ }
     \ })
 endif

Send PR's for other editors.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bsv_language_server-0.1.1.tar.gz (4.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bsv_language_server-0.1.1-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file bsv_language_server-0.1.1.tar.gz.

File metadata

  • Download URL: bsv_language_server-0.1.1.tar.gz
  • Upload date:
  • Size: 4.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bsv_language_server-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5982e7ac16a2bd80f7753b42cd2a955cf4878d1d2ba4917a076ebf63fc227944
MD5 483eb1dd2df302889554f7e9a0f28625
BLAKE2b-256 7c227465cc2d73dbfe0c3fb90904b2ed51261ad692f9491734b9bc4848140b40

See more details on using hashes here.

Provenance

The following attestation bundles were made for bsv_language_server-0.1.1.tar.gz:

Publisher: ci.yaml on jahagirdar/bsv-language-server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bsv_language_server-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for bsv_language_server-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cc1239e63259d65e9fa5c1ca343c8b018b15a8473a0fc7c10cc96ca396ee0b88
MD5 db67dbd4bd1db76ed5988a384ea3125b
BLAKE2b-256 ae97d1496be36f664abef1a213309ed790d3f3a90027b62792277801d52e686f

See more details on using hashes here.

Provenance

The following attestation bundles were made for bsv_language_server-0.1.1-py3-none-any.whl:

Publisher: ci.yaml on jahagirdar/bsv-language-server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page