Summary: | Support for extensionless filenames for source | ||
---|---|---|---|
Product: | [Applications] kdevelop | Reporter: | Steven T. Hatton <hattons> |
Component: | general | Assignee: | kdevelop-bugs-null |
Status: | CLOSED FIXED | ||
Severity: | wishlist | ||
Priority: | NOR | ||
Version: | git master | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: |
Description
Steven T. Hatton
2005-05-27 15:24:39 UTC
http://www.kdevelop.org/HEAD/doc/api/html/astyle__part_8cpp-source.html Just looking at the one part of this problem related to AStyle, I can see changing this would require a fundamental change in how file types are currently determined. Or, at least overloading functions throughout KDevelop. My own inclination is that having every component determine the type of file it's working with is not an ideal design. It seems preferable to have one component determine file type, and then pass that information on to "clients". So, for example, rather than passing the KParts::Part, and determining it's type by examining the file names directly, there could either be a globally available function to determine file type called by functions such as activePartChanged to determine the type of file, or KPart could have the functionality built in. void AStylePart::activePartChanged(KParts::Part *part) { bool enabled = false; KParts::ReadWritePart *rw_part = dynamic_cast<KParts::ReadWritePart*>(part); if (rw_part) { KTextEditor::EditInterface *iface = dynamic_cast<KTextEditor::EditInterface*>(rw_part); if (iface) { QString extension = rw_part->url().path(); int pos = extension.findRev('.'); if (pos >= 0) extension = extension.mid(pos); if (extension == ".h" || extension == ".c" || extension == ".java" || extension == ".cpp" || extension == ".hpp" || extension == ".C" || extension == ".H" || extension == ".cxx" || extension == ".hxx" || extension == ".inl" || extension == ".tlh" || extension == ".moc" || extension == ".xpm" || extension == ".diff"|| extension == ".patch" || extension == ".hh" || extension == ".cc" || extension == ".c++" || extension == ".h++") enabled = true; } } _action->setEnabled(enabled); } In addition to the options of looking at the filename extension, and the mode specification, it might be reasonable to determine file type by registering a particular file as source when it appears in a #include of a known source file. Of course that would require having it in the include path, and having KDevelop examine the include path. SVN commit 611652 by webb: BUG: 106379 Option to set the file type to enable the Edit/Format menu. (RMB context menu continues to ignore this setting) Bug: 102705 Option in formatter settings to format a selection of files. M +81 -26 astyle_part.cpp M +3 -1 astyle_part.h M +79 -1 astyle_widget.cpp M +1 -0 astyle_widget.h M +350 -139 astyleconfig.ui Option in Project/Project Options/Formatting/General/Files TO format Can set * to allow any file to be formated. |