QtCreator CMake editor indenting - cmake

I have my Qt Creator 3.1.1 setup to indent with 4 spaces on Tab, but for some reason tab key doesn't work when I edit CMakeLists.txt. This only happens when I open it with CMake Editor, it works when I use Plain Text Editor. Is this a bug or I need to configure it somehow to make Tab key work?

I had exactly the same problem.
This issue occured because I have enabled auto-indent. The value in the "Preferences->Text Editor->Behavior" tab "Typing->Tab key performs auto-indent" was set to something else to "Never".
So to fix this issue you you need to set "Tab key performs auto-indent" to "Never".

Additionally to the answer above, inside 'Options' window and 'Behavior' pane, have a look at 'Tab Policy' section as well as 'Cleanups upon Saving' - and check if it is really what you expect.
For me the settings there were not what I have expected and it was triggering issues, eg. in a Makefile, first command of a task looks like line continuation for Qt Creator so, upon saving, it was "cleaning" (= breaking) the indentation by replacing it with 4 spaces, that was incoherent with overall indentation in the script. Et voilĂ  - error, make didn't work correctly!
As always, it is a very nice tool but one needs to know how to use it...

Related

How to disable lines around text and explanations in Sublime Text

I have these lines around text and explanations popping up annoyingly.
Is there a way to turn these off?
I tried to look in settings and to adjust them but nothing works out.
P.S. ignore the code, it's just for example
White lines surrounding code like that are generally indicative of something like a code linter or other similar tool giving you an indication that there might be something wrong with the code (such as not following a code convention of some sort). The code explanation is a popup showing you the arguments and documentation for whatever function or method you're working on.
Both of these things are something that Sublime doesn't do on its own; you have installed a package of some sort that provides this capability.
If you were looking in the regular Sublime settings (Preferences.sublime-settings) for options that control this, they won't be there. In order to configure these away you would need to determine the package that you installed that's doing this and then configure that package not to do it or, if that's not possible, remove it.
If you use Preferences > Package Settings > Package Control > Settings - User from the menu, you can inspect the installed_packages setting to see what third party packages you installed and investigate which one of them is doing this.
Possible packages that do something like this would be Jedi or one of the Anaconda packages; essentially anything that says that it provides code support and assistance for Python is a candidate here.
Once you find the package in question, you can look in it's settings directly to see if you can turn the features you don't want off; failing that only removing the package will stop it from displaying these things.
These lines are called linting. Linting is the process of running a program that will analyse code for potential errors.
In sublime text it occurs usually because of some packages that you have installed...
In your case, it is actually the anaconda package and some other packages. It can be removed easily in a few simple steps.
In the sublime text window press ctrl+shift+P to open a command pallete and then type the name of the package. I typed anaconda because it is the one giving me these lintings so there will be an option Disable linting on this file. Just click on it, as shown in this picture .

Atom keyboard shortcut to change window focus not working

I have the following keymap.cson file to config my Atom editor:
'body':
'ctrl-shift-cmd-left': 'window:focus-pane-on-left'
Only when I run this command, the current text is selected. Which without the alt key held, would make sense as a highlighting command.
However, is I bind a key command which I think most likely doesn't have a competing action, say alt-cmd-;, it seems to be registered into the list of key commands in Settings/Keybindings, yet again no window focus is happening.
Edit:
I now realize that pane and not window may be the relevant term for what I want. Still, searching the Key Bindings for pane focus switching didn't yield anything obvious. Surely, there must be a simple way to select through files in the Project area while editing.
Although this answer doesn't match the title of the question, based on your edit I think that tree-view:toggle-focus is what you're looking for.
Please try using Ctrl + 0.
And, if you use Nuclide (related to React), please try disabling it to check the difference.

Intellij exclude file from being compiled

I am trying to exclude a particular file in my project from being compiled.
According to the Intellij IDEA documentation you do this by "marking the file as plain text".
However, the context menu in the project view where this functionality is supposedly located has no such action. I am using version 13.02 of Intellij. Here is what my context menu looks like:
Under File > Settings > Build, Execution, Deployment > Compiler > Excludes, add an entry.
Any attempts to run a path specified here will result in a ClassNotFoundException, and a very important class indicator as well.
Just to compound on Makoto's answer (would comment but don't have reputation), it looks like this feature does not apply to classes (.java) or assets (images)...for these types of files, it looks like you will need to actually go to the compiler and explicitly state that the file(s) should be excluded.
However, for .htm, .xml, or really anything that isn't a class or asset you will find and can use the 'Mark as plain text' option.
Edit: It looks like you can also go to the 'Messages Make' error / warnings view and Exclude from there, a little less work IMHO.
The answer that #Makoto has given is pretty much the way to go, but in case that you are like me and you get easily both distracted and frustrated looking for that menu, you could use this shortcut:
press ctrl + shift + a , and in the input box that appears type excludes, and select the first item that appears.

Wrapping comments with line breaks in PyCharm

I have comments that gets balloon (PEP 8: Line too long ... > 120)
I wish there was a command that will wrap the lines with few keystrokes.
Right now, even if I type Alt+Enter and press enter on Reformat file, nothing actually changes. Is there a setting or plugin I could use to accomplish the formatting easily?
Under the Edit menu, there is a Fill Paragraph option, which does what I believe you want. You can assign a key command to this in Preferences, under Appearance & Behavior -> Keymap (search for "fill").
Personally, I choose first stroke Esc, second stroke Q, because that's what I've always used in Emacs...
Firstly, reformatting won't work, not in Python at least, where whitespace is important. PyCharm's "Wrap when typing reaches right margin" option is what you're looking for. Now this will not work when you copy and paste code, but in the places where it gives you trouble, just press enter, and it will work.
To be able to auto-reformat comments (and code, for that matter) to honor a right margin after the fact, go into Project Settings under Code Style and then further under Python. Click the Wrapping and Braces tab, and check the "Ensure right margin is not exceeded" checkbox.
Now if you select a region of lines and then run the Code/Reformat Code... command, PyCharm will do its best to wrap the comments or code appropriately.
You will probably have to do some tweaking of the results to suit your stylistic taste. For example, I wish PyCharm would do aggressive filling of text in block comments, at least optionally so.
PyCharm will not reformat code such that it becomes invalid Python, so sometimes it will still leave a line longer than the margin (120 or whatever you set under Project Settings/Code Style/General).
With recent PyCharm this now is located at "Editor -> Code Style", with the checkbox named "Wrap on typing"
The Screenshot shows PyCharm version 2016.2.1 Professional.
Updated Answer:
Use "soft wraps." You can search for it in the help bar.
View > Active Editor > Use Soft Wraps
It won't work for existing text or text that's copied in, but will for any newly typed text.

Rename using suggested var name with resharper

I'm Using resharper 6 nighty builds and VB.net. I've a big medium project with multiple files that don't follow the code style conventions of my company.
I've configured resharper with my own convenctions and It suggest to me the right name for each variable (perfect!).
But I can't find any automagic way to make the current name to be replaced with the suggested name.
Are there any way to do it? If not ... did you know ane fearure of coderush Xpress to achieve it?
Thanks.
If you've configured ReSharper with your naming conventions, then it should show a warning (blue squiggly underline) under any identifiers that don't comply. If you put the text cursor on one of those misnamed identifiers, you should see a pyramid icon appear near the left margin. Then you can press Alt+Enter (or click the pyramid icon) to drop down a quick-fix menu. There should be an option in the menu to "Rename to '_myField'". Usually it's the first item in the list, so you can just press Enter again to do the rename.
If you want to do this on everything in a source file, you can use the ReSharper > Inspect > Next Issue in File command (or its keyboard shortcut -- F12 in the IDEA keymap) to move the cursor to the next warning in the file. Then, if it's another name warning, you can use Alt+Enter, Enter again to fix it.
Unfortunately, there isn't a way to automatically fix every instance of a warning at once (though it's been requested; please feel free to vote for RSRP-126551 in their issue tracker).