Refactoring in "plain-file" projects



  • Often I use QtCreator to edit projects that are no C/C++. Sometimes they are simply plain files, i.e. YAML files. So I create a new project selecting the options to import existing one, that basically allows you to choose a folder and select which files in there should be imported in the QtCreator project.

    It's understandable that there are no refactoring options, but I wonder if there's a way to "fool" the system and get get they working. What I what to do is a smarter search/replace feature.

    Example:
    Let's say my project is composed of these files:

    main.yaml
    module1.yaml
    module2.yaml
    

    In one file I might have something like this:

    sensorGroup:
      name: Sensors
    

    and in the others:

    entities:     
          - group.sensorGroup
    

    Now if I want to change "sensorGroup" to something else I have to manually search & replace in all files the same string. If they are a lot it's time-consuming and error prone.
    With "refactoring" I would highlight sensorGroup in any file, right click -> rename to whatever and that's done!

    Is it possible?


  • Qt Champions 2017

    @Mark81
    Hi
    I dont think its possible as it has no concept of what
    it is and cant find the use of it. Its just text

    However, search and replace can use regular expressions so
    you can make it find only the right ones if you write the proper regexp.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.