Closed lacygoill closed 2 years ago
Actually, an error should be given earlier, as soon as import autoload
is sourced.
There might be other issues with the new syntax allowing relative paths, but I'll wait for this issue to be fixed before trying to do more tests.
Actually, an error should be given earlier, as soon as
import autoload
is sourced.
We can check if the file exists. At this point the name is turned into the full path, so that when the same script is used with different "import" arguments we still see it as the same script. Thus we should also be able to check if it exists with just one system call.
There might be other issues with the new syntax allowing relative paths, but I'll wait for this issue to be fixed before trying to do more tests.
Yes, please do try it out. The fix for this error should not matter though. When implementing this I found that it's more tricky, since we cannot fall back to the existing autoload mechanism that recognizes the script#item syntax.
Also, once the script did get loaded the items can be found and the behavior will be different. Thus if you compile a function before the autoload script is loaded it cannot check types, but if the script was already loaded it can give error messages at compile time.
-- Vi beats Emacs to death, and then again! http://linuxtoday.com/stories/5764.html
/// Bram Moolenaar -- @.*** -- http://www.Moolenaar.net \\ /// \\ \\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\ help me help AIDS victims -- http://ICCF-Holland.org ///
Steps to reproduce
Run this shell command:
An error is given. This is expected, because of the specified file path in the
import autoload
command, which is invalid:The given error message is:
This is not expected.
Expected behavior
The given error message is more specific than the current catch-all "unknown error".
Version of Vim
8.2 Included patches: 1-4651
Environment
Operating system: Ubuntu 20.04.4 LTS Terminal: xterm Value of $TERM: xterm-256color Shell: GNU bash, version 5.0.17