Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

javascript: Got "ctags: Warning: ignoring null tag" #900

Closed
masatake opened this issue Apr 24, 2016 · 23 comments
Closed

javascript: Got "ctags: Warning: ignoring null tag" #900

masatake opened this issue Apr 24, 2016 · 23 comments
Assignees

Comments

@masatake
Copy link
Member

[yamato@x201]~/var/ctags-github% cat /tmp/foo.js 
if (true) {
    this[0] = function() {};
}

[yamato@x201]~/var/ctags-github% ./ctags -o - /tmp/foo.js 
ctags: Warning: ignoring null tag in /tmp/foo.js(line: 2)
[yamato@x201]~/var/ctags-github% js /tmp/foo.js 
[yamato@x201]~/var/ctags-github%
@cristianoliveira
Copy link

cristianoliveira commented Mar 5, 2019

Is there any update on this?

Or am I doing something wrong? The code I'm trying to tag is Javascript/React :)

@cristianoliveira
Copy link

Apparently it is related to Object destructuring like:

    const { name, email } = user;

@masatake
Copy link
Member Author

masatake commented Mar 5, 2019

I have not inspected the warning well.
However, the input you gave looks valid as I tested the input on node command
I would like you to open a new issue for the input.
If you are good at JavaScript, I would like to know the specification as reference.
See #1949 (comment) how I struggled.

const { name, email } = user;

name and email should be tagged well.


[yamato@slave]~% node
> var user = {name: 'a', email: 'b'}
var user = {name: 'a', email: 'b'}
undefined
> const { name, email } = user;
const { name, email } = user;
undefined
> name
name
'a'

@cristianoliveira
Copy link

If you are good at JavaScript, I would like to know the specification as reference.

Not sure if I got your question but the specification for the Object Destructuring is on the ECMAScript specification:
https://www.ecma-international.org/ecma-262/6.0/#sec-destructuring-assignment

:)

@masatake
Copy link
Member Author

masatake commented Mar 5, 2019

Thanks. That is what I need.

@winkee01
Copy link

Why does this issue not be addressed? I've got the same problem.

@winkee01
Copy link

Thanks. That is what I need.

how did you remove the warning?

@masatake
Copy link
Member Author

how did you remove the warning?

I didn't remove the warning.

@winkee01
Copy link

how did you remove the warning?

I didn't remove the warning.

well, I've got the same issue, {A, B} = some_obj can be parsed correctly by ctags.

@winkee01
Copy link

Looks like no one is going to fix this issue

@masatake
Copy link
Member Author

Looks like no one is going to fix this issue

For the destructural binding, I tried once.

[jet@living]/tmp% cd /tmp
cd /tmp
[jet@living]/tmp% git clone https://github.com/masatake/ctags.git
git clone https://github.com/masatake/ctags.git
Cloning into 'ctags'...
...
[jet@living]/tmp% cd ctags
cd ctags
[jet@living]/tmp/ctags% git checkout  origin/js-destructual-binding 
git checkout  origin/js-destructual-binding 
Note: switching to 'origin/js-destructual-binding'.
...
HEAD is now at 4eeac5b9 JavaScript: support more forms of destructuring assignments
[jet@living]/tmp/ctags% bash ./autogen.sh
bash ./autogen.sh
+ type autoreconf
...
optlib2c: translating optlib/inko.ctags to optlib/inko.c
+ ./misc/optlib2c optlib/inko.ctags
+ exit 0
[jet@living]/tmp/ctags% ./configure
./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
...
config.status: creating config.h
config.status: executing depfiles commands
[jet@living]/tmp/ctags% make -j 9
make -j 9
REPOINFO   main/repoinfo.h
make  all-recursive
make[1]: Entering directory '/tmp/ctags'
make[2]: Entering directory '/tmp/ctags'
...
  AR       libctags.a
  CCLD     ctags
  CCLD     mini-geany
make[2]: Leaving directory '/tmp/ctags'
make[1]: Leaving directory '/tmp/ctags'
[jet@living]/tmp/ctags% cat /tmp/bar.js 
cat /tmp/bar.js 
const { name, email } = user;

[jet@living]/tmp/ctags% ./ctags -o - /tmp/bar.js 
./ctags -o - /tmp/bar.js 
email	/tmp/bar.js	/^const { name, email } = user;$/;"	C
name	/tmp/bar.js	/^const { name, email } = user;$/;"	C

