diff options
Diffstat (limited to 'autoload/crystal_lang.vim')
-rw-r--r-- | autoload/crystal_lang.vim | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/autoload/crystal_lang.vim b/autoload/crystal_lang.vim index a04d456b..99d0ca2c 100644 --- a/autoload/crystal_lang.vim +++ b/autoload/crystal_lang.vim @@ -77,10 +77,17 @@ function! crystal_lang#entrypoint_for(file_path) abort return a:file_path endif + let required_spec_path = get(b:, 'crystal_required_spec_path', get(g:, 'crystal_required_spec_path', '')) + if required_spec_path !=# '' + let require_spec_str = './' . required_spec_path + else + let require_spec_str = './spec/**' + endif + let temp_name = root_dir . '/__vim-crystal-temporary-entrypoint-' . fnamemodify(a:file_path, ':t') let contents = [ \ 'require "spec"', - \ 'require "./spec/**"', + \ 'require "' . require_spec_str . '"', \ printf('require "./%s"', fnamemodify(a:file_path, ':p')[strlen(root_dir)+1 : ]) \ ] |