Ctags: javascript:收到“ ctags:警告:忽略null标记”

创建于 2016-04-25  ·  18评论  ·  资料来源: universal-ctags/ctags

[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%
Parser buenhancement

所有18条评论

有什么更新吗?

还是我做错了什么? 我要标记的代码是Javascript / React :)

显然,它与对象解构有关,例如:

    const { name, email } = user;

我没有很好地检查警告。
但是,当我在node命令上测试输入时,您提供的输入看起来有效
我希望您为输入内容打开一个新的问题。
如果您擅长JavaScript,我想了解一下该规范作为参考。
请参阅https://github.com/universal-ctags/ctags/issues/1949#issuecomment -457829914我如何挣扎。

const { name, email } = user;

应该正确标记nameemail


[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'

如果您擅长JavaScript,我想了解一下该规范作为参考。

不知道我是否收到您的问题,但是对象分解的规范在ECMAScript规范上:
https://www.ecma-international.org/ecma-262/6.0/#sec -destructuring-assignment

:)

谢谢。 那就是我所需要的。

为什么不能解决此问题? 我有同样的问题。

谢谢。 那就是我所需要的。

您如何删除警告?

您如何删除警告?

我没有删除警告。

您如何删除警告?

我没有删除警告。

好吧,我也遇到了同样的问题,ctags可以正确解析{A, B} = some_obj

似乎没人能解决这个问题

似乎没人能解决这个问题

对于破坏性绑定,我尝试了一次。

[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

该分支引入了许多更改。
因此,将其合并到我们日常使用的master分支中需要更多考虑。

this[0] = function() {};

在这种情况下,ctags什么也没说。

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

在这种情况下,我得到了警告。 这将是对原始输入的重要提示修复。

似乎没人能解决这个问题

对于破坏性绑定,我尝试了一次。

[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

该分支引入了许多更改。
因此,将其合并到我们日常使用的master分支中需要更多考虑。

我已经尝试过了,非常好的解决方案,谢谢。
您做了这些分支,有那么多补丁吗?

你好

尽管这没有助长ctags本身的问题,但我创建了一个ctags shell函数,该函数忽略了针对JavaScript文件的此特定警告: https :

万一您经常在命令行上运行ctags并希望隐藏警告,直到问题解决。

迪特里希

我也通过数组解构得到此警告:
const [lang, setLang] = useState("en")

@Strangehill ,您可以在#1112中添加相同的评论吗?

当然

谢谢你。

此页面是否有帮助?
0 / 5 - 0 等级