How to display certain file types with a particular grammar in a specific project?

In a specific project, I would like to be able to display certain file types (for example, .txt files) with a particular grammar (for example, source.cpp) without having to select each time manually file by file after opening them.

As I can’t edit the main config.cson to do this (it’s only for a specific project, not for a general use as described in Customizing Language Recognition), I have tried to use the project-manager package by setting a dedicated project.cson file, but it seems that it’s not functional at the moment.

Would someone have other options to consider in order to achieve this kind of use?

The file-types package expands the custom language recognition functionality and supports matching with regular expressions, which you can use to look for your project folder.

Sounds interesting.
But it seems that this package uses config.cson to configure the grammar highlighting, so it would change the entire default behavior and not only the settings for a specific project.

If your specific project is in a specific directory, you can change the behavior for that directory and it is changed for that specific project and nothing else.

1 Like

By the way, I finally understood what you mean by change the behavior for that directory. In my case, I did not need any file as config.cson or project.cson, but I had to add manually settings into main projects.<user>.cson.

Thanks.

1 Like

In my opinion, the proper and easier way to do this is using atomic-management and in the project folder create the .atom/config.cson file that contains

'*':
  core:
    customFileTypes:
      'source.cpp': [
        'txt'
      ]

base on the official documentation