Android Studio / IntelliJ: Highlight custom strings in the log (or logcat) - android-studio

Android and IntelliJ both have support for highlighting log messages based on the log level.
I'd like to go a step further and also highlight "my" classes, means classes from "my" packages - in a different way so that I can recognize them quickly in the log. So I'd like to see an option where I can define a custom string and then give lines which contain this string a custom highlighting. The "string" could be a package name, a debug string, or whatever.
Do you know if such a solution exists already? Maybe there's already a plugin for that?

I'm not aware of anything specifically targeting this use case, but I have workarounds for you.
Search
Focus the LogCat window by clicking into it and the press Ctrl+F, this brings up the local search bar and you can enter your package name:
Filter logs
This solution is from my question: How can I disable Android's internal logging for specific tags (e.g. AbsListView, GestureDetector, endeffect)
If you're having problems with spamming log lines you don't care about just filter them out, for example I have this configuration:
^(?!AbsListView|endeffect|GestureDetector|CustomFrequencyManager|ApplicationPackageManager|PersonaManager|ProgressBar|ViewRootImpl|MotionRecognitionManager)
^(?!Unable to resolve superclass of|Link of class|DexOpt: unable to opt direct call|Could not find class|Could not find method|VFY: )
This leaves only the most important/relevant log lines:
your app's logs
dalvikvm's Garbage Collections
StrictMode
and other unexpected things
High-level logging
I don't suggest you do this, included for completeness. Use only Log.wtf and Log.e for your own logging and set colors/LogCat view's level filter accordingly. This is not really useful if you want to have 5 levels of logging. There may be some sneak-in log lines, but less than normal.

What about the plugin https://plugins.jetbrains.com/plugin/7125-grep-console.
I use it and it is quite good.

Related

VSCode Vim multiple cursors

I have looked everywhere and I am still unable to switch off this 'feature'!
I've been using vi and, later, vim, since the 80's and I have never had need of multiple cursors, nor can I see a use for them.
:<range>s/search/replace/ does everything I need so this new feature is infuriating beyond words, especially as I've no idea how to switch it off when it seemingly-randomly appears.
Would someone be wonderful enough as to tell me how to banish, remove, consign-to-history the multiple cursors feature in VSCode Vim 1.12.4, please?
I believe this issue is specific to the plugin. I experienced it with the HTML plugin recently, and I'm assuming you have the same problem with HTML files, but the same principle should apply to other plugins as well. You just have to find the setting.
In the VS Code settings, there is an option that reads:
HTML: Mirror Cursor On Matching Tag
You can uncheck the box there to disable the feature. Or you can go to the settings.json in your local repo (inside the .vscode directory), or the equivalent global file, and add/modify the following field like so:
"html.mirrorCursorOnMatchingTag": false
That should take care of it for you.

Exclude files from Android Studio lint spell checker

The Android Studio lint spell checker flags hex codes that look to it like words in certain files that would be better off unchecked, such as values/colors.xml and build/intermediates/dex-cache/cache.xml.
How do I tell lint to not spell check certain folders or files?
This can be done by using IDE scopes. In Android Studio (at least 3.4) you can configure each inspection per scope. The idea is that you create a scope that contains all files you don't want to be spellchecked, and then switch Spelling inspection off for this scope, but keep it on for everything else.
Add a new scope in Settings / Appearance & Behavior / Scopes that contains all files which you want to exclude from spell checking. For example, this pattern covers all svg files: file:*.svg. In your case it could be like file:*/colors.xml||file:*/cache.xml. IDE will highlight all affected files by green, so you can check if you entered correct pattern.
Then set up Spelling inspection, so that it is OFF for your new scope and ON everywhere else.
Had the same problem with colors.xml
I couldn't find a way to disable the check for a certain file, but I could get rid of the spellcheck on the hex codes.
Click Analyze->Inspect Code.
Choose Whole Project and click OK.
The inspection tool window will open with the results.
You should be able to see the problematic hex codes under Spelling->typo.
Right click any one of them and choose Exclude.
Did the trick for me. HTH

Sublime text 3 log location

Title says it all. Searched around on SO before asking but couldn't find one that has specifically asked about the general error log file for sublime.
I know errors and events are output in the console but it appears the console refreshes on restart, so this doesn't help as in my situation ST3 hangs non-deterministically.
I don't believe that is exposed, at least not much in-depth. If you want that functionality, you may want to get the SublimeLog package.
However, even that package will clear out the logs on each start. Fortunately, the source code is available - so you could probably override this behavior fairly easily.
Sublime Text 2 and 3 provide a console (accessible via Control-`) for
interaction with their Python-based innards and plug-in architecture.
This plug-in logs the console contents into a plain-text file
ornamented with logger activation/deactivation timestamps.
The log is erased and recreated each time Sublime Text is launched.
Emphasis added

Do a Find in Current Namespace in Visual Studio?

Want to be able to do a Find but contain my results to the current namespace the current opened file is in. Like "Current Project" but "Current Namespace". Is there a plugin or tool that can do this?
You can always use a regex :
namespace my_namespace(.*\n)*.*my_search
That's kind of an ugly solution, since it will select everything between namespace keyword and you search. But that's still useful.
You can adapt it and change capture groups in order to be able to use it for replacements.
Rather than parsing and inspecting every code file individually, Agent Mulder plugin utilizes ReSharper's Structural Search (sometimes known as Structural Search and Replace, or SSR) to look for patterns of code in the entire solution. This is both effective (since the solution structure already exists in ReSharper's caches), and makes it very easy to extend Agent Mulder to support additional containers.
Here is an overview of ReSharper's Structural Search API (based on ReSharper SDK v6.1)

ReSharper - Is there a disable command I can add to a file that will not allow reorder of type members?

Much like
// ReSharper disable ConvertToAutoProperty
I would like to know what, if existing, I can add to particular files (and only particular files) so that fields are not sorted on code cleanup.
For more information:
I know there are settings one can set in R# itself. This needs to work even where I don't control settings (like on other people's computers)
I know I can make a setting to disable sorting for particular types in TypeMembersLayout. This also will not work due to the same reason.
I only want this to happen on files I care that it doesn't happen with, not a global setting.
I've been using Resharper for years, and can say with confidence this option doesn't exist. Good idea though..
Maybe Generated Code options can help you. But I didn't try it.
Go to ReSharper->Options->Code Inspection->Generated Code and add your files.
I think ReSharper leaves such files untouched.

Resources