>can I configure this setting for specific file after I clicked the popup on top?
Please clarify what you want to do as it's not 100% clear (at least for me).
But in general:
Indentation settings are per file type (and not per individual file) and can be found in "Settings/Preferences | Editor | Code Style | SPECIFIC FILE TYPE"
The message on screen means that your Code Style is set to use 4 spaces and this file uses tabs. Once you clicked "Indent with 4 spaces" link it should have re-indented whole file with current settings
There is separate option in Code Style -- "Detect and use existing file indents for editing" (hint: you can use search box to find options) that instructs IDE to use indents detected in this file regardless of your indent settings for this file type
Just under that option there is another one -- "Show notifications about detected indents" -- message that you are seeing is the result of that option
There is EditorConfig plugin (not bundled with PhpStorm by default). If installed and enabled (there will be additional option on the bottom of Code Style screen) IDE will use certain formatting rules (indents in particular) from .editorconfig files located in your project.
Settings from .editorconfig files will override your settings set in IDE's Code Style screen
.editorconfig files allow to set rules on per file basis (as well as for file types/file extensions that do not have dedicated entry in Code Style)
>So is there any way to rise that popup from screenshot again on demand for changing indentation of specific file?
AFAIK -- no (at least I do not know about such list of files or a way of bringing that message on demand).
Have you tried reverting your file back to original form (before indents were changed) and then re-opening the file again? You can use Local History for that if normal Undo is no longer available (e.g file was saved & closed).
BTW -- "Menu | Edit | Convert Indents" -- you can also try that (it works on selected lines only; to process whole file you have to select all lines first).
If in that popup I chose 'tabs' by mistake and then converted indents using 'Convert to spaces' then new lines will be still with tabs. I haven't tried it right now but I remember doing this formerly
I guess no, let me describe situation in more details.
Let's say I downloaded some external css file and put him in the project fake1.css In code style I have spaces, this file contain tabs and I wan't add some lines to new file with tabbing too. I open file, press enter and add new line, it's ok, it's added with tabs http://prntscr.com/byxgsf Then popup rises and suggests to select indentation. By mistake I press "Indent with 4 spaces" while I wanted "OK" (tabs).
I finish my line and press enter to add the new one http://prntscr.com/byxhfj it's added with spaces (as I selected by mistake)
Fine, just what I wanted Then I'm trying to add one more line, press enter and I have spaces again http://prnt.sc/byxkwe , I have to perform Edit->ConvertIndents -> To tabs again and again
But if I haven't mistakenly chosen "by spaces" here http://prnt.sc/byxgsf everyting would have been fine, I wouldn't have to perfom Edit->ConvertIndents -> To tabs each time or to keep in mind and perform this after all changes have been done.
So my question was can I repeat rising this popup http://prnt.sc/byxgsf again after I have already made a choice (or configure file indentation for specific exceptional file in any other way (all another css for example has '4 spaces')) From your answers I understood that there isn't such a way
I may only suggest to close that file (better, whole IDE) and reopen it again so that auto-detection may run on this file again.
If it does not bring that dialog/message .. then I do not know where this file is saved (a list where it would say: "user said use 4 spaces for his file instead of autodetected style").
I may only suggest to look trough files in .idea subfolder (your project settings) while project is closed in IDE. I do not think that such list (if it exists) would be saved on IDE-wide level.
The ways to change concrete file indentation are not clear, why there are no per file indentation configuration option? Only one clear way to set file indentation is in popup.
There similar features like file encoding or line breaks.... but no indentation.
It's really disappoint me and I am going frustrating
Hi there,
>can I configure this setting for specific file after I clicked the popup on top?
Please clarify what you want to do as it's not 100% clear (at least for me).
But in general:
There is EditorConfig plugin (not bundled with PhpStorm by default). If installed and enabled (there will be additional option on the bottom of Code Style screen) IDE will use certain formatting rules (indents in particular) from .editorconfig files located in your project.
For example, I have 4 spaces indentation, I copy some new file with tabs indentation, open it, have popup from screenshot .
By mistake I click 'Indent with 4 spaces' while I wanted with tabs ('Ok' option).
After click popup disappers.
In Settings->Code style i can change indentation for all files, not the specific one I've been just editing.
So is there any way to rise that popup from screenshot again on demand for changing indentation of specific file?
>So is there any way to rise that popup from screenshot again on demand for changing indentation of specific file?
AFAIK -- no (at least I do not know about such list of files or a way of bringing that message on demand).
Have you tried reverting your file back to original form (before indents were changed) and then re-opening the file again? You can use Local History for that if normal Undo is no longer available (e.g file was saved & closed).
No I haven't tried this, I just thought if there is such popup maybe there is an option to call it again.
Well if there is not, it's ok too, it's not so critical.
Thanks for your replies.
BTW -- "Menu | Edit | Convert Indents" -- you can also try that (it works on selected lines only; to process whole file you have to select all lines first).
If in that popup I chose 'tabs' by mistake and then converted indents using 'Convert to spaces' then new lines will be still with tabs. I haven't tried it right now but I remember doing this formerly
Hello,
You can do Code > Reformat Code on that file and after that new lines will have the same indentation as configured in Code Style.
Would it be suitable?
I guess no, let me describe situation in more details.
Let's say
I downloaded some external css file and put him in the project fake1.css
In code style I have spaces, this file contain tabs and I wan't add some lines to new file with tabbing too.
I open file, press enter and add new line,
it's ok, it's added with tabs http://prntscr.com/byxgsf
Then popup rises and suggests to select indentation.
By mistake I press "Indent with 4 spaces" while I wanted "OK" (tabs).
I finish my line and press enter to add the new one http://prntscr.com/byxhfj
it's added with spaces (as I selected by mistake)
Ok, I add this rule http://prntscr.com/byxhs7
and try converting idents manually by Edit->ConvertIndents -> To tabs
http://prntscr.com/byxhy0
Fine, just what I wanted
Then I'm trying to add one more line, press enter and I have spaces again http://prnt.sc/byxkwe , I have to perform Edit->ConvertIndents -> To tabs again and again
But if I haven't mistakenly chosen "by spaces" here http://prnt.sc/byxgsf everyting would have been fine, I wouldn't have to perfom Edit->ConvertIndents -> To tabs each time or to keep in mind and perform this after all changes have been done.
So my question was can I repeat rising this popup http://prnt.sc/byxgsf again after I have already made a choice (or configure file indentation for specific exceptional file in any other way (all another css for example has '4 spaces'))
From your answers I understood that there isn't such a way
I may only suggest to close that file (better, whole IDE) and reopen it again so that auto-detection may run on this file again.
If it does not bring that dialog/message .. then I do not know where this file is saved (a list where it would say: "user said use 4 spaces for his file instead of autodetected style").
I may only suggest to look trough files in .idea subfolder (your project settings) while project is closed in IDE. I do not think that such list (if it exists) would be saved on IDE-wide level.
ok, thanks
Hello,
The ways to change concrete file indentation are not clear, why there are no per file indentation configuration option? Only one clear way to set file indentation is in popup.
There similar features like file encoding or line breaks.... but no indentation.
It's really disappoint me and I am going frustrating
Because it's considered to be a poor practice to use different indentation characters in the same file type within one project.
Please vote: https://youtrack.jetbrains.com/issue/IDEA-155090
The above linked issue will be fixed and released in the 2018.3 release!
Upgrading now!!