Skip to content

[FEATURE] Per-file VHDL standard override via inline comment directive/token #487

Description

@nselvara

Feature description

It would be useful to support a per-file VHDL standard override via an inline comment directive, similar to the existing -- vhdl_ls on / -- vhdl_ls off mechanism.

A common use case is writing wrapper files targeting VHDL-93 (e.g. for Xilinx IP that does not accept later standards) within a project that otherwise defaults to VHDL-2008 via vhdl_ls.toml. Rather than splitting the project into separate library entries with different standard settings, a lightweight directive at the top of the file would allow targeted overrides without any structural changes to the project configuration.

A possible syntax, consistent with the existing directive style:

-- vhdl_ls file_std="1993"

Motivation

Mixed-standard projects are common in FPGA development. Tool-generated wrapper files (e.g. from Xilinx Vivado) are often restricted to VHDL-93, while user-written RTL benefits from VHDL-2008 features. Managing this today requires either separate library declarations in vhdl_ls.toml or tolerating spurious diagnostics on legacy files.

Proposed behaviour

  • The directive is recognised only in the first few lines of a file (similar to existing directives).
  • It overrides the standard specified in vhdl_ls.toml for that file only.
  • Both comment styles should be accepted for consistency: -- and --!.
  • Valid values would mirror those already accepted by the standard key in vhdl_ls.toml.

Minimal reproducible example

-- vhdl_ls file_std="1993"

library ieee;
use ieee.std_logic_1164.all;

entity mre is
end entity mre;

architecture rtl of mre is
begin
    test: process
    begin
        wait;
    end process;
end architecture;

With the project standard set to "2008" in vhdl_ls.toml, the above file would be analysed as VHDL-93 without requiring a separate library entry.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions