IntelliJ: Specify per-project tab size - tabs

Is there a way to set the tab size in IntelliJ for a single file only, or at most for a single project?
I use a tab size of 3 for all my code; however, I'm collaborating on a project with an author who prefers a tab size of 4. Is there a way to set the tab size to 4 for only those files that are part of this project?

Open the Settings dialog by navigating to File->Settings. Under Project Settings [yourproject] on the left side of the dialog, navigate to Code Style->General. The Tab size is configurable on that pane, and the value you provide applies only to the project named yourproject.

for those who can't find project specific setting
press Command + , will give you the preference you need

You can set a global format for the project and "reformat code" to conform to each one's preferred style.
The problem will be your version control system. If you oil can back and forth between 3 and 4 spaces you'll never be able to see meaningful changes.
Best to settle on one standard and stick to it.
The idea of a private project isn't clear to me. It comes down to your version control system. If it's possible to check code in and out so that tab size doesn't affect commits, then I'd say you can be independent. If you share the common code by adding a compiled 3rd party JAR, then I'd say you can be independent.

This is not an exact answer to your problem, but IntelliJ can currently (4/2013) "only" handle per-language tab-settings, which is - to be honest - totally okay as language and file type are usually "the same". So this your solve your problem.
You can find the setting in File -> Settings -> Project Settings -> Code Style -> >YOUR LANGUAGE.

Related

How to align code, in PhpStorm / Intellij, using tabs (and not spaces)

I'm trying to setup PhpStorm, so I can simply press: "Reformat Code" ( Option CMD L), before each save - and then it'll make everything look right.
But I have this case, where I don't know how to make PhpStorm make the code right.
This is the code:
As you can see, then indentation is with tabs, but the aligning of the characters are with spaces.
I want it to look like this:
It would be cool to get the solution. But it would be even cooler to be able to figure out, how I could have found the solution myself.
Further info / idea: There is a Php Codesniffer from Squizlabs implemented. So I can fix is automatically by running a sniff fix-command. It would be pretty cool, to be able to automatically setup PhpStorm's Code style settings, to correspond with Squizlabs styles, without having to gradually tune the settings one thing at the time. But I haven't found that functionality.
Solution attempt 1: Read through all Settings >> Editor >> Code style >> PHP
I couldn't find anything that resembled this.
Solution attempt 2: Disable .editorconfig
I've read quite a bit about .editorconfig and it doesn't have these nitty-gritty functions here (as aligning equal signs).
But to make sure, I tried disabling it. Didn't make a difference.
Solution attempt 3: Search setting for 'align' and 'formatting'
But I didn't find anything useful. :-/
Solution attempt 4: Update PhpStorm
I was on PhpStorm version 2022.2.1.
I tried updating to PhpStorm version 2022.2.4.
This is still in progress.
Please show what you have at Settings (Preferences on macOS) | Editor | Code Style | PHP, specifically Tabs and Indents tab.
Checking Use tab character option with unchecked Smart tabs should do just that.
https://www.jetbrains.com/help/phpstorm/2022.3/settings-code-style-php.html#php-specific-formatting-settings-for-tabs-and-indents
(Pro tip: you can copy-paste your code sample in the preview area and start changing the options; the IDE will apply the changes live on the provided code sample instead of the default one.)

App manifest references the image which does not have a candidate in the main package error in windows phone 8.1

