monodevelop code formatting - monodevelop

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.

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.)

Format list view and link to OOTB Preview functionality?

I have a document library and i have formatted the list view. This works great, however, we lose the OOTB functionality of SharePoint online where you can "preview" the file. This is where it opens in the main window and you can see the file but you also have all the SPO functionality, Share, Move, Copy, information window, version history etc.
How do i edit my Json to link to the OOTB preview? Does anyone have examples of this?
I was looking at it, but it seems that it is not possible to get items url nor parent folder's url using column formatting. I have found somehting at GitHub that mentioned .spItemUrl, but I wasn't able to use it.
The only way, is to create Field Customizer using Javascript, which will give you much broader options. Unfortunately it is not that easy to build as creating column formatting using JSON.
Reference:
https://learn.microsoft.com/en-us/sharepoint/dev/spfx/extensions/get-started/building-simple-field-customizer

Wirecloud /Fi-ware widget Include an html in the widget settings

Is it possible to include an html document in the widget settings?
So I got a few options to choose from, but the the amount isn't always the same.
So I need a possibility to dynamically edit the settings window.
Is something like that possible?
I don't think so, as the standard preferences mechanism uses the manifest xml file. So the preferences are handled outside your widget code.
You can always create your own settings button and settings display inside your widget-window.

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.

IntelliJ: Specify per-project tab size

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.