I'm sorry, I know this has been asked before, but the other answers are not doing anything for me.
PhpStorm keeps using 4 spaces for indents, and it is driving me mad. The file is a .php file, and all the settings I know of are correctly set. I have checked these things:
1.) Editor | Code Style | 'Detect and use existing file indents' is not checked (and the file uses 2 spaces anyway)
2.) Editor | Code Style | PHP | 'Tab size' & 'Indent' are set to 2 spaces
3.) I have restarted PhpStorm
4.) I have closed and reopened the file.
5.) My PhpStorm is the most recent version, 2016.3.2
6.) There is only one .editorconfig in the path of the file, and here are its contents:
# Drupal editor configuration normalization
# #see http://editorconfig.org/
# This is the top-most .editorconfig file; do not search in parent directories.
root = true
# All files.
[*]
end_of_line = LF
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[composer.json]
indent_size = 4
I have also tried removing the last two lines, just out of paranoia, and after restarting PhpStorm again, it did nothing.
As it turn out it's a bug in PhpStorm:
"Tab size" value is ignored if php file isn't started with <?php i.e.:
#!/usr/bin/env drush
<?php
For those who are interested here is a ticket on PhpStorm's Issue Tracker: https://youtrack.jetbrains.com/issue/WI-34735 -- watch it (star/vote/comment) to get notified on any progress.
Also for newer IDE versions, check if .editorconfig config-file exists (in any directory of directory-chain leading to your script-file), because Settings from said config-file have higher priority, and will overwrite your IDE settings.
Related
I have strange problem connecting with PhpStorm IDE. I use version 2016.3.2 Build #PS-163.10504.2.
I love using Ctrl + Shift + N for searching files which I need to override. I have 2 project (one new, one old) and in old file searching works fine and in new search only for twig files and nothing else.
Is there any configuration I need to change?
Check filter -- the blue Funnel icon on the right top corner of that popup -- you may have selected to list files of certain types only.
Otherwise -- try universal File | Invalidate Caches... and restart IDE -- it usually helps in such "suddenly stop working" situations.
My local development environment based on Windows and my production environment based on Linux.
I have an issue about "line separators (CR, LF, CRLF)". Every time I got blank lines in my code.
Which line separator type to should I choose for prevent the blank lines?
I am working in this exact environment as well, except my development environment is also in Linux.
The aggravating problem I have run into is editing CRLF text files in the Linux environment, whether they were Apache files, or shell scripts. Mainly, I couldn't easily edit them in Linux through vi, which is unhappy with the CR. If you never do that, then it may not be a problem for you. But if you see blank lines in your code, it might be something similar.
For HTML and PHP, Apache running in the Linux environment has never complained when serving up files or reading configuration files in CRLF.
The other side of it, was that it was hard to wrangle PHPStorm. The related post #LazyOne provided works, but PHPStorm is stubborn if you have been using CRLF as I had when I switched this setting. I found I still needed to change files by hand at times, which you can do along the bottom right of the editor window. You will see CR, LF or CRLF and you can click and change the setting for the particular file loaded in the editor:
As a side note, if you use git, you can set up a .gitattributes file in the project directory with this:
# Set the default behavior to always be linefeed for linux
* text eol=lf
Which causes git to normalize to LF as it states in the git documentation:
Set to string value "lf"
This setting forces Git to normalize line endings to LF on checkin and
prevents conversion to CRLF when the file is checked out.
When I create a new project, I must edit the current project location each time, because our global projects are on:
~/Sites/
However, PHPStorm sets it default as:
~/PhpstormProjects/
How can I change the default location as mine?
There is no GUI for that.
PhpStorm should remember last used folder (when you successfully created new project) and use it by default for next one (does for me; although I'm using the same path since v1 .. maybe this was broken since then).
If it does not and if you have brave heart .. you can edit config file directly :)
PhpStorm v8 and earlier:
Close IDE
Open this file in any text editor: C:\Users\USERNAME\.WebIde80\config\options\ide.general.xml (path is for PhpStorm v8 on Windows 7; for other OS/versions please see this link: https://intellij-support.jetbrains.com/entries/23358108-Directories-used-by-the-IDE-to-store-settings-caches-plugins-and-logs )
File is very short -- just find <option name="lastProjectLocation" node and edit value attribute -- put desired path there
Save changes, Launch IDE and see if it worked for you.
PhpStorm v9 and newer: such setting is now located in recentProjectDirectories.xml file -- look for <option name="lastProjectLocation" value="LAST_PATH_HERE" /> entry.
There is a ticket asking for a GUI setting for this: https://youtrack.jetbrains.com/issue/WI-8839 -- watch it (star/vote/comment) to get notified on progress.
For default folder for "Open Folder" kind of dialogs -- follow IDEA-84622 ticket.
UPDATE 2018-05-25:
2018.2 will have a GUI field for that (Settings/Preferences | Appearance & Behavior | System Settings) -- see this comment.
Create the folder the you wanna use(Ex: /ProgramasBMO), and then go to:
1) File --> Settings (It will open a window)
2) Click on "System Settings"
3) Write the path to your folder
4) Done :)
I have an option trim_trailing_white_space_on_save turned on. And for some files I should prevent removing trailing white spaces, because they are important.
How to remove this behaviour for some files, e.g. *.dat?
Have you already tried to create a configuration file for that specific extension and put trim_trailing_white_space_on_save = false ?
Settings Files
Settings files are consulted in this order:
Packages/Default/Preferences.sublime-settings
Packages/Default/Preferences (< platform >).sublime-settings
Packages/User/Preferences.sublime-settings
< Project Settings >
Packages/< syntax >/< syntax >.sublime-settings
Packages/User/.sublime-settings
< Buffer Specific Settings >
In general, you should place your settings in Packages/User/Preferences.sublime-settings.
If you want to specify settings for a certain file type, for example, Python, you should place them in Packages/User/Python.sublime-settings.
http://www.sublimetext.com/docs/2/settings.html
In Sublime 3, just open any file with the extension you'd like to have specific settings for, and go to Preferences > Settings - Syntax Specific.
In my case I did it for Markdown (.md) and Sublime created a Markdown.sublime-settings file in which I added the following:
"trim_trailing_white_space_on_save": false,
In your case, for a .dat file, Sublime will create a Plain text.sulbime-settings file in which you can add the exact same setting.
I have installed MediaWiki (mediawiki-1.17.0) on Ubuntu 11.04, and it appears to be working fine. However, the location of the wiki is www.mysite.com/mediawiki-1.17.0/ which is a bit cumbersome. Instead, I would like the location to be www.mysite.com/wiki/.
I have tried renaming the folder, but this causes some configuration issues that lead to the wiki not being found.
How do I change the location of the wiki?
You have to edit your LocalSettings.php. In this file, go to the line no. 28 and change this to the below line:
//$wgScriptPath = "/mediawiki-1.17.0";
$wgScriptPath = "/wiki";
and change your folder name.
Source