The branch introduces so many changes.
So merging it to the master branch we use daily needs more consideration.

@masatake
Copy link
Member Author

this[0] = function() {};

In this case, ctags says nothing.

{
	this[0] = function() {};
}

In this case, I got a warning. This will be an important hint fix for the original input.

@winkee01
Copy link

Looks like no one is going to fix this issue

For the destructural binding, I tried once.

[jet@living]/tmp% cd /tmp
cd /tmp
[jet@living]/tmp% git clone https://github.com/masatake/ctags.git
git clone https://github.com/masatake/ctags.git
Cloning into 'ctags'...
...
[jet@living]/tmp% cd ctags
cd ctags
[jet@living]/tmp/ctags% git checkout  origin/js-destructual-binding 
git checkout  origin/js-destructual-binding 
Note: switching to 'origin/js-destructual-binding'.
...
HEAD is now at 4eeac5b9 JavaScript: support more forms of destructuring assignments
[jet@living]/tmp/ctags% bash ./autogen.sh
bash ./autogen.sh
+ type autoreconf
...
optlib2c: translating optlib/inko.ctags to optlib/inko.c
+ ./misc/optlib2c optlib/inko.ctags
+ exit 0
[jet@living]/tmp/ctags% ./configure
./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
...
config.status: creating config.h
config.status: executing depfiles commands
[jet@living]/tmp/ctags% make -j 9
make -j 9
REPOINFO   main/repoinfo.h
make  all-recursive
make[1]: Entering directory '/tmp/ctags'
make[2]: Entering directory '/tmp/ctags'
...
  AR       libctags.a
  CCLD     ctags
  CCLD     mini-geany
make[2]: Leaving directory '/tmp/ctags'
make[1]: Leaving directory '/tmp/ctags'
[jet@living]/tmp/ctags% cat /tmp/bar.js 
cat /tmp/bar.js 
const { name, email } = user;

[jet@living]/tmp/ctags% ./ctags -o - /tmp/bar.js 
./ctags -o - /tmp/bar.js 
email	/tmp/bar.js	/^const { name, email } = user;$/;"	C
name	/tmp/bar.js	/^const { name, email } = user;$/;"	C

The branch introduces so many changes.
So merging it to the master branch we use daily needs more consideration.

I've tried it, a very good solution, thanks.
Did you made these branches, so many patches.

@dietrichm
Copy link

Hi

Although this is not contributing to the issue in ctags itself, I created a ctags shell function that ignores this specific warning for JavaScript files: https://gist.github.com/dietrichm/9e518549fd609173182ce36ac4726df2

Just in case you frequently run ctags on the command line and want to hide the warnings until the issue is fixed.

Dietrich

@Strangehill
Copy link

I also get this warning with array destructuring :
const [lang, setLang] = useState("en")

@masatake
Copy link
Member Author

@Strangehill, could you add the same comment to #1112?

@Strangehill
Copy link

of course

@masatake
Copy link
Member Author

Thank you.

masatake added a commit to masatake/ctags that referenced this issue Jul 5, 2022
Related to universal-ctags#900, universal-ctags#1112, and universal-ctags#3427.

When the parser tries making a tag with empty name, an assertion
in registerEntry fails. The parser side should be fixed but it
will take a time. This change puts guard conditions around
registerEntry to avoid the failures.

THIS IS A TEMPORARILY SOLUTION.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
@jafl jafl self-assigned this Jul 17, 2022
@coderj001
Copy link

I also got the same error
https://imgur.com/OriFjrG.png

server.js
https://imgur.com/S1MC5X5.png

@AdrienGiboire
Copy link

FYI: If you pass the --quiet=yes command-line option, this warning is not shown anymore. While not being a perfect solution, it at least silences the clutter.

That does not shut it up on my side, at all 🤷

I'll have to go with @dietrichm alternative for the time being as I'm heavily using deconstruction which ctags really spammy.

@masatake
Copy link
Member Author

masatake commented Jan 5, 2023

Could you try #3435?

@AdrienGiboire
Copy link

AdrienGiboire commented Jan 9, 2023

Could you try #3435?

I'm moving to the PR. Let me know if you want to keep it here.

@jafl
Copy link
Contributor

jafl commented Jul 5, 2023

For the original issue, the fix is in #3762. Closing, since #3435 is working on the much larger destructuring issue.

@jafl jafl closed this as completed Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants