Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Codan launch modes

Marc-Andre, your suggestion works well, internal states seems to be good - traces are the same than mine - but the behaviour and the UI panels are wrong, as shown in my first post.

First and second problems remains.

Le 17/03/2019 à 15:14, Marc-Andre Laperle wrote :
Hi!

I don’t remember exactly how this works, but here is an example from ProblemBindingChecker.java:

	@Override
	public void initPreferences(IProblemWorkingCopy problem) {
		super.initPreferences(problem);
		// This checker should not run on full or incremental build
		getLaunchModePreference(problem).enableInLaunchModes(CheckerLaunchMode.RUN_AS_YOU_TYPE,
				CheckerLaunchMode.RUN_ON_DEMAND);
	}

Maybe you could give this a try?

Marc-André

On Mar 17, 2019, at 10:04 AM, Aubin Mahé <aubin.mahe@xxxxxxxxxx> wrote:

Hello,

I've created a checker plug-in based on CodAn and try to set up launch modes.

Checker inherits org.eclipse.cdt.codan.core.cxx.model.AbstractIndexAstChecker and overrides initPreferences because I haven't found any extension point dedicated to this usage.

  @Override
  public void initPreferences( IProblemWorkingCopy problem ) {
      final LaunchModeProblemPreference lmpp =
          getLaunchModePreference( problem );
      lmpp.addLaunchMode( CheckerLaunchMode.RUN_ON_FULL_BUILD,
          Boolean.FALSE );
      lmpp.addLaunchMode( CheckerLaunchMode.RUN_ON_INC_BUILD ,
          Boolean.FALSE );
      lmpp.addLaunchMode( CheckerLaunchMode.RUN_ON_DEMAND    ,
          Boolean.TRUE  );
      lmpp.addLaunchMode( CheckerLaunchMode.RUN_ON_FILE_OPEN ,
          Boolean.FALSE );
      lmpp.addLaunchMode( CheckerLaunchMode.RUN_AS_YOU_TYPE  ,
          Boolean.TRUE  );
      lmpp.addLaunchMode( CheckerLaunchMode.RUN_ON_FILE_SAVE ,
          Boolean.FALSE );
      System.out.println( problem.getName() + ": "
          + problem.getPreference());
  }

At runtime, console shows success of initialization:

    ...
    RAF-LNG-020: [org.eclipse.cdt.codan.core.param.FileScopeProblemPreference@4eddffcf, [(boolean)RUN_ON_FULL_BUILD=false, (boolean)RUN_ON_INC_BUILD=false, (boolean)RUN_ON_DEMAND=true, (boolean)RUN_ON_FILE_OPEN=false, (boolean)RUN_AS_YOU_TYPE=true, (boolean)RUN_ON_FILE_SAVE=false], (string)suppression_comment]
    RAF-LNG-030: [org.eclipse.cdt.codan.core.param.FileScopeProblemPreference@25264061, [(boolean)RUN_ON_FULL_BUILD=false, (boolean)RUN_ON_INC_BUILD=false, (boolean)RUN_ON_DEMAND=true, (boolean)RUN_ON_FILE_OPEN=false, (boolean)RUN_AS_YOU_TYPE=true, (boolean)RUN_ON_FILE_SAVE=false], (string)suppression_comment]
    ...

First problem:

  Window -> Preferences -> C/C++ -> Code Analysis -> Customize Selected (button) -> Launching (tab) shows

    [X] Run as you type
    [ ] Run on file open
    [ ] Run as file save
    [X] Run on incremental build
    [X] Run on full build
    [X] Run on demand

Second problem:

    When a file is opened my checker is called and report errors.

How can I really tune launch modes?
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/cdt-dev

_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/cdt-dev



Back to the top