Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [Dltk-dev] task tag support

Hi

i looked into the _javascript_ part and i got it working for single line comments like:

// TODO please look at this
/* FIXME asap! */

But not multi line comments yet like:

/*
* TODO multi
*/
or
/*
 TODO multi
*/

because then the TodoTaskSimpleParser.public void parse(ITaskReporter reporter, char[] content)

must be a bit smarter and just ask something for the complete comment and search in that comment for those tasks

But i guess this is why it is called SimpleParser :)

What i needed todo in _javascript_ to get that support is add this in the _javascript_TodoParserType

    /**
     * @see org.eclipse.dltk.validators.core.AbstractTodoTaskBuildParticipantType#getBuildParticipant(org.eclipse.dltk.compiler.task.ITodoTaskPreferences)
     */
    protected IBuildParticipant getBuildParticipant(
            ITodoTaskPreferences preferences) {
        return new _javascript_TodoTaskBuildParticipant(preferences);
    }

    private class _javascript_TodoTaskBuildParticipant implements
            IBuildParticipant {

        private TodoTaskAstParser parser;

        public _javascript_TodoTaskBuildParticipant(
                ITodoTaskPreferences preferences) {
            parser = new TodoTaskAstParser(preferences) {
                /**
                 * @see org.eclipse.dltk.compiler.task.TodoTaskAstParser#findCommentStart(char[],
                 *      int, int)
                 */
                protected int findCommentStart(char[] content, int begin,
                        int end) {
                    for (int i = begin; i < end; ++i) {
                        if (content[i] == '/'
                                && (i + 1 < end && (content[i + 1] == '/' || content[i + 1] == '*'))
                                && checkRange(i)) {
                            return i + 2;
                        }
                    }
                    return -1;
                }
            };
        }

        public void build(ISourceModule module, ModuleDeclaration ast,
                IProblemReporter reporter) throws CoreException {
            parser.build(module, ast, reporter);
        }
    }

so including the inner class _javascript_TodoTaskBuildParticipant, which is pretty much a complete copy
just to override the findCommentStart method.

Also the TodoTaskAstParser is in the general packages of dltk but isnt that comment # very specific to a script implementation?
i dont mind that it is default there but i would just find it more and easier to find for scripting implementations that that findCommentStart method
is a abstract method that has its implementations in the various script types.

johan


On Sun, Sep 28, 2008 at 10:11 PM, Jae Gangemi <jgangemi@xxxxxxxxx> wrote:
hello all -

  support for 'todo' task tags has been added for the python plugin and is 99% done for the _javascript_ plugin. it still needs a comment scanner implementation that supports '//' as a comment. i believe the pdt folks may be working on this, which is why i have not investigated further (anyone from pdt care to comment?).

  i also created a mini tutortial that lists the steps one must complete to add this support which can be found here:
 
    http://wiki.eclipse.org/Adding_Todo_Task_Tag_Support

  i used snippets from the python plugin in the examples. if anyone wishes to tweak it further, feel free.

  let me know if there are any comments/questions/problems.

  thx!
 
--
-jae

_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev



Back to the top