vala-lang/vala-vscode

Question: How to enable the autocompletion support of the pkgs besides Glib

wszqkzqk opened this issue · 7 comments

The addon now cannot treat using Gee correctly and treats it as an error The namespace name Gee' could not be found`, is there any way to enable the autocompletion support?

The language server needs to understand the compiler flags for your source file(s). Gee could be a namespace belonging to anything. Therefore, you need to tell VLS to use --pkg gee-0.8, either by specifying this in your meson.build file in the project root dir or by putting #!/bin/env -S vala --pkg gee-0.8 at the top of your file1.

For more information, please see the "important note": https://github.com/vala-lang/vala-language-server#editors

Footnotes

  1. Generally you'd only do this if your source file is a Vala script.

The language server needs to understand the compiler flags for your source file(s). Gee could be a namespace belonging to anything. Therefore, you need to tell VLS to use --pkg gee-0.8, either by specifying this in your meson.build file in the project root dir or by putting #!/bin/env vala -S --pkg gee-0.8 at the top of your file1.

For more information, please see the "important note": https://github.com/vala-lang/vala-language-server#editors

Footnotes

  1. Generally you'd only do this if your source file is a Vala script. leftwards_arrow_with_hook

Thank you for your explanation! It works now.
I didn't know vala can also support JIT before. This is really a useful feature.
Something else, the arg. -S may need to be passed at first for env to recognize.

@wszqkzqk right, the -S comes after env and before vala.

This is not JIT'ed code by the way, since it's not compiled piecewise or with no optimizations. It's not interpreted at all---Vala just compiles the whole file into a temporary executable and runs that.

It seems that lsp still cannot work with meson on windows.

@wszqkzqk what does VLS say? Are you mixing MSYS2 VLS with Win32 Meson?

@Prince781
I'm using meson and vls from msys2 usrt64, and the output was:

(vala-language-server:57008): vls-WARNING **: 09:16:23.030: mesonproject.vala:68: for target 25a6634@@gtkpacker-resources_c@cus, source #0, could not substitute special arg `DEPFILE'

(vala-language-server:57008): vls-WARNING **: 09:16:23.032: mesonproject.vala:339: target #5 (6199aec@@gtkpacker-pot@run) has no target sources

(vala-language-server:57008): vls-WARNING **: 09:16:23.032: mesonproject.vala:339: target #6 (6199aec@@gtkpacker-gmo@run) has no target sources

(vala-language-server:57008): vls-WARNING **: 09:16:23.032: mesonproject.vala:339: target #7 (6199aec@@gtkpacker-update-po@run) has no target sources

(vala-language-server:57008): vls-WARNING **: 09:16:23.045: compilation.vala:297: Compilation(25a6634@@gtkpacker@exe): file D:\17265\Documents\projects\GtkPacker\src\main.vala does not exist either on the system or in memory

(vala-language-server:57008): vls-WARNING **: 09:16:23.045: server.vala:326: Failed to build project - file D:\17265\Documents\projects\GtkPacker\src\main.vala does not exist either on the system or in memory

(vala-language-server:57008): vala-CRITICAL **: 09:16:23.473: vala_symbol_get_name: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:23.474: vala_symbol_get_name: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:23.475: vala_symbol_get_name: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:23.475: vala_symbol_get_name: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:23.481: vala_symbol_get_name: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:23.484: vala_symbol_get_name: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:23.487: vala_symbol_get_name: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:23.489: vala_symbol_get_name: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:23.491: vala_symbol_get_name: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:23.501: vala_object_type_construct: assertion 'type_symbol != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:23.501: vala_interface_add_prerequisite: assertion 'type != NULL' failed

(vala-language-server:57008): vls-WARNING **: 09:16:23.531: server.vala:155: unhandled notification `initialized'

(vala-language-server:57008): vala-CRITICAL **: 09:16:24.008: vala_data_type_get_parameters: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:24.008: vala_data_type_get_parameters: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:24.008: vala_data_type_get_parameters: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:24.008: vala_data_type_get_parameters: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:24.008: vala_data_type_get_parameters: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:24.008: vala_data_type_get_parameters: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:24.008: vala_data_type_get_parameters: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:24.008: vala_data_type_get_parameters: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:24.011: vala_data_type_get_parameters: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:24.011: vala_data_type_get_parameters: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:24.011: vala_data_type_get_parameters: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:24.011: vala_data_type_get_parameters: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:24.011: vala_data_type_get_parameters: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:24.011: vala_data_type_get_parameters: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:24.011: vala_data_type_get_parameters: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:24.011: vala_data_type_get_parameters: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:24.013: vala_data_type_get_parameters: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:24.013: vala_data_type_get_parameters: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:24.013: vala_data_type_get_parameters: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:24.013: vala_data_type_get_parameters: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:24.013: vala_data_type_get_parameters: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:24.013: vala_data_type_get_parameters: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:24.013: vala_data_type_get_parameters: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:24.013: vala_data_type_get_parameters: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:24.015: vala_data_type_get_parameters: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:24.015: vala_data_type_get_parameters: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:24.015: vala_data_type_get_parameters: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:24.015: vala_data_type_get_parameters: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:24.015: vala_data_type_get_parameters: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:24.015: vala_data_type_get_parameters: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:24.015: vala_data_type_get_parameters: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:24.015: vala_data_type_get_parameters: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:24.016: vala_data_type_get_parameters: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:24.016: vala_data_type_get_parameters: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:24.016: vala_data_type_get_parameters: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:24.016: vala_data_type_get_parameters: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:24.016: vala_data_type_get_parameters: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:24.016: vala_data_type_get_parameters: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:24.017: vala_data_type_get_parameters: assertion 'self != NULL' failed

(vala-language-server:57008): vala-CRITICAL **: 09:16:24.017: vala_data_type_get_parameters: assertion 'self != NULL' failed

(vala-language-server:57008): vls-WARNING **: 09:16:24.543: compilation.vala:297: Compilation(25a6634@@gtkpacker@exe): file D:\17265\Documents\projects\GtkPacker\src\main.vala does not exist either on the system or in memory

(vala-language-server:57008): vls-WARNING **: 09:16:24.543: server.vala:749: Failed to rebuild and/or reconfigure project: file D:\17265\Documents\projects\GtkPacker\src\main.vala does not exist either on the system or in memory

(vala-language-server:57008): vls-WARNING **: 09:16:24.543: server.vala:326: Failed to rebuild/reconfigure project: file D:\17265\Documents\projects\GtkPacker\src\main.vala does not exist either on the system or in memory

Also, vls often fail because it cannot find and show doc on windows, so there may also need a option to disable it.

@wszqkzqk please open a new issue on vala-language-server describing your problem with Meson on Windows. Also, please enable debug messages in the extension settings.