vim9script def Test_vim9_reload_noclear() var lines =<< trim END vim9script export var exported = 'thexport' export def TheFunc(x = 0) enddef END writefile(lines, 'XExportReload.vim') lines =<< trim END vim9script noclear g:loadCount += 1 var s:reloaded = 'init' # import './XExportReload' as exp # <--- import './XExportReload.vim' # <--- def Again(): string return 'again' enddef # exp.TheFunc() # <--- echom XExportReload.exported # <--- if exists('s:loaded') | finish | endif var s:loaded = true var s:notReloaded = 'yes' s:reloaded = 'first' def g:Values(): list<string> return [s:reloaded, s:notReloaded, Again(), Once(), exp.exported] enddef def Once(): string return 'once' enddef END writefile(lines, 'XReloaded') g:loadCount = 0 source XReloaded assert_equal(1, g:loadCount) assert_equal(['first', 'yes', 'again', 'once', 'thexport'], g:Values()) # <--- source XReloaded assert_equal(2, g:loadCount) assert_equal(['init', 'yes', 'again', 'once', 'thexport'], g:Values()) source XReloaded assert_equal(3, g:loadCount) assert_equal(['init', 'yes', 'again', 'once', 'thexport'], g:Values()) delete('XReloaded') delete('XExportReload.vim') # delfunc g:Values # <--- would raised err 'no g:Values' func IF not commented out IF to do second 'source' this unlet g:loadCount enddef Test_vim9_reload_noclear()
1, if sourced this at second time (if delfunc g:Values was not comment out`), would raise err 'no func g:Values'.
// is that expected? looks g:Values was not re-defined at second 'source'.
2, before the day before yesterday, it call exported that imported 'var' directly, but now it had to be exp.exported or XExportReload.exported (as well as 'func' case).
// not sure should be or not, but looks this is a bit un-compatible, existing vim9 scripts/plugins had to add such 'prefix'.
3, E1257: Imported script must use "as" or end in .vim: XExportReload
// my broken english but perhaps end *with* .vim (or the extension must be '.vim') maybe more understandable. :-)
v8.2.4036
linux
#9484 #9485
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
I am not quite sure what you did and what you have problems with.
pls try following demo code, perhaps a bit more clear.. just copy it and ':so %' two times, at second time it would riased err about 'no g:Values func'.
// this is the first issue in/as this ticket description.
// as for the second issue:
pls check those case_1 and case_2 and case_3 in following code, before the day before yesterday, case_3 worked, but now looks only case_1 and case_2 works. this is a bit un-compatible, but this had to be changed, then some existing vim9script had to be re-factor too..............
vim9script def Test_vim9_reload_noclear() var lines =<< trim END vim9script export var exported = 'thexport' export def TheFunc(x = 0) enddef END writefile(lines, 'XExportReload.vim') lines =<< trim END vim9script noclear g:loadCount += 1 var s:reloaded = 'init' # import './XExportReload' as exp # <--- import './XExportReload.vim' # <--- def Again(): string return 'again' enddef
# exp.TheFunc() # <--- case_1
echom XExportReload.exported # <--- case_2
# echom exported # <--- case_3
if exists('s:loaded') | finish | endif var s:loaded = true var s:notReloaded = 'yes' s:reloaded = 'first' def g:Values(): list<string>
# return [s:reloaded, s:notReloaded, Again(), Once(), exp.exported]
return [s:reloaded, s:notReloaded, Again(), Once(), XExportReload.exported]
enddef def Once(): string return 'once' enddef END writefile(lines, 'XReloaded') g:loadCount = 0 source XReloaded assert_equal(1, g:loadCount) assert_equal(['first', 'yes', 'again', 'once', 'thexport'], g:Values()) # <--- source XReloaded assert_equal(2, g:loadCount) assert_equal(['init', 'yes', 'again', 'once', 'thexport'], g:Values()) source XReloaded assert_equal(3, g:loadCount) assert_equal(['init', 'yes', 'again', 'once', 'thexport'], g:Values()) delete('XReloaded') delete('XExportReload.vim'
) delfunc g:Values # <--- would raised err 'no g:Values' func IF not commented out IF to do second 'source' this
unlet g:loadCount enddef Test_vim9_reload_noclear()
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
oh........... my bad, i did not notice that finish.
pls ignore the first issue.
// but how about second issue?
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
i saw you committed new patch (8.2.4044) and updated doc a bit as well,
but import exported from './XExportReload.vim' such style 'import' (keyword 'from') still / no longer supported.. :-(
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
looks this vim9 'import' style change had been made as permanent, so/then let it be..
// and patch 8.2.4063 yesterday helped and fixed a big mess, so ok then... :-)
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
Closed #9490.
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
v8.2.4264 revoked the '#' style function name in vim9, but:
1, that made some complex to call such vim9 func in legacy vim script e.g vimrc.
2, that exported func name had to be 'Uppercase' first letter?
- func auto9#getsome() + export func Getsome()
3, in some languages, if that first letter of function name is Uppercase, that means 'public' already, as my understanding, if it do req 'Uppercase' then maybe no req 'export' keyword?!
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
Reopened #9490.
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
> v8.2.4264 revoked the '#' style function name in vim9, but:
> 1, that made some complex to call such vim9 func in legacy vim script
> e.g vimrc.
I don't see how. You can still call the autoload function using the #
form.
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
to be honest, i had been some kind confused how to use those:
s:fooFunc
g:FooFunc
export def FooFunc
or def fooFunc
or what if was not a func but a var
and what if those in autoload/ folder
and what if those in plugin/ folder
and specially what/how if call those vim9 func in legacy vim script.............. :-(
// looks made things a bit complex...
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you commented.![]()
So far you could have an autoload function call anywhere, just use
"scriptname#Funcname()".
[...]
Now you need an "import autoload 'scriptname.vim'" and then you can use
"scriptname.Funcname()".
We can still call an autoload function with scriptname#Funcname() from anywhere.
vim9script var dir = '/tmp/.vim' dir->delete('rf') &runtimepath = dir dir ..= '/autoload' dir->mkdir('p')
var lines =<< trim END vim9script
export def Funcname()
echomsg 'from scriptname#Funcname()'
enddef
END
lines->writefile(dir .. '/scriptname.vim')
scriptname#Funcname()from scriptname#Funcname()
Notice that we don't even need :import autoload.
And it has to remain allowed, because there are still 6 contexts where we can't use the Vim9 syntax (because the code is run in the global context):
:help i_CTRL-R_=:help c_CTRL-\_e:help stl-%{:help 'statusline', and :help 'tabline' (%!Func()):help input() (third {completion} argument):help undo_ftplugin—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you commented.![]()
call foo#Bar() call FooBar() # or `call g:FooBar()`
looks once if above such func had s: scope action or var in it,
// or it is, e.g g:Foo = s:abc.Foo
then first one is ok when run directly in vimrc (not call in a legacy vim script func),
but second one would be failed (err: not found func).
// but looks (or i guess) No Err if no s: scope action or var in it, or run it manually when vim had enter done.
@yegappan :
if specific to your lsp plugin, the err happened at LspAddServer(cfg), and LspOptionsSet.
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you commented.![]()
call foo#Bar() call FooBar() # or `call g:FooBar()`looks once if above such func had
s:scope action or var in it,
// or it is, e.gg:Foo = s:abc.Foo
then first one is ok when run directly in vimrc (not call in a legacy vim script func),
but second one would be failed (err: not found func).
// but looks (or i guess) No Err if nos:scope action or var in it, or run it manually when vim had enter done.@yegappan :
if specific to your lsp plugin, the err happened at LspAddServer(cfg), and LspOptionsSet.
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.![]()
@yegappan i tried your new update.
the different is from lspoptions#LspOptionsSet() to lspoptions#OptionsSet() (your new update changed that name).
// so far this is the workaround, which if using global style vim9 function then failed.
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you commented.![]()
// so far # style (with Uppercase first letter -IF compare to legacy # style) is the workaround.
// and looks it is a bit complex to make it be compatible if user's vim was not using latest version...
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you commented.![]()
// closing..
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.![]()
Closed #9490.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.![]()