[vim/vim] Add variables, functions and version items to getscriptinfo() (PR #10962)

17 views
Skip to first unread message

Yegappan Lakshmanan

unread,
Aug 23, 2022, 1:51:24 AM8/23/22
to vim/vim, Subscribed

You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/10962

Commit Summary

  • c90ca83 Add variables, functions and version items to getscriptinfo()

File Changes

(5 files)

Patch Links:


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/10962@github.com>

Yegappan Lakshmanan

unread,
Aug 23, 2022, 1:59:34 AM8/23/22
to vim/vim, Push

@yegappan pushed 1 commit.

  • 807075b Fix build error with normal build


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/10962/push/10803014172@github.com>

codecov[bot]

unread,
Aug 23, 2022, 2:11:07 AM8/23/22
to vim/vim, Subscribed

Codecov Report

Merging #10962 (807075b) into master (adce965) will increase coverage by 0.00%.
The diff coverage is 78.57%.

@@           Coverage Diff           @@

##           master   #10962   +/-   ##

=======================================

  Coverage   82.69%   82.69%           

=======================================

  Files         148      148           

  Lines      173807   173849   +42     

  Branches    39274    39286   +12     

=======================================

+ Hits       143726   143762   +36     

- Misses      17470    17475    +5     

- Partials    12611    12612    +1     
Flag Coverage Δ
huge-clang-none 82.69% <78.57%> (+<0.01%) ⬆️
linux 82.69% <78.57%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/userfunc.c 88.98% <ø> (ø)
src/scriptfile.c 82.27% <78.57%> (-0.15%) ⬇️
src/ui.c 73.58% <0.00%> (-0.54%) ⬇️
src/gui_gtk_x11.c 51.72% <0.00%> (-0.29%) ⬇️
src/gui.c 71.29% <0.00%> (-0.15%) ⬇️
src/os_unix.c 67.71% <0.00%> (+0.21%) ⬆️
src/netbeans.c 71.64% <0.00%> (+0.29%) ⬆️
src/if_xcmdsrv.c 76.97% <0.00%> (+0.89%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/10962/c1223593905@github.com>

Bram Moolenaar

unread,
Aug 23, 2022, 2:55:58 PM8/23/22
to vim/vim, Subscribed


It is unlikely someone wants to get all variables and functions of all
scripts. This adds a lot of overhead to the return value of
getscriptinfo().

The "version" item seems useful. The "functions" and "variables" are
better obtained for a function that does this for one script. I do
wonder what the use of it is. What would justify adding this
functionality? Making the script-local items accessible can be used for
hacks, the writer of the script may not want to make it so easy to
access them.

--
I just planted an Algebra tree. It has square roots.

/// 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 ///


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/10962/c1224620085@github.com>

Yegappan Lakshmanan

unread,
Aug 24, 2022, 12:00:49 PM8/24/22
to vim_dev, reply+ACY5DGDUESOJE6N65M...@reply.github.com, vim/vim, Subscribed
Hi Bram,

On Tue, Aug 23, 2022 at 11:55 AM Bram Moolenaar <vim-dev...@256bit.org> wrote:


It is unlikely someone wants to get all variables and functions of all
scripts. This adds a lot of overhead to the return value of
getscriptinfo().

The "version" item seems useful.

I will create a separate PR to add the "version" item.
 
The "functions" and "variables" are
better obtained for a function that does this for one script. I do
wonder what the use of it is. What would justify adding this
functionality? Making the script-local items accessible can be used for
hacks, the writer of the script may not want to make it so easy to
access them.


All the script-local functions can be already listed by using the ":function" command
without any arguments.  This change just makes it easier to get it as a List.

Getting the list of script-local variables and their values is useful for debugging
plugin issues (without modifying the plugin). It is useful for plugin developers.

I will create a PR to filter the results by a particular script name.
 
Regards,
Yegappan

vim-dev ML

unread,
Aug 24, 2022, 12:01:02 PM8/24/22
to vim/vim, vim-dev ML, Your activity

Hi Bram,

On Tue, Aug 23, 2022 at 11:55 AM Bram Moolenaar ***@***.***>


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/10962/c1225922797@github.com>

Bram Moolenaar

unread,
Aug 24, 2022, 12:57:09 PM8/24/22
to vim...@googlegroups.com, Yegappan Lakshmanan, reply+ACY5DGDUESOJE6N65M...@reply.github.com

> > It is unlikely someone wants to get all variables and functions of all
> > scripts. This adds a lot of overhead to the return value of
> > getscriptinfo().
> >
> > The "version" item seems useful.
>
> I will create a separate PR to add the "version" item.

I also added the "sourced" item now. Only set if the script was a link
that is resolved later. It's useful that way.

> > The "functions" and "variables" are
> > better obtained for a function that does this for one script. I do
> > wonder what the use of it is. What would justify adding this
> > functionality? Making the script-local items accessible can be used for
> > hacks, the writer of the script may not want to make it so easy to
> > access them.
>
> All the script-local functions can be already listed by using the
> ":function" command
> without any arguments. This change just makes it easier to get it as a
> List.

OK, knowing the script ID it was already possible, but a bit complicated
to get these functions. And it's OK to call them, even from outside the
script, as this already happens for various reasons (mappings, option
values, etc.)

> Getting the list of script-local variables and their values is useful for
> debugging plugin issues (without modifying the plugin). It is useful
> for plugin developers.

One thing I want to avoid is to make it possible for script-local
variables to be changed from outside the script. This makes it less
predictable. Currently it is a "cannot happen", which reduces the
effort to find out why something happened. For debugging it can be
useful to inspect the variables, but it would be good if we can make it
impossible to change them. E.g. by making a copy.

--
BEDEVERE: Look! It's the old man from scene 24 - what's he Doing here?
ARTHUR: He is the keeper of the Bridge. He asks each traveler five
questions ...
GALAHAD: Three questions.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\

vim-dev ML

unread,
Aug 24, 2022, 12:57:28 PM8/24/22
to vim/vim, vim-dev ML, Your activity
/// 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 ///


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/10962/c1225990211@github.com>

Yegappan Lakshmanan

unread,
Aug 24, 2022, 10:29:18 PM8/24/22
to vim/vim, vim-dev ML, Push

@yegappan pushed 2 commits.

  • 5ba372b Add variables, functions and version items to getscriptinfo()
  • 9d39bc1 Add support to getscriptinfo() to return information about scripts matching a pattern. Add script version to the returned value

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/10962/push/10825540030@github.com>

Bram Moolenaar

unread,
Aug 25, 2022, 7:12:03 AM8/25/22
to vim...@googlegroups.com, Yegappan Lakshmanan

The test for the name should use something more specific than
"Xscript", that's a common name and the test might break in a strange
way when something gets added later.

--
BRIDGEKEEPER: What is your favorite editor?
GAWAIN: Emacs ... No, Viiiiiiiiiiimmmmmmm!
"Monty Python and the Holy editor wars" PYTHON (MONTY) SOFTWARE LTD

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\

Yegappan Lakshmanan

unread,
Aug 25, 2022, 10:21:59 AM8/25/22
to vim/vim, vim-dev ML, Push

@yegappan pushed 1 commit.

  • b38b1c1 Use a uniqe name for the script filename. Add additional tests:

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/10962/push/10831689825@github.com>

Yegappan Lakshmanan

unread,
Aug 25, 2022, 10:23:01 AM8/25/22
to vim/vim, vim-dev ML, Push

@yegappan pushed 1 commit.

  • 9c5b6e3 Temporary script file not deleted

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/10962/push/10831702671@github.com>

Yegappan Lakshmanan

unread,
Aug 25, 2022, 10:33:56 AM8/25/22
to vim/vim, vim-dev ML, Push

@yegappan pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/10962/push/10831832583@github.com>

Yegappan Lakshmanan

unread,
Aug 25, 2022, 11:19:44 AM8/25/22
to vim_dev, Yegappan Lakshmanan
Hi Bram,

On Thu, Aug 25, 2022 at 4:12 AM Bram Moolenaar <Br...@moolenaar.net> wrote:
>
>
> The test for the name should use something more specific than
> "Xscript", that's a common name and the test might break in a strange
> way when something gets added later.
>

I have updated the PR to use a somewhat unique name for the temporary
script file.

Regards,
Yegappan

Bram Moolenaar

unread,
Aug 25, 2022, 12:41:08 PM8/25/22
to vim/vim, vim-dev ML, Comment

Closed #10962 via 520f6ef.


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/10962/issue_event/7261176601@github.com>

Reply all
Reply to author
Forward
0 new messages