Author Topic: Disable Code Completion for .txt files?  (Read 4177 times)

Offline Val

  • Single posting newcomer
  • *
  • Posts: 2
Disable Code Completion for .txt files?
« on: September 13, 2013, 07:28:25 pm »
Hello, does anyone know if this is possible/how it can be configured?  I love code completion for my code files, but it gets in the way when I'm editing text/documentation files in the editor.

Thanks!

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Disable Code Completion for .txt files?
« Reply #1 on: September 13, 2013, 09:54:07 pm »
You should modify the plugin CC in the current version of the code.
But it might be possible in the future, when Alpha finishes his improvements to the CC.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Val

  • Single posting newcomer
  • *
  • Posts: 2
Re: Disable Code Completion for .txt files?
« Reply #2 on: September 14, 2013, 06:20:10 am »
Thanks for the info.

I thought this would be horrible but turned out to be pretty easy and got this working as I want it pretty fast.

If anyone else is interested, I did the following (I'm developing in windows):

-downloaded the code::blocks source (codeblocks_12.11-1.tar.gz)
-downloaded the pre-compiled wxWidgets, version 2.8.12
(Both are available from the main download page)

- unpacked both of these archives
- Read the BUILD documentation for how to build everything in Win32 (which compiled without issue in codeblocks)

- Looked around at the code completion code for a bit then decided to try my luck by modifying:

codecompletion.cpp:CodeCompletion::CodeComplete()

                    // if its sourcecode/header file and a known fileformat, show the corresponding icon
                    if (isC && strLang==_T("C/C++"))
                        ed->GetControl()->RegisterImage(iidx, wxBitmap(cpp_keyword_xpm));
                    else if (isC && strLang==_T("D"))
                        ed->GetControl()->RegisterImage(iidx, wxBitmap(d_keyword_xpm));
                    else
-                        ed->GetControl()->RegisterImage(iidx, wxBitmap(unknown_keyword_xpm));
+                        return 0;

- rebuild everything (probably just needed the code completion target but w/e)
- ran the src/update.bat

- closed codeblocks app
- swapped out:
   .../share/CodeBlocks/codecompletion.zip
   .../share/CodeBlocks/plugins/codecompletion.dll

for the ones I just built (found in the output dir)

- restarted CodeBlocks
- profit

So basically this disables code completion for non C/C++ and D files, which is acceptable for my usage.  Thanks!