ale
ale copied to clipboard
Erlang syntax check not working for -include_lib
Information
VIM version VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Mar 30 2018 07:42:53) macOS version
Operating System: WHAT OS WERE YOU USING? Mac Sierra, 10.12.6
:ALEInfo
Current Filetype: erlang Available Linters: ['erlc', 'syntaxerl'] Enabled Linters: ['erlc', 'syntaxerl'] Linter Variables:
let g:ale_erlang_erlc_options = '' let g:ale_erlang_syntaxerl_executable = 'syntaxerl' Global Variables:
let g:ale_cache_executable_check_failures = 0 let g:ale_change_sign_column_color = 0 let g:ale_command_wrapper = '' let g:ale_completion_delay = 100 let g:ale_completion_enabled = 0 let g:ale_completion_max_suggestions = 50 let g:ale_echo_cursor = 1 let g:ale_echo_msg_error_str = 'Error' let g:ale_echo_msg_format = '%code: %%s' let g:ale_echo_msg_info_str = 'Info' let g:ale_echo_msg_warning_str = 'Warning' let g:ale_enabled = 1 let g:ale_fix_on_save = 0 let g:ale_fixers = {} let g:ale_history_enabled = 1 let g:ale_history_log_output = 1 let g:ale_keep_list_window_open = 0 let g:ale_lint_delay = 200 let g:ale_lint_on_enter = 1 let g:ale_lint_on_filetype_changed = 1 let g:ale_lint_on_save = 1 let g:ale_lint_on_text_changed = 'always' let g:ale_lint_on_insert_leave = 0 let g:ale_linter_aliases = {} let g:ale_linters = {} let g:ale_linters_explicit = 0 let g:ale_list_window_size = 10 let g:ale_list_vertical = 0 let g:ale_loclist_msg_format = '%code: %%s' let g:ale_max_buffer_history_size = 20 let g:ale_max_signs = -1 let g:ale_maximum_file_size = 0 let g:ale_open_list = 1 let g:ale_pattern_options = {} let g:ale_pattern_options_enabled = 0 let g:ale_set_balloons = 0 let g:ale_set_highlights = 1 let g:ale_set_loclist = 1 let g:ale_set_quickfix = 0 let g:ale_set_signs = 1 let g:ale_sign_column_always = 0 let g:ale_sign_error = '>>' let g:ale_sign_info = '--' let g:ale_sign_offset = 1000000 let g:ale_sign_style_error = '>>' let g:ale_sign_style_warning = '--' let g:ale_sign_warning = '--' let g:ale_statusline_format = ['%d error(s)', '%d warning(s)', 'OK'] let g:ale_type_map = {} let g:ale_use_global_executables = v:null let g:ale_warn_about_trailing_blank_lines = 1 let g:ale_warn_about_trailing_whitespace = 1 Command History:
(executable check - success) erlc (started) ['/bin/bash', '-c', 'erlc -o ''/var/folders/0w/0v15qlld27zd125_ghmj4ym00000gn/T/vQnOCoj/7'' ''/var/folders/0w/0v15qlld27zd125_ghmj4ym00000gn/T/vQnOCoj/8/grid_user.erl'''] (executable check - failure) syntaxerl (finished - exit code 1) ['/bin/bash', '-c', 'erlc -o ''/var/folders/0w/0v15qlld27zd125_ghmj4ym00000gn/T/vQnOCoj/9'' ''/var/folders/0w/0v15qlld27zd125_ghmj4ym00000gn/T/vQnOCoj/10/grid_user.erl''']
<<<OUTPUT STARTS>>>
/var/folders/0w/0v15qlld27zd125_ghmj4ym00000gn/T/vQnOCoj/10/grid_user.erl:3: can't find include lib "../migresia/include/tables.hrl"
/var/folders/0w/0v15qlld27zd125_ghmj4ym00000gn/T/vQnOCoj/10/grid_user.erl:15: record user undefined
<<<OUTPUT ENDS>>>
(executable check - failure) syntaxerl
What went wrong
-include_lib("../migresia/include/tables.hrl").
Both syntax_erl and erlc linters are giving following error for above code
src/grid_user.erl|3 error| can't find include lib "../migresia/include/tables.hrl"
I have tried syntastic and it doesnt give this error. Obviously, the code works.
Reproducing the bug
Steps for repeating the bug:
Use -include_lib
It seems erlc doesn't knows about the project structure.
BTW, I am using erlang.mk
We might have to do something similar to erlang_check_file.erl in vim-syntastic.
cc: @evnu
Yes, erlc does not know about projects. For include_libs, g:ale_erlang_erlc_options can come in handy. I use this variable to set include path options (-I), which worked fine for me so far. I usually fill this with an expanded wildcard. Would this work for your case?
I will give it a try. But it would be better If we could have same work flow as syntastic.
Could we include the directory the file is in as an include path automatically, or change directories to where the file is, in the background process?
Install syntaxerl and configure ALE to use it, per the bottom of the README here: https://github.com/ten0s/syntaxerl
This will pick up the config from rebar or erlang.mk and everything will just work 👍🏼