Tasks view in Eclipse not showing TODOs?

独自空忆成欢 提交于 2019-12-10 10:37:55

问题


I'm running Eclipse Kepler with Nodeclipse and am having trouble getting the Tasks view to show my markers.

  1. I have defined my own FEATURE tag as "text contains FEATURE" but it's not showing up.

  2. I can't limit my node.js tasks to my own project. When I set it to "show all", it'll show me hundreds of tasks from node modules I'm using. When I set it as in the screenshot, it doesn't show me any tasks at all any more.

I could live with 1. but 2. is a serious problem for me... Is this a bug in Kepler or do I have a configuration error?

This is how I have it configured:

My project is among the selected working sets. Task tags are enabled in Preferences->Javascript.

UPDATE

This has turned out to be several related issues coming together, so here's an attempt to organize and summarize what progress has been made: (all the following only deals with point 2 of the question)

  1. "Show all" not respecting the selected scope is the desired behavior. Scopes are part of the configuration (the UI hints at this by putting them in the "Configuration" group pane), which the "Show all" setting bypasses. So this is not actually a functionality error, just misleading UI. I've raised the issue here

  2. Javascript tasks not being shown at all can be worked around by going to Preferences -> Javascript -> Validator -> Task Tags, changing something and applying. This triggers a rebuild and incorporates any task tags there are in the code. However, future tasks are not incorporated automatically. This appears to be a known issue.

  3. The problem of node modules polluting the tasks view can be solved by making the folder a library folder instead of a source folder. See this answer to this question


回答1:


One of the wizards on the Eclipse BugZilla explained an easy solution to it showing TODOs from node modules:

The node_modules folder has to be made a library folder. To do that, one needs to go to Project -> Properties -> Javascript -> Include Path, choose the "Libraries" tab, click "Add a library folder..." and set it to the node_modules subfolder.

Simple as that.

Here is the source: https://bugs.eclipse.org/bugs/show_bug.cgi?id=432231#c4

UPDATED:

Nodeclipse project config will be updated in 0.15 to solve the issue

See https://github.com/Nodeclipse/nodeclipse-1/issues/143




回答2:


On screenshot you have scope "On working set", not "in the same project". Though even with that filter it did not work for me on Eclipse Luna 4.4.M4 (Enide Studio 2014)

Note that JavaScript Task are added by JSDT, that is not Node.js aware (so it cannot handle node_modules)

Raise a bug on https://bugs.eclipse.org/bugs/ (and share here)

UPDATE:

From Bug 432231 - Tasks view not working correctly on Javascript projects it reads that TODOs are processed by JSDT builder when .project includes it like

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
    <name>JSDTJavaScriptProject</name>
    <comment></comment>
    <projects>
    </projects>
    <buildSpec>
        <buildCommand>
            <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
            <arguments>
            </arguments>
        </buildCommand>
    </buildSpec>
    <natures>
        <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
    </natures>
</projectDescription>

while Nodeclipse .project template is like below (Using JSHInt instead of JSDT Validator)

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
    <name>NodeExpressEjsLESS</name>
    <comment></comment>
    <projects>
    </projects>
    <buildSpec>
        <buildCommand>
            <name>com.eclipsesource.jshint.ui.builder</name>
            <arguments>
            </arguments>
        </buildCommand>
    </buildSpec>
    <natures>
        <nature>org.nodeclipse.ui.NodeNature</nature>
        <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
    </natures>
</projectDescription>

This was done because JSDT does not support ECMAScript 5 Bug 223131 - [language support] Add ecmascript4 /JavaScript 2 compiler compliance level . That is not trivial thing to do.

See also How to ignore node shebang error in Eclipse? answer on why current configuration is recommended.

Parsing TODOs by JSHInt-Eclipse is open issue https://github.com/eclipsesource/jshint-eclipse/issues/68 But it was said, it should be better independent plugin.



来源:https://stackoverflow.com/questions/22881044/tasks-view-in-eclipse-not-showing-todos

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!