Maybe this question is a bit silly, but how can I tell Syntastic that the classes and methods I'm using in one file are implemented in another one?
There are no includes in Vala, as far as I know, as all the files are passed to the compiler, which works everything out.
According to :h syntastic-vala-valac, set g:syntastic_vala_modules or add the list of modules to a // modules: comment?
@lcd047 I tried that (by writing the name of the file, with and without the extension) but it does not work...
In fact it breaks syntastic: no errors are reported any more.
In fact it breaks syntastic: no errors are reported any more.
Please open your test file, set g:syntastic_debug to 3, run the checker, run :mes, and post the output.
So, I've added the file in the modules list as syntext.vala in the main.vala file.
As you can see in line 10, it is added to the valac command preceded by a --pkg.
I think there should be another special line at the top named // files: or // sources: containing the files that are passed directly to the Vala compiler. What do you think?
"main.vala" 238L, 7750C written
syntastic: 41.347268: g:syntastic_version = '3.7.0-237 (Vim 800, Linux, GUI)'
syntastic: 41.347640: &shell = 'bash' (!), &shellcmdflag = '-c', &shellpipe = '2>&1| tee', &shellquote = '', &shellred
ir = '>%s 2>&1', &shelltemp = 1, &shellxquote = '', &autochdir = 0, &shellxescape = ''
syntastic: 41.348743: UpdateErrors (auto): default checkers
syntastic: 41.349682: CacheErrors: default checkers
syntastic: 41.351436: g:syntastic_aggregate_errors = 0
syntastic: 41.351924: getcwd() = '/mnt/data/vala'
syntastic: 41.353399: CacheErrors: Invoking checker: vala/valac
syntastic: 41.355777: SyntasticMake: called with options: {'errorformat': '%A%f:%l.%c-%\d%\+.%\d%\+: %t%[a-z]%\+: %m,%
C%m,%Z%m', 'makeprg': 'valac -C --pkg syntext.vala main.vala'}
syntastic: 41.368631: system: command run in 0.012215s
syntastic: 41.368979: checker output: ['error: Package `syntext.vala'' not found in specified Vala API directories or
GObject-Introspection GIR directories', 'Compilation failed: 1 error(s), 0 warning(s)', '']
syntastic: 41.369912: raw loclist: [{'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '', 'pa
ttern': '', 'text': 'error: Package `syntext.vala'' not found in specified Vala API directories or GObject-Introspecti
on GIR directories'}, {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 't
ext': 'Compilation failed: 1 error(s), 0 warning(s)'}, {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr':
-1, 'type': '', 'pattern': '', 'text': ''}]
syntastic: 41.370547: getLocList: checker vala/valac returned 1
syntastic: 41.370781: vala/valac raw: [{'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '',
'pattern': '', 'text': 'error: Package `syntext.vala'' not found in specified Vala API directories or GObject-Introspe
ction GIR directories'}, {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '',
'text': 'Compilation failed: 1 error(s), 0 warning(s)'}, {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr
': -1, 'type': '', 'pattern': '', 'text': ''}]
syntastic: 41.371141: quiet_messages filter: {}
syntastic: 41.371340: getLocList: checker vala/valac run in 0.017615s
syntastic: 41.371737: aggregated: {'_sorted': 0, '_name': '', '_owner': 1, '_columns': 1, '_rawLoclist': []}
What do you think?
It's up to you to pass the proper flags to vala so that the command line makes sense for what you want to do. As of what those flags might be, I personally have no idea. I know nothing about Vala beyond the name. _shrug_
The thing is that, the --pkg option is used to pass a certain kind of files (vapi or gir), which are like binding files.
What I have is the source code split into several files, and they must be compiled like:
valac --pkg gio-2.0 --pkg gee-0.8 file1.vala file2.vala -o output_name
Where gio and gee are system libraries. So, as far as I know, if I implement some functionality in file1.vala that is needed by file2.vala, there is no way to tell Syntastic to find file1.vala to construct the proper command line...
Maybe, Syntastic could look for other .vala files in the same directory and add them to the path... Or, as I said, add yet another special line to specify which files the current one depends on, which I think is less error-prone...
Like I said: it's up to you to pass the proper arguments to valac. Nothing stops you from adding filenames along with options to g:syntastic_vala_valac_args.
I will try that, thank you :)
Setting g:syntastic_vala_valac_args is bad idea, because i must append all files in project. If I use some like // source it is like #include in C/C++, which is much better. Why?
#include@ondratu you can check out my https://github.com/arrufat/vala.vim plugin, which contains a modified syntax checker for syntastic that adds sources and flags keywords.
@arrufat Excellent: this means the valac checker can be dropped in favor of the external one.
Anyway, we you can also have a look at:
Checker valac is now left to the vala.vim plugin. Commit f3766538.
@arrufat Please note that there's a small initialization snippet you need to add to your plugin (cf. guide), since Syntastic no longer knows about the vala filetype.
@lcd047 thank you I'll take a look and update it asap :)