Re: [Qt-creator] Settings for naming conventions
On 01/14/2016 08:57 PM, Jochen Becher wrote: Hi Nikolai, the solution you prefer (= my first proposal) is of course the easiest implementation. I only wondered if naming conventions is really related that much to coding style (which is more about whitespaces and indentation) that we want to handle it with the same settings class. There is nothing yet in CppCodeStyleSettings, that's true. But in general naming conventions are regarded as part of the coding style: https://doc-snapshots.qt.io/qtcreator-extending/coding-style.html#class-member-names https://google.github.io/styleguide/cppguide.html#Naming http://llvm.org/docs/CodingStandards.html#name-types-functions-variables-and-enumerators-properly So I will go for your proposal. OK. Nikolai ___ Qt-creator mailing list Qt-creator@qt-project.org http://lists.qt-project.org/mailman/listinfo/qt-creator
Re: [Qt-creator] Settings for naming conventions
Hi Nikolai, the solution you prefer (= my first proposal) is of course the easiest implementation. I only wondered if naming conventions is really related that much to coding style (which is more about whitespaces and indentation) that we want to handle it with the same settings class. So I will go for your proposal. Thank you, Jochen Am Mittwoch, den 13.01.2016, 13:19 +0100 schrieb Nikolai Kosjar: > Hi again, > > let me enumerate your requirements and propose something addressing > those. > > > Requirements: > > R1. Global and per project settings > R2. API working on those settings, converting names > R3. Settings/API used by: > - Wizards > - Refactoring Code > - Text Editor to validate identifiers > > > Proposal: > > Enhance CppTools::CppCodeStyleSettings with the specific C++ settings > you need. This is fine since naming conventions are usually part of > coding styles/rules. This does not introduces anything in the text > editor, but uses the infrastructure that is provided by it and the > project explorer (CppCodeStyleSettings are managed by > CppCodeStylePreferences, which is a > TextEditor::ICodeStylePreferences). > Thus, you get R1 for free. > > For R2, just introduce and export your new class in cpptools. This > class > uses CppTools::CppCodeStyleSettings. > > Regarding R3: > CppCodeStyleSettings is already exported and can be used. > > * Wizards - The plugins of the wizard that wants to use the > settings/api > obviously needs to depend on cpptools. Is this a problem for the > wizards > you had in mind? > > * Refactoring Code - No problem since this is already in cpptools > itself. qmljstools depends on cpptools and thus could also access the > settings. > > * Text Editor to validate identifiers - A virtual function in e.g. > TextEditorWidget could serve this? And the specific editors have > access > to their settings. > > Something along the lines could also be done for QML/JS or other > languages (e.g. in the projects mode you can already switch the > language > for the coding style). > > Would this work? > > > Nikolai ___ Qt-creator mailing list Qt-creator@qt-project.org http://lists.qt-project.org/mailman/listinfo/qt-creator
Re: [Qt-creator] Settings for naming conventions
Hi again, let me enumerate your requirements and propose something addressing those. Requirements: R1. Global and per project settings R2. API working on those settings, converting names R3. Settings/API used by: - Wizards - Refactoring Code - Text Editor to validate identifiers Proposal: Enhance CppTools::CppCodeStyleSettings with the specific C++ settings you need. This is fine since naming conventions are usually part of coding styles/rules. This does not introduces anything in the text editor, but uses the infrastructure that is provided by it and the project explorer (CppCodeStyleSettings are managed by CppCodeStylePreferences, which is a TextEditor::ICodeStylePreferences). Thus, you get R1 for free. For R2, just introduce and export your new class in cpptools. This class uses CppTools::CppCodeStyleSettings. Regarding R3: CppCodeStyleSettings is already exported and can be used. * Wizards - The plugins of the wizard that wants to use the settings/api obviously needs to depend on cpptools. Is this a problem for the wizards you had in mind? * Refactoring Code - No problem since this is already in cpptools itself. qmljstools depends on cpptools and thus could also access the settings. * Text Editor to validate identifiers - A virtual function in e.g. TextEditorWidget could serve this? And the specific editors have access to their settings. Something along the lines could also be done for QML/JS or other languages (e.g. in the projects mode you can already switch the language for the coding style). Would this work? Nikolai ___ Qt-creator mailing list Qt-creator@qt-project.org http://lists.qt-project.org/mailman/listinfo/qt-creator
Re: [Qt-creator] Settings for naming conventions
Am Dienstag, den 12.01.2016, 10:19 +0100 schrieb Nikolai Kosjar: > On 01/09/2016 05:28 PM, Jochen Becher wrote: > > I would add the new settings to the cpptools plugin but I am not > > sure > > about the preferred design: > > > > 1. I could extend the coding style settings which are connected to > > the > > TextEditor by design (realization of a codiong style interface) but > > naming conventions are not aligned to the TextEditor in the same > > manner > > as coding style are. > > > > 2. I could implement a new settings class which is loosely coupled > > to > > the cpptools plugin like e.g. the todo plugin settings. > > > > 3. Or I could implement a new settings class which is strongly > > coupled > > to the cpptools plugin. > > > > What do you prefer? Do you have a different preferred design in > > mind? > > Could you elaborate a bit on 2. and 3.? What would be the difference? > How does "strongly coupled" look like in this case? Ad 2: ToDoPlugin uses ProjectExplorer::Project::setNamedSettings() to set its settings on a project. ProjectExplorer::Project has no dependency on ToDoPlugin. Ad 3: cpptools plugin knows a number of settings (e.g. CppToolsSettings and CppCodeStyleSettings). If I follow (2) I could write a new plugin that supports naming convents. Every client of the API needs a dependency to the plugin (which could be an optional dependency if the plugin has a fall-back if the NamingConvention plugin is disabled). If I follow (3) I add NamingConventionSettings to cpptools plugin. This has the advantage that the naming conventions will be available for most use cases (e.g. C++ wizards and refactorings) without any need for handling optional plugins and fall-back code. It has the disadvantage that extending the settings for other languages (e.g. QML/Javascript) will not work with this design. I do need a naming convention settings class, global option page, project settings widget, some model classes and a controller class and a boundary class for the public API. About 8 classes in total. Will make the cpptools plugin even larger. I like (2) because it is a clean plugin based design and can be extended for other languages than C++. I like (3) because it is easier implementing both the settings and the clients of the naming conventions. > The integration into current code style settings as seen by the user > in > the options dialog (Menu: Tools > Options > C++ > Tab: Code Style) > and > the projects mode (Projects Mode: Code Style) seems appropriate. > Since > CppCodeStylePreferences and CppCodeStyleSettings are already > exported, I > don't see a problem enhancing those. This is for C++. > > Now, if there is substantial overlap with QML / Qt Quick or other > languages, this probably should be put somewhere into the text editor > itself. For instance, we put all the highlighting settings into one > central place (Options > Text Editor > Fonts & Colors), covering > general > thingies, but also C++ and QML. This corresponds to your first > option? Placing the UI is mostly independant from the source code design, see ToDo Plugin. It is implemented as an extra plugin, integrates into the project settings mode but has its own page in options dialog. Naming conventions have not much to do with the text editor (in contrast to code style which is very much related to it). As a user I would expect to have naming convention as part of C++ settings and Qt Quick settings (for QML/Javascript). > Nikolai Regards, Jochen ___ Qt-creator mailing list Qt-creator@qt-project.org http://lists.qt-project.org/mailman/listinfo/qt-creator
Re: [Qt-creator] Settings for naming conventions
On 01/09/2016 05:28 PM, Jochen Becher wrote: Hi, I would like to implement naming convention settings for QtCreator. For many C++ element identifiers (e.g. namespace, class, attributes, methods, getter, setters, boolean getters, local variables etc) the user can define a naming convention build from a prefix, a name style (e.g. lowerCamelCase, UpperCamelCase etc) and a suffix. This settings can be defined globally and per project. A simply API allows fetching the base name of an identifier (a list of strings building the middle part of the identifier) or converting an identifier from one naming convention into another. The settings should be used in wizards, refactorings (e.g. create setters and getters from attributes) or validating identifiers in text editor. Sounds great! I would add the new settings to the cpptools plugin but I am not sure about the preferred design: 1. I could extend the coding style settings which are connected to the TextEditor by design (realization of a codiong style interface) but naming conventions are not aligned to the TextEditor in the same manner as coding style are. 2. I could implement a new settings class which is loosely coupled to the cpptools plugin like e.g. the todo plugin settings. 3. Or I could implement a new settings class which is strongly coupled to the cpptools plugin. What do you prefer? Do you have a different preferred design in mind? Could you elaborate a bit on 2. and 3.? What would be the difference? How does "strongly coupled" look like in this case? The integration into current code style settings as seen by the user in the options dialog (Menu: Tools > Options > C++ > Tab: Code Style) and the projects mode (Projects Mode: Code Style) seems appropriate. Since CppCodeStylePreferences and CppCodeStyleSettings are already exported, I don't see a problem enhancing those. This is for C++. Now, if there is substantial overlap with QML / Qt Quick or other languages, this probably should be put somewhere into the text editor itself. For instance, we put all the highlighting settings into one central place (Options > Text Editor > Fonts & Colors), covering general thingies, but also C++ and QML. This corresponds to your first option? Nikolai ___ Qt-creator mailing list Qt-creator@qt-project.org http://lists.qt-project.org/mailman/listinfo/qt-creator
[Qt-creator] Settings for naming conventions
Hi, I would like to implement naming convention settings for QtCreator. For many C++ element identifiers (e.g. namespace, class, attributes, methods, getter, setters, boolean getters, local variables etc) the user can define a naming convention build from a prefix, a name style (e.g. lowerCamelCase, UpperCamelCase etc) and a suffix. This settings can be defined globally and per project. A simply API allows fetching the base name of an identifier (a list of strings building the middle part of the identifier) or converting an identifier from one naming convention into another. The settings should be used in wizards, refactorings (e.g. create setters and getters from attributes) or validating identifiers in text editor. I would add the new settings to the cpptools plugin but I am not sure about the preferred design: 1. I could extend the coding style settings which are connected to the TextEditor by design (realization of a codiong style interface) but naming conventions are not aligned to the TextEditor in the same manner as coding style are. 2. I could implement a new settings class which is loosely coupled to the cpptools plugin like e.g. the todo plugin settings. 3. Or I could implement a new settings class which is strongly coupled to the cpptools plugin. What do you prefer? Do you have a different preferred design in mind? Regards, Jochen ___ Qt-creator mailing list Qt-creator@qt-project.org http://lists.qt-project.org/mailman/listinfo/qt-creator