Open LecrisUT opened 4 years ago
I am not sure how to run vls-testclient to confirm the installation was successful or not.
Right now you don't have to worry much about this. We will be using it later as we develop tests for VLS. If you're curious you can run ./vls-testclient --help
to find usage.
The cross-reference barely works, and it doesn't seem to reference different files in the workspace.
Sorry, could you explain this more? Are you saying that clicking "goto references" doesn't list all references in the project? Or something else?
Sorry, could you explain this more? Are you saying that clicking "goto references" doesn't list all references in the project? Or something else?
Here's an example from pdfpc
which I want to get it to work with:
pdfpc.vala
namespace pdfpc {
public class Application: GLib.Object {
private PresentationController controller;
...
The class PresentationController
is not recognized:
{
"resource": "/***/pdfpc/src/pdfpc.vala",
"owner": "_generated_diagnostic_collection_name_#2",
"severity": 8,
"message": "The type name `PresentationController' could not be found",
}
Even though there is a file: presentation_controller.vala with
namespace pdfpc {
public class PresentationController : Object {
...
Go to reference, peek, nothing works, since intellisense cannot pick it up. This is not limited to local definitions. For example Gtk
is not recognized either, even though it is installed with homebrew
.
With C files I am able to add the paths to c_cpp_properties.json
, and it can take me to the lib files. Is there an equivalent for vala
?
@LecrisUT Ah! Is this your project: https://github.com/pdfpc/pdfpc ?
It looks like this project is CMake-based, which is a backend we intend to support in the future but don't currently. At first, we've chosen to support Meson, since the vast majority (perhaps >90%) of Vala projects use Meson, and the rest almost all use automake/autoconf. This in fact is the first Vala project I've seen that uses CMake, and this will be a useful test-case for when we're implementing CMake support.
If VLS can't detect a meson project, it will simply treat every folder as a separate compilation unit, so this is probably why you're not seeing references to files across different directories.
Ok. I've confirmed that it does work like that for local files. So I guess the gtk
libraries are not found because they couldn't be resolved from cmake
?
I have tested benwaffle/vala-starter. It does indeed take me to the appropriate links when using meson.
@LecrisUT yes, without knowledge of compile arguments, the libraries you need will not be included.
It looks like this is how we can introspect a CMake project in a similar fashion to what we do for Meson: https://cmake.org/cmake/help/latest/manual/cmake-file-api.7.html
@LecrisUT yes, without knowledge of compile arguments, the libraries you need will not be included.
Wouldn't it be possible to just use compile_commands.json ? That should work for both meson and CMake (and possibly for future build systems too).
@Cogitri no, because compile_commands.json only includes compile commands, not things like g-ir-scanner
or build tasks that convert .in
files, or other things, which produce all sorts of files that may be fed into Vala targets.
Basically, there's a lot of useful information left out in compile_commands.json
files that you need to get more than just a basic project with a few files to work.
It seems that Vala projects using CMake rely on unofficial macros from here: https://github.com/jakobwesthoff/Vala_CMake/
CMake's file API allows a program to get the list of targets and their sources in a JSON file. The unofficial Vala CMake macros above use add_custom_command()
to create a valac
task but it turns out you need to use add_custom_target()
since that will register it as a target so it will be visible in the introspection JSON. Otherwise it's impossible to introspect.
I've made some initial changes to these macros here. This seems to work with a single Vala target, but I want to see how this works with multiple Vala targets: in particular, whether we can get the JSON output in such a way that the dependency graph can be reconstructed.
Also, it would help to know of more Vala projects that use CMake. pdfpc seems like the only one I could find.
If pdfpc is the only major Vala codebase that uses CMake, perhaps it would be better to encourage they switch to Meson.
Hmm... it looks like Dino, another very popular (1.5k stars) project, uses CMake too.
Though not anymore, the elementary OS project's Vala applications were built with CMake. Many projects on GitHub use CMake (code search for the "FindVala" CMake module).
@chances most of those projects are dead, save a handful.
That doesn't mean none of them will be revived in the future.
@chances well I still have to prioritize support for the things that people are currently using. If and when what you said happens, then CMake will become a higher priority.
I am trying to get a
homebrew
+VS Code
setup to work. So far I have managed to install the server. I am not sure how to runvls-testclient
to confirm the installation was successful or not.Running
VS Code
I get the following errors (trimmed down for readability, hope I didn't miss something important):The cross-reference barely works, and it doesn't seem to reference different files in the workspace. Let me know if you need any more debug information or testing