From kdevelop-bugs Sat May 28 08:35:30 2005 From: kdevelop-bugs-admin () barney ! cs ! uni-potsdam ! de Date: Sat, 28 May 2005 08:35:30 +0000 To: kdevelop-bugs Subject: [Bug 106379] Support for extensionless filenames for source Message-Id: <20050528083530.30828.qmail () ktown ! kde ! org> X-MARC-Message: https://marc.info/?l=kdevelop-bugs&m=118306937307185 ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. http://bugs.kde.org/show_bug.cgi?id=106379 ------- Additional Comments From hattons globalsymmetry com 2005-05-28 10:35 ------- 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(part); if (rw_part) { KTextEditor::EditInterface *iface = dynamic_cast(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.