Skip to content

builder: vls-mode can compile all src dir files#25703

Closed
kbkpbot wants to merge 1 commit intovlang:masterfrom
kbkpbot:fix-builder-compile-vls-other-files
Closed

builder: vls-mode can compile all src dir files#25703
kbkpbot wants to merge 1 commit intovlang:masterfrom
kbkpbot:fix-builder-compile-vls-other-files

Conversation

@kbkpbot
Copy link
Contributor

@kbkpbot kbkpbot commented Nov 9, 2025

Fix vlang/vls#473

work with PR vlang/vls#475

@spytheman
Copy link
Contributor

Why add a special support for this, and pass a different -path, when you can v /full/path instead, which will also get all the .v files in the folder as part of the same program?

@JalonSolov
Copy link
Collaborator

I'm not sure I like the idea of having vls automatically read all the files in a dir anyway. Perhaps it could be an option?

I've had dirs with multiple completely unrelated V "script" files, which would show a lot of errors if they were all parsed together (for instance, all of them having fn main(), etc.)

@spytheman
Copy link
Contributor

The VLS mode should work as similar as possible with V itself, i.e. if V supports v folder/, then the vls mode should be able to v -some -vls -specific -options folder/ too as a way of specifying what the full project/context is.

@kbkpbot
Copy link
Contributor Author

kbkpbot commented Nov 10, 2025

Currently, vls only supports the analysis of individual files and does not incorporate concepts such as a "workspace" or "project." I think it may be necessary to first modify the code on the vls side so that when a directory is opened, it automatically creates a workspace or project. Then, when using vls, the entire path can be passed to the v compiler. This way, v can compile all the .v files in the entire directory, including any other user-defined modules located within it.

@kbkpbot
Copy link
Contributor Author

kbkpbot commented Nov 10, 2025

It would be beneficial if the v compiler could support compiling a set of files—for example, by adding an option to process an entire directory or a specific list of files.

@JalonSolov
Copy link
Collaborator

V can already compile a directory of files, by either v directory/ or v . if the directory is the current one.

Having it compile a specific list of files... possible, of course, but it sounds like it would be complicated to get right, and to document clearly.

@kbkpbot
Copy link
Contributor Author

kbkpbot commented Nov 10, 2025

I'd like to add a new option to the v compiler, for example called -file_list, which accepts a comma-separated string parameter. Each element can be either a .v file or a directory. If a directory is specified, all files within that directory will be included in the compilation.

@spytheman
Copy link
Contributor

@kbkpbot I do not understand, why not just use v folder/, which already works?

Why do you insist on implementing more options, that will do that exact thing?

@spytheman
Copy link
Contributor

Currently, vls only supports the analysis of individual files and does not incorporate concepts such as a "workspace" or "project." I think it may be necessary to first modify the code on the vls side so that when a directory is opened, it automatically creates a workspace or project. Then, when using vls, the entire path can be passed to the v compiler. This way, v can compile all the .v files in the entire directory, including any other user-defined modules located within it.

That is exactly what v folder/ does. VLS can take advantage of that, and just pass its query option to tell V in what info (file/location) it is interested in.

@kbkpbot
Copy link
Contributor Author

kbkpbot commented Nov 11, 2025

This is a temp workaround for vls, need a better solution...

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

Successfully merging this pull request may close these issues.

Functions in the same module are not automatically imported

3 participants