I am just creating app package and got the following error
Need help how to resolve this.
In my case it had to do with the default app scale, as outlined in this blog post:
It appears that the default scale has changed [from 100%] to 200%. OK. Fine.
And? Why does that matter?
It matters because the main app package contains resources for
whatever the default scale is. And for UWP, the default is 200. Since
I use app bundles, my Logo-100.png ended up in a satellite app
package, and the main package does not have any logo (since I didn't
provide the default 200). Hence, my app would not be installable on a
system that requires scale-200.
When I renamed the file to Logo.png, the editor complained because it
assumed that images without qualifiers were in the default scale
(200), and my logo didn't have the correct dimensions for that scale.
There is an explanation for this in the , but it is a
little buried:
"The default asset scale for Universal Windows apps is 200. If your
project includes assets not scaled at 200, you will need to add a
<UapDefaultAssetScale> element with the value of the scale of your
assets to this PropertyGroup. Learn more about assets and scales."
So what you need to do is either change your images to the correct scale and rename their suffix accordingly (e.g. scale-200), or change the default scale by opening the .csproj file in a text editor and following the instructions in the porting article linked in said blog post:
Find the <PropertyGroup> element that contains the
<TargetPlatformVersion> element. Do the
following steps for this <PropertyGroup> element
The default asset scale for Universal Windows apps is 200. If your
project includes assets not scaled at 200, you will need to add a
element with the value of the scale of your
assets to this PropertyGroup. Learn more about assets and scales. Now
your element should look similar to this example:
<PropertyGroup>
…
<TargetPlatformVersion>10.0.10240.0</TargetPlatformVersion>
…
<UapDefaultAssetScale>100</UapDefaultAssetScale>
…
</PropertyGroup>
I resolved it by removing .scale-100 for your Logos name.This works for me.
I resolved this by making sure I had separate image files for all scale sizes. (ie. .scale-100, .scale-140, .scale-240)
The default size is Scale 200. If you didn't include that image, Visual Studio notifies you of this. So include an image asset for Scale 200
I was able to solve this by ending the laziness. Delete all the images that you had setup, START COMPLETELY OVER, re-assign ALL images - all 3 images for each row- set them all. That's the only way you'll know for sure that you're good to go.
I solved the problem by changing the name of the logo in the AppManifest.
For example, if you had the error on the Store Logo in the Appmanifest ==> Store Logo ==> Store Logo : Assets/Store-Logo
Change it to Assets/Store-Logoooo
then also change Store Images in the main app.
For everyone.
From unity remove all windows icons (PLayer settings/Windows/Icons). [important]
Will problem
In Unity. Add Splash screens for windows [important]
In Visual Studio - generate manifest all images from standard tool. [important]
If you already have "Assets" folder - remove; And generate.
It only works like this.
In some case the solution of renaming the images in the assets folder doesn't work out.
In that case, you should set the "Generate App Bundle" option at "Never" and continue normally with the rest of the packaging procedure.
Though this is not a permanent solution, it is a good work-around and is pretty useful if you don't necessarily want App bundles for reducing size.
Sources : Personal experience of solving this error and searching the solution on-line and finding that it worked for other users as well : https://social.msdn.microsoft.com/Forums/en-US/3857fb9d-dbd5-4eb8-aa75-fe4c47f26875/wp81-universal-error-image-does-not-have-a-candidate-in-main-app-package-while-creating-a-package?forum=WindowsPhonePreviewSDK
Visual Studio 2022 (for a desktop app): added all images the required sizes, and still got this message. Solved it by first generating all images from a base image, using the "Generate" button. Then replaced the (awful and mis-scaled) results with my own versions. Then it worked. Apparently the form that allows you to add the images is not complete, or has a mismatch with what is actually required. First using the generate option circumvents trouble.

Changing Spaces Per Tab in PHPStorm

I have a SCSS file I am currently working on. The indentation is 4 spaces, but for some reason PHPStorm only moves the cursor 2 spaces every time I tab. Is there a way to change this? Strange thing is I have other files in the project (mostly JS) and they are tabbed 4 spaces.
Settings/Preferences
Editor | Code Style
Now select your desired language (as it's configured on per language basis) and check the option on the "Tabs and Indents" tab.
If you are using the actual Tab symbol for intents then you will see the changes straight away. But if you use Space then you will need to invoke Code | Reformat Code (or similar Code | Reformat File...) to see the changes in the indents.
In case if you have changed the settings in Code Style but still see the old/different settings being applied: check if you have .editorconfig file(s) in your project and EditorConfig is enabled (by default).
The settings from such a file will overwrite your Code Style settings (it's expected as it's the nature of such files). In this case you will need to edit your .editorconfig file (or disable EditorConfig integration).
P.S. I prefer setting the basic settings (like indent size, indent symbol etc) in the .editorconfig file. It's portable, flexible, and allows setting up different settings for files that do not have dedicated Code Style settings in the IDE.
After applying the settings, the tab will not apply right away. For this to work you have to Code -> Reformat Code
You can set the tab and indent for each language you code in.

PrimeFaces: How to increase the rendered size of a MindmapNode

I am following the PrimeFaces MindMap example from:
http://www.primefaces.org/showcase/ui/mindmap.jsf
My question is: How do I increase the size of the "bubble" (MindmapNode) so that I can display more text within it?
Any help would be appreciated.
I looked at generated source and found that size is controlled by rx and ry in eclipse element. Just put your numbers there. Here is some source of mindMap maybe will be useful.
I spent forever trying to find out how to do this, so for anyone else who struggles, heres how to do it.
Open your primefaces jar file in a ZIP program such as WinZip.
Navigate to META-INF -> resources -> primefaces -> mindmap and open the mindmap.js file.
When I open it up even in an editor such as Notepad++ it is displayed entirely on one line. Therefore the easiest approach is just to search the file for this line:
raphael.ellipse
Within the brackets after that line are 4 values. The last 2 are the ones you are looking for. The first of the two is width and the last is height.
All you need to do then is to save the mindmap.js file, go back to WinZip and update the files in the jar, go to your project in Eclipse (or your chosen IDE), refresh the project and restart the server.
And your done.
I hope this helps somebody

monodevelop code formatting

I'm using monodevelop on my mac to develop for iPhone. I was wondering if there is a way to change how MD formats C# code? by default it puts the curly braces at the same line as the if which I personally don't like....
In the Solution Options dialog, go to Source Code->Code Formatting->C#. These will cascade to the projects in the solution, but you can override it for individual projects if you want.
You can change the defaults for new solutions in the Default Policies dialog, but this will not affect existing solutions.
Choose Preferences from Edit
Under Text Editor choose Behavior
Uncheck Enable on the fly formatting
You can also create a custom policy, save it to a file, share it with your team (they'll need to import the policy), and then quickly select it from Solution Options.