Author Topic: CC with keywords  (Read 4184 times)

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
CC with keywords
« on: March 06, 2012, 11:18:54 pm »
I know in previous versions, CC was able to provide suggestions for non-C-like languages via keyword sets.  However, revision 7862 (CC: applied patch by Darius Markauskas (darmar) to allow foreign CC plugin to take over (basically CC skips file types other than C / C++ now)) seems to have revoked this behavior.  Is there a workaround/option I could use to get this functionality back?

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5916
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: CC with keywords
« Reply #1 on: March 07, 2012, 06:36:59 am »
In the CC option dialog->c/c++ parser(adv) panel, there are some entry that you can specify your own file format support by CC.

Which means, if you custom file is a.abc, you can add "abc" there(no double quote).
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: CC with keywords
« Reply #2 on: March 07, 2012, 10:47:31 pm »
I had looked at that option, however, it has the side effect of additionally trying to parse the files (instead of only supplying keywords from the lexer).
My personal preference in this situation would be to return to CC's prior behavior of keyword suggestion for unsupported file types, adding a blacklist (instead of the current whitelist) which the user - or other plugins - could modify as needed.  (This setting would be separate from the one you mentioned, which tells CC what types of files to parse.)

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5916
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: CC with keywords
« Reply #3 on: March 12, 2012, 03:37:09 am »
I had looked at that option, however, it has the side effect of additionally trying to parse the files (instead of only supplying keywords from the lexer).
Yes, adding the "abc" to that option will let our CC parser to parse them.

Quote
My personal preference in this situation would be to return to CC's prior behavior of keyword suggestion for unsupported file types, adding a blacklist (instead of the current whitelist) which the user - or other plugins - could modify as needed.  (This setting would be separate from the one you mentioned, which tells CC what types of files to parse.)
I'm not fully understand this idea?
Currently, we have a whitelist in our CC option dialog. But what does "blacklist" used for? You mean the files in blacklist can give some "predefined suggestion texts"? event sent to blacklist files will be handled from other plugins?
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: CC with keywords
« Reply #4 on: March 12, 2012, 10:47:13 am »
CC will not parse files to offer the keywords from lexers (lexers are a scintilla thing). I am aware of the drawback described here and I have already discussed with darmar about what we could do best to re-enable that option.

@ollydbg:
The things is: It was the fallback solution in CodeCompletion::CodeComplete(), starting here:
Code
                EditorColourSet* theme = ed->GetColourSet();
                if (theme)

However, that this fired for non-C/C++ files was nice, but technically wrong. So we have to do it properly. The way it was will not return as it was wrong.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: CC with keywords
« Reply #5 on: April 07, 2012, 02:08:23 pm »
Works again in trunk now and is compatible with the concept of several CC plugins. Credits go to Darius, thanks a lot. :D
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: CC with keywords
« Reply #6 on: April 07, 2012, 03:47:53 pm »
Thank you Darius!

(Hmm, it appears the trunk was just merged; I had better prepare myself for increased awesomeness upon rebuild.)