Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [Dltk-dev] IProblemFactory and IProblemIdentifierFactory


  hrm - after a little more hunting around, i see that the the DefaultProblem and the ValidatorReporter both have some code that appears to handle this, although the DefaultProblem implementation appears to be more for just debugging/information purposes b/c it's not used by anything.

  it looks like the fix should be to add the offset calculation into the DefaultProblemFactory and move the code that sets the start/end values on the marker out of the ProblemCollector and into the DefaultProblemFactory, or perhaps better, only set them on the marker in the ProblemCollector if it sees they aren't already present.

On Wed, Jun 6, 2012 at 11:51 AM, Alexey Panchenko <alex.panchenko@xxxxxxxxx> wrote:
As I understand you need basically 2 loops to skip leading and
terminating whitespaces.
And I don't think such utility already exists.

On Wed, Jun 6, 2012 at 10:43 PM, Jae Gangemi <jgangemi@xxxxxxxxx> wrote:
>
>   ok - thanks for that explanation.
>
>   another quick question (i hope) - i'm doing this when i go to create a
> problem marker:
>
>         IProblemReporter reporter = context.getProblemReporter();
>         ISourceLineTracker tracker = context.getLineTracker();
>
>         ScriptResult result = executor.execute(args,
> context.getContentsAsCharArray());
>
>         for (CompilerOutput output : parser.parse(result.stderrLines))
>         {
>             if (!output.isLocal() || output.isCompilationAborted())
>             {
>                 continue;
>             }
>
>             ErrorsAndWarnings.ErrorOrWarning eom =
> output.getErrorOrWarning();
>
>             ProblemSeverity severity = getSeverity(eom);
>             ISourceRange range = tracker.getLineInformation(output.lineNo -
> 1);
>
>             int end = range.getOffset() + range.getLength();
>             PerlBuildProblem problem = new PerlBuildProblem(output.message,
> severity, range.getOffset(), end, output.lineNo - 1);
>
>             reporter.reportProblem(problem);
>         }
>
>   the issue i'm seeing is when the 'problem' is presented in the editor, the
> 'underline' includes leading and trailing white space, which i see is
> expected b/c the ISourceRange object includes it.
>
>   i'm believe i can calculate the correct offsets b/c i have the contents
> array and i know the initial starting position, but wanted to see if there
> was any utility code already in existence to do this. i looked around but
> it's very possible i missed it.
>
>
> On Wed, Jun 6, 2012 at 11:26 AM, Alexey Panchenko <alex.panchenko@xxxxxxxxx>
> wrote:
>>
>> Hi Jae,
>>
>> IProblemFactory is invoked when creating problem markers.
>>
>> IProblemIdentifierFactory is used to decode problem id from string
>> into corresponding enum entry. It is invoked when problem markers are
>> read, e.g. into objects used to display problem annotations in the
>> editor (so quick fix processors deal with the enum entries as problem
>> ids, etc).
>>
>> typical implementation is as follows:
>>
>> public class _javascript_ProblemFactory implements IProblemIdentifierFactory
>> {
>>        public IProblemIdentifier valueOf(String localName) throws
>> IllegalArgumentException {
>>                return _javascript_Problems.valueOf(localName);
>>        }
>>        public IProblemIdentifier[] values() {
>>                return _javascript_Problems.values();
>>        }
>> }
>>
>> Regards,
>> Alex
>>
>> On Wed, Jun 6, 2012 at 2:57 AM, Jae Gangemi <jgangemi@xxxxxxxxx> wrote:
>> > hello all -
>> >
>> >   could someone please explain how those two interfaces relate to each
>> > other?
>> >
>> >   thanks!!
>> >
>> > --
>> > -jae
>> >
>> > _______________________________________________
>> > dltk-dev mailing list
>> > dltk-dev@xxxxxxxxxxx
>> > https://dev.eclipse.org/mailman/listinfo/dltk-dev
>> >
>> _______________________________________________
>> dltk-dev mailing list
>> dltk-dev@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/dltk-dev
>
>
>
>
> --
> -jae
>
> _______________________________________________
> dltk-dev mailing list
> dltk-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/dltk-dev
>
_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev



--
-jae

Back to the top