Mark file as plain text to exclude it from code completion and navigation

Sometimes you may want to exclude just a single file from the project so that code completion and navigation would not work for it. Examples include minified (compressed) PHP/JavaScript files which duplicate the code in other non-compressed files. It is possible now starting from the first PhpStorm/WebStorm 2.1 EAP build. There is a new “Mark as Plain Text” menu item in Project Tree context menu for files:

Once marked as plain text, the file is not used anymore for code completion and navigation and is shown as plain text with a special icon: 

You can mark the file with its original type using the same context menu at any time:

Thus, you have a full control of what files should be ignored by IDE’s language support. It may help solve the problems like the one described in WI-322 regarding Yii framework support, about yiilite.php file exclusion.

Of course you may find many other useful scenarios for this feature. Let us know what you think of it and how you use it.

Develop with pleasure!
-JetBrains Web IDE Team

This blog is permanently closed.

For up-to-date information please follow to corresponding WebStorm blog or PhpStorm blog.

 
This entry was posted in Cool Feature, PhpStorm, WebStorm and tagged , , , . Bookmark the permalink.

10 Responses to Mark file as plain text to exclude it from code completion and navigation

  1. Nils Luxton says:

    Amazing. What an elegant solution to a problem that has plagued me for many years!

    I have to say I’m really impressed with this latest EAP; I’m continually impressed with the amount of functionality that gets added to PhpStorm – and by the speed that it gets added!

    Keep up the great work, guys!

  2. Sam Dark says:

    Nice solution. Thanks.

  3. koubel says:

    Nice, smart and helpful

  4. JMather says:

    I don’t know if this will be seen but…

    Could we get this option to apply to an entire directory recursively?

    symfony has a lot of ‘template’ directories that cause issues…

    Or perhaps a way to flag one class as ‘this is the class you should always resolve to’ so that I could set my lib/form/BaseForm.class.php to always win out in a battle with other BaseForm classes.

  5. Daniel Shaw says:

    In WebStorm, I have JavaScript file marked as plain text that I cannot revert. Right clicking provides no context menu to Mark as JavaScript. Suggestions?

    Daniel Shaw
    @dshaw

    • rustam.vishnyakov says:

      If this is the case, it’s definitely a bug and it would be good to report it at http://youtrack.jetbrains.net. Attaching some screenshots and maybe steps to reproduce the problem would be helpful.
      As a workaround you can find .WebIde10/config/options directory, open plainTextFiles.xml and delete the line with the file in question. Make sure you take a backup copy first!

      • Matt says:

        Hi rustam,

        I experienced the same issue by misclicking something in the ‘new’ context menu in the Project sidebar. ‘Mark as PHP’ and ‘Mark as plain text’ were both missing from the context menu.

        Cannot replicate, unfortunately, but was able to resolve by editing C:\Users\[username]\.WebIde10\config\options\filetypes.xml

        Cheers

  6. Dziamid says:

    In symfony it is handly to mark cache/{appname}/prod/config_core_compile.php as plain text as it includes many classes in itself and mess up with the code completion.

  7. jlam says:

    It’s not working for JS files. I accidentally marked it as plain text, but opening the context menu again it doesn’t have anything after “Delete” as it should’ve been.

    Webstorm 3.0.3 Any help appreciated!

  8. rustam.vishnyakov says:

    @jlam
    I think it makes sense to submit an issue to http://youtrack.jetbrains.net with a screenshot of a context menu which you get for .js file marked as plain text. See also my reply above to Daniel for the quick workaround. Any steps to reproduce this issue would be definitely very helpful.

Comments are closed.