Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] Allow glob patterns when defining source files list in hdl-prj.json #80

Open
pidgeon777 opened this issue Jun 22, 2021 · 4 comments

Comments

@pidgeon777
Copy link

Most of the common VHDL LSP providers (VHDL-Tool, hdl_checker, rust_hdl) allow to use glob patterns in the source files list, in their project configuration files:

/*
     * Sources can be defined solely by their individual paths or glob patterns.
     * Absolute paths are unchanged, relative paths are made absolute by using
     * the path to the configuration file. Sources imported from an included file
     * will follow the same principle but using the path to the included path.
     */
    "some/vhdl/file.vhd",
    "some/verilog/file.v",
    "some/systemverilog/file.sv",
    "vhdl/files/only/*.vhd",
    "all/files/recursively/**/*",

It is possible to define a source file:

  • With relative or absolute path.
  • With glob patterns.
  • Recursively.

Actually, with GHDL-LSP it is not possible to do this. It would be great to add at least the recursive function so that it won't be needed to manually define all of the source files included in a project.

@eine
Copy link
Contributor

eine commented Jun 22, 2021

@pidgeon777, see #12:

The main point here is: do we want to design and maintain some new independent JSON schema to manage projects of (V)HDL sources? I think we agree that the format should be generic enough so that multiple tools can use it. Should some other tool already provide a JSON format that suits our needs, we'd probably discuss using or extending that instead. Some possibilities are:

See also VHDL-LS/rust_hdl#112.

@pidgeon777
Copy link
Author

So, if I understood currently, at the moment there is no plan to support glob patterns?

I asked about that because I saw many other tools implementing it.

@eine
Copy link
Contributor

eine commented Jun 22, 2021

At the moment there is no one explicitly working on "a JSON project file supported by GHDL". hdl-prj.json is just the most obvious conversion of GHDL's command-line options into a JSON struct. I would personally like such project file to be usable to for the LSP, and also for simulation and synthesis.

I believe there is a plan to support glob patterns, because that is a very basic feature that any format should support. However, since the format of hdl-prj.json is not defined, maybe that needs to be done first, before adding features to it. Note that when calling GHDL through the terminal, it's bash the one who expands the wildcards, that's why GHDL itself (or ghdl-ls) don't do that.

For the LSP only, I guess you might implement it using glob in https://github.com/ghdl/ghdl/blob/05755b53e1d723ff4d2c9de79c61badd42491b13/pyGHDL/lsp/workspace.py#L224-L225. However, note that globs might be recursive or not:

@tgingold
Copy link
Member

tgingold commented Jun 22, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants