Android Studio using Kotlin - is there a way to automatically fold multiline comments? - android-studio

Been getting into Android Studio (and Android development in general) lately, mostly a personal challenge to make a modern version of an app my mum loves but hasn't been updated in ages. But my life story isn't the point, and that's not just because it's not that interesting.
The actual question:
Is there a way to make Android Studio do automatic folding for block comments (i.e. /* to */) in Kotlin files? In Settings > Editor > Code Folding there's options for documentation (in general) and multiline comments for C or Java, but no settings specific to Kotlin, and just one for Android in general (which has nothing to do with comments).
The reasoning: Because I'm still pretty new at this, there's a lot of things I've tried but haven't worked, and comment out instead of deleting because I still might be able to learn something from them later. There's also some big blocks of logging code for debugging that are great when I'm trying to debug but in the way (given I usually write them in the middle of classes or methods) when I'm not, so I comment them out. It's just annoying having to fold several sections of comments whenever I open a file.
The "well duh" solution?: I could set them as documentation comments, which would hopefully get automatically folded, but if I start writing documentation (like I really should get around to) they'll get mixed in and that would be annoying.
What I've tried so far: Going through all the settings with a fine tooth comb (and I'll freely admit I could have gone over something obvious) and searched for plugins for code folding, about the only one I could find is https://plugins.jetbrains.com/plugin/12007-foldingplus which doesn't seem to do anything about this particular problem.
Can anyone help me out here, other than maybe "be less of a newbie in general"?

With Android Studio Arctic Fox I found that if you highlight a region that has the comments in question, you can right-click on it and one of the options will be Folding. From the expanded options select Fold Selection / Remove Region and the selected comments will fold.

Related

What is the general approach to fixing Go To functionality in Resharper

I often see that some of the ReSharper functionality just doesn't work until you restart VS and reopen the project. But this situation I have now is consistent across restarts. So I am using a Go To Everything fuctionality often. It is enabled in ReSharper settings.
But since yesterday Go To Everything (Ctrl + N for me) can't find most of the files in the project (though it can find some).
Here is a screenshot of the problem:
I have that file open in editor just to prove that it's there. I show it found in an open solution in file tree. But ReSharper doesn't seem to be able to find it.
What to I do to troubleshoot. Thanks you in advance.
The best thing to do here is to raise an issue with JetBrains. Either log a bug with the issue tracker, or email resharper-support#jetbrains.com. Include details about what version of ReSharper you're using, what type of projects you're using, version of Visual Studio, etc.
However, from that screenshot, it looks like ReSharper isn't configured to analyse that file - there's no "green tick" in the scrollbar. Is ReSharper disabled? Is that file excluded from analysis? (Mind you, even when it's excluded, it should still show up in go to results. Something odd is happening here, support should be able to help better than StackOverflow)

VIM as an IDE - Suggestions

I am looking for recommendations on using VIM as an IDE. I generally code in a number of programming languages, including C, C++, assembler, MATLAB, Maple, BASH scripts, to name a few.
In general, I like to use a single IDE for the bulk of my projects for the sake of consistency, and I have found that I perform about 90% of all my coding in VIM, and occasionally use Eclipse instead for certain projects in C/C++ (ie: projects people have already put together as an Eclipse project, or PIC24/32 projects from www.microchip.com).
I am already very familiar with the basic functionality of VIM (windows vs buffers, text manipulation, scripting), and would like to use it as my primary IDE. I have already taken a few tips from here:
http://vim.wikia.com/wiki/Use_Vim_like_an_IDE#Writing_Code
I already use the nerdTree plugin for directory browsing in a project, etc, but I need to do something about code completion and symbol resolution, as those are my two greatest concerns.
Symbol resolution
I have some limited experience in the use of C-tags, and wanted a suggestion on what I should use if I am working with a VERY large code-base that changes frequently. The projects I work on typically are pulling in header files from at least a dozen other projects, and I would like to be able to jump to the file where a function, constant, or macro is defined quickly (ie: like the CTRL-G feature in Eclipse, "jump to definition"), as well as rapidly get a list of all calls/references to a function/macro/constant/etc (ie: like the CTRL-SHIFT-G feature in Eclipse, "Show all references in project or current working directory").
Tab completion
One of the features I really like in Visual Studio and Eclipse, for example, is when I type in a variable name (ie: pointer to struct) and it resolves the names and types of all structure members and gives me a tab completion list to choose the appropriate member. They also point out when I've incorrectly used "." vs "->" for member access. I've tried superTab in VIM, but I just couldn't get it working. I also want the tab-completion feature to use the same C-tags as generated by the symbol resolution plugin
Handling build output
The final concern of mine is having an auto-generated list of build warnings and build errors. When I, for example, just run "make all" at the command-line prompt, it is a pain to have to read through code listings to manually find all build warnings.
I realize this is a lot to ask, and that I could always just fall-back to Visual Studio or Eclipse, but I really want just a simple cross-platform console-capable modal editor for all my development needs, and none of the major IDE's out there fill this need.
Thank you all in advance.
http://eclim.org/ - bring Eclipse functionality to the Vim editor
https://github.com/scrooloose/syntastic - syntax checker warnings in quickfix list
I think (but haven't checked) that Eclim satisfies #1 and #2 while I'm sure that Syntastic satisfies #3. More things of interest:
https://github.com/Lokaltog/vim-powerline - just nice
https://github.com/kien/ctrlp.vim - quick file finder
https://github.com/tpope/vim-pathogen - plugin manager (to install the others)
And are you aware of omnicompletion via Ctrl-p and Ctrl-n (prev and next) in insert mode? That's not code completion, but frequently does the job.
For the auto-completion part (point 2), I am proficiently using clang_complete.
For a quick setup and reference, try this page: http://zwiener.org/vimautocomplete.html
EDIT: this is for C, C++ and Objective-C only.
I use the following configuration in vim:
zipped file
It has autocomplete based on tag list, ctags, nerd commenter and some more plugins.
Hope it helps.. :)
I have been using Vim as an IDE for about a year now. All of my customization is online at github.
That said, I don't think a Vim beginner should start using vim like this; rather I think the Vim beginner should learn vim incrementally. The only changes that I think are so essential I would make them from the very beginning are:
Remap ESC to jk
Switch : and ;
Set leader key to ,

Dreamweaver vs aptana studio (for those who don't know coding)?

I am a web designer and developer but I don't know any scripting language. And I am looking for a robust web development WYSIWYG like software that can write code for me automatically in javascript and php.
Id go with dreamweaver because is has the design view as well as the code view. Aptana is more for developers rather than designers and developers. Dreamweaver will write some code for you (and you'll find out later that its crap!) so it'll get you used to the languages.
I used to work in Dreamweaver when I first started but now I can't get enough of Aptana.
WYSIWYG will only generate HTML page and a little JS at best. You need to know coding to offer interactive functionality.
You'll hate this answer but take some time to learn PHP and JavaScript - I stated off as a designer and tried to avoid code. Then instead of copying and pasting code hoping that it works I got to grips with the fundamentals of both languages and realised how easy it is and how there was nothing to fear.
Good resources are w3schools.com, stackoverflow (obviously) and my fav JavaScript books are DOM scripting by Jeremy Keith and Jeffrey Sambells and once you feel confident to learn some of the more advanced features of JavaScript, JavaScript Patterns by Stoyan Stefanov was helpful to me.
Like I say this doesn't actually answer your question. However Dreamweaver automatically produced a 700 line JS file for an interface action I wanted, using the resources above I did the same in an unobtrusive manner with 16 lines of code!
I realize this is an old thread but im sure the debate still rages on LOL... i've been a devote DW user for many many many years (Like since 2000 or so). I am a coder/developer... I never use DW auto complete or anything like that. Primarily the reason i've stuck with it is because my FTP is RIGHT THERE!... HOWEVER, LOL, I just ran into a problem where I needed to recover a file (all these years and i've never needed this feature). Anyway I just ran across this thread Recover Deleted Files in Aptana Studio 3? "By default Aptana Studio stores a history of up to 7 days if the file was within a project."... I guess i can live without having my ftp right there in the same program and just use filezilla. sigh lol. Also DW doesnt recognize keys which is a big let down but yea... anyway... I just started using Aptana Studio 3 so I hope I fall in love with it quickly lol I'm building my projects now :P
Well, just to clarify some stuff. Aptana does have ftp, and i even think it's easier to use than dreamweaver's ftp module...

Have you used JustCode?

Has anyone used JustCode from Telerik lately? This question has been asked about two years ago, but I'm sure the issues must have been resolved by now. Especially referring to running it side by side with ReSharper.
I have been using Resharper for a while now. I decided to try JustCode to see how it behave.
After a week of using JustCode, I am uninstalling it and returning to Resharper.
What I like about JustCode:
A single window indicating all warnings/errors in entire solution.
Performance seemed to be a bit better than Resharper.
Refactoring is easier to get to.
Projects can be excluded, or type of file
Language can be excluded (such as XAML)
What I did not like about JustCode:
Sometimes the underline used to open the option for fixing or refactoring is frustratingly hard to click since VS also puts an underline at the same spot (and it is the context menu of the latter that pops up).
Cannot change an hint to be a warning instead.
Saw some minor bugs
JustCode was giving hundreds of false positive warnings in the XAML code (luckily I could turn the inspection of XAML off)
What I was missing from Resharper:
Warnings about method parameter missing/mismatch from the documentation
Hints to transform an expression into a Linq expression.
When writing an opening bracket, resharper automatically adds the closing one and puts you on an empty line in between the two.
When completing a method, Resharper adds the first parentheses. It also adds the last one if that method is parameterless.
I am sure there is a bunch of other stuff that I can't remember now
You can install both Resharper and JustCode alongside. I first suspended Resharper before installing JustCode and used JustCode fine. When I resumed Resharper and restarted VS, both were running together without error.
Together, Resharper was finding more than JustCode.
For example, JustCode did not give a warning for the following: "Value assigned is not used in any execution path."
It even missed an error: "Cannot convert type 'int' to 'bool'." The expression was:
if ((bool)CanDoIt) // Here CanDoIt is a property of type int.
{
...
}
All in all, the tool is not bad. I recommend it over not having any. But if you have the choice between Resharper and JustCode, go with Resharper... for the moment; JustCode is still young.
You can change the size of JustCode's smart tag or turn off Visual Studio's smart tag in JustCode's options menu. I prefer to access VS's smart tag by using ctrl+., so it hasn't been an issue for me.

VIM: More precise C/C++ code parsing solutions?

Pre:
I've been working in VIM for like a year already. Lots of great things: combinations, scripts. Whenever I'm editing something in a different editor, I feel sluggish/uncomfortable without VIM's navigation.
The problem:
The thing that really bothers me most of all is source code navigation using existing tools (ctags, cscope). Often, ctags can't find the declaration of a variable, cscope as opposed to ctags finds all definitions with the same variable name. Same craziness with call tree navigation, finding forward declarations along with a single class definition etc.
Compared to MS Intellisense, Visual Assist or even source code navigation in Eclipse, Exuberant Tags/cscope seems to be deprecated for at least 10 years.
I know there are tools like ViEMU, but they don't really solve the problem, since you lose lots of VIM's functionality.
The question:
I was wondering if there is a tool that does the source parsing better, or there is some way to integrate source parsing engines like Intellisense into VIM ?
Maybe there are commercial solutions or there are people who are ready to implement one ?
All the benefits of VIM seem to save less time than is being wasted while navigating to class definition, compared to Visual Assist, where it's done by a single Alt-G shortcut.
Search and Call tree
You could try eclim, which is a way to use some Eclipse features in Vim.
For C/C++, it provides :
Context sensitive completion (although it is disabled on Windows because it is buggy)
Context sensitive search in Project files (through :CSearchContext)
Call tree for functions/methods (:CCallHierarchy)
Code Validation (:Validate)
It is not great, but it can help in some cases.
Code Completion
Regarding automatic code completion, I primarily use OmniCppComplete, which is using tags to provide Context aware code completion. It is not that bad.
As advised by Luc Hermitte, you can also use clang_complete which does not need ctags, but needs clang installed.
Unfortunatelly, it is a real problem. ctags or cscope can hardly compete with Visual Studio code browsing - it actually uses a C++ compiler front-end to parse the code for the editor.

Resources