[circt-verilog-lsp-server] Add Verilog Language Server #8234
+1,118
−30
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a first PR to add a Language Server Protocol (LSP) implementation for Verilog/SystemVerilog using the slang frontend.
The server is built as circt-verilog-lsp-server and eventually integrates with CIRCT's existing Verilog import capabilities. It leverages MLIR's LSP server support libraries for the protocol implementation.
VerilogServer.cpp - Core language service implementation that manages documents
and interfaces with slang for parsing and analysis. Maintains document state
and handles document synchronization events.
LSPServer.cpp - Protocol layer that implements LSP message handling and converts
between LSP types and internal representations. Built on MLIR's LSP server
support libraries.
lib/Tools/circt-verilog-lsp-server/{Utils, VerilogSeverImpl}
are added as workaround for RTTI build issue. The current version of slang requires RTTI but LLVM may not be built with RTTI. So if LLVM functions use RTTI in VerilogServer.cpp it causes compilation error because there is no RTTI. As a workaround, I specialized utility functions in LSPUtils.cpp, and use it from VerilogServer.cpp.Not implemented in this initial PR but the goal is to provide modern LSP features such as hover/go to def/references integrated with CIRCT (e.g. hover source location).