How to filter out problems in VSCode based on text? - visual-studio-code

I'm using VSCode 1.41.0 on Windows 10 x64.
In my code (which is in a research language you've likely never heard of), there is a certain class of warning message I get a lot of in the Problems panel, and I want to ignore those messages. The text of the message varies a bit across instances, but it always contains the word "duplicate". How can I filter out problems containing "duplicate"? The text filter that already exists keeps problems containing the specified text, and I want the opposite.
I tried !duplicate but it didn't seem to do anything.

Not the answer you are looking for, but negative filters currently only work with glob patterns, not with text. This is a known issue with the filter feature of the problem panel in vscode. You can check the progress here: https://github.com/microsoft/vscode/issues/62531

Related

How can I get colored output in VS Code output window?

This is really a two part question, but they are in the same vein, so I will ask in one post.
When I flip through various colors, I see that they also have the ability to change the color of the Output window. Which VS Code setting can I use to change the color of this output? To be specific, I am not asking about the terminal, I am inquiring about the output window that displays the output when using coderunner as an example. Please refer to the screenshot to see which window I am referring to.
Second question is I can see that the output does support multiple colors. I am trying to use the module cpprint from the python lib prettyprinter to print colored output to this window. When I run the script in a terminal, I am getting colors, but in the output window, I am not getting any colors. Will it be possible for me to get similar colored output in the output window as in the terminal? I am assuming the output window supports colors because the [Running]... and end are in colors.
The Python lib I was referring to
Thanks!
So, for long while now, we have had to resort to an IBM developed extension named Output Colorizer, however, this extension clashed with other extensions, and cuased an array of bugs/issues. I personally had to disable it because it was causing text to not print at all in my output window.
We now have a much more robust, built-in solution, and it doesn't require doing anything.
Visual Studio Code added syntax-highlighting support to the "Output Channel" as part of a Milestone that it had been working on, in its March 2022 Release.
The syntax highlighting is configured by a specified languages grammar.
The language grammar that is used will vary, depending on which output channel you use. The person who decided on the language syntax highlighting used for any given output-channel is the person who authored the extension that the output-channel belongs too.
Here is the link to the official release note
Because the output highlights syntax on a language basis, configuring what colors the new feature uses to color any given text, is done the same way you color syntax.
In Depth Explanation:
If numbers are set by your theme to render green (#00FF00), then, then numbers that are printed in the Output View Panel will also be green.
If the language defined constants true & false render as a pastel-red (#FF7799) when you are writing TypeScript, but when you have a Java file open, they render as a bright pastel-yellow-green (#BBEE88), then the way they render will be contingent on whether or not the output window was set to Java or TypeScript. Obviously an output window for an extension that's a tool for Java, will most likely highlight syntax as Java. A typescript-tool extension will likely highlight all syntax as if it were typescript.
Some People Might Prefer that the Feature be more Customizable
Some people might want a more customizable feature, but I think it would be a mistake, even if it were possible, to highlight the syntax in the output differently from the editor. In fact, thinking about it, it would be stupid to have done that. It makes perfect sense that it is the way it is.
Anyways, that is the end of the Color in the Output Channel, or at-least for now.

How to display static analysis warnings in MATLAB?

I've noticed the MATLAB editor will often show quite helpful warnings for ".m" files. As I tend to run my MATLAB code remotely I prefer not to use the MATLAB editor, instead keeping open a long running emacs session. It would be great if these warnings could be printed out when running a script, perhaps if some setting was enabled (I could imagine not wanting to do that by default for performance). Is this possible?
I believe you're looking for checkcode. From the documentation:
checkcode(filename) displays messages about filename that report potential problems and opportunities for code improvement. These messages are sometimes referred to as Code Analyzer messages. The line number in the message is a hyperlink that you can click to go directly to that line in the Editor. The exact text of the checkcode messages is subject to some change between versions.
...
info = checkcode(___,'-struct') returns the information as an n-by-1 structure array, where n is the number of messages found.

What do you call symbols that represent multi-character operations?

So I recently read an article that I can no longer find that talked about a setting available in Visual Studio Code where you can have the editor represent certain operations in a single character that normally take more. It's sort of a setting that makes code look a little prettier.
For instance, instead of showing an arrow function as => it would draw a little arrow like this ⇒. It did a similar thing for <=, >=, === and others.
I'd like to enable the setting but I don't even know what to search for to find it. Does anyone know the setting, or at least know what that class of characters are called?
The answer was font ligatures.

How to work with logfiles

Usually I pipe my log through a lot of greps to remove the "noise" before i open it in an editor.
I think it should be possible to do this filtering inside an editor (Especially Emacs)
Is this what chainsaw is doing? For log4j format only or more general?
(It is the only logfile viewer tool I can find)
How do you guys do it?
(I think UNIX grep syntax would be easiest for me)
Chainsaw does support both positive and negative filter matching. You can define positive and negative matches based on the logger tree (right click on nodes for the options), and you can define positive-match expressions in the 'refine focus' field, and negative-match expressions using the 'ignore' option below the logger tree. There is a tutorial available from the help menu which describes the expression syntax.
Chainsaw has had a lot of new features added since the last official release. The developer snapshot (including a reworked configuration screen) is available here:
http://people.apache.org/~sdeboy
Chainsaw doesn't just work with log4j. There are 'receivers' available that make it work with log4net, java.util.logging, log4php and others.
You can also process any regularly formatted text file using a VFSLogFilePatternReceiver (use the 'process a log file' option to configure Chainsaw to define one). There are some pre-defined log formats in the configuration dialog that act as example formats - tweak one to match your format. The JavaDoc provides more information: http://logging.apache.org/chainsaw/apidocs/org/apache/log4j/chainsaw/vfs/VFSLogFilePatternReceiver.html
If the greps are the same, you can simply code a script to do all that work for you (e.g. vimscript for vi). That way, you don't have to repeat all the tasks while leaving the logs intact for further investigation.
You're right on chainsaw and log4j - it's a logging viewer with different capabilities, e.g. a filter mechanism. However, I am unsure, if you are able to have multiple filters activated simultaneously.
Yes, you should try Chainsaw first.. it does support various ways of getting your logs.
Necroposting: I created a mode for Emacs that is specifically targeted at Log4j-like logs, but supports many more formats, especially if you customize it for yourself.
Features:
Colorization (just customize faces if that's too much)
Interactive filtering in the same buffer:
by level
by logger name
by thread
by message
easy narrowing
edit all currently set filters at once
A few log-specific movement commands
Copy (with M-w) only visible text, goes well with filtering (this is customizable)

Tool to compare/diff HTML in bulk

I have a lot of HTML files (10,000's and GBs worth) scraped from a server and I want to check to make sure the server produces the same results after some modifications but ignore kinds of differences that don't matter, e.g. whitespace, missing newlines, timestamps, small changes in some kinds of number, etc.
Does anyone know of a tool for doing this? I'd really rather not do more filtering than I have to.
(Oh and it needs to run under linux)
You might consider using a clone detector such as our CloneDR. This tool parses large sets of computer program (HTML is special case) files, builds abstract syntax trees representing the essential structure of each files, and compares programs for similarity.
Because it is comparing essential program structure, it ignores inessential differences such as comments and whitespace, and deterimines that two code segments are either identical or one can be obtained from the other by substituting other blocks of code. The latter allows the recognition of code that has been modified in various ways. You can see samples of clone detection runs on a variety of computer languages at the web site.
In your case, what you would be looking for are files in system A which are essentially clones (exact or near misses) of files in system B. As a general rule, if a file a is a variant of file b (e.g., with a few changes) the CloneDr will report it as a clone and show the exact differences.
At the scale of 20,000 files, I can see why you want a tool, and I can see why you want near-miss matches rather than exact matches.
Doesn't run under Linux, but I assume your problem is hard to enough to solve so that isn't what you are optimizing.
I use winmerge alot in windows and from what i can see some people enjoy meld in linux, so perhaps that could do the trick for you
http://meld.sourceforge.net/
Other examples i saw from a quick googling was Kompare,xxdiff.sourceforge.net, and kdiff3.sourceforge.net
(could only post 1 link so wrote the adresses to xxdiff and kdiff3 as text)
Beyond Compare is purchased software that is actually worth the money (I never thought I'd hear myself typing that!). It is GUI based but handles thousands of files very well. It will allow you to specify unimportant changes with regular expressions as well as whitespace (beginning, middle and end of line). The feature set is very extensive, check out a trial download.
I do not work for this company, I just use Beyond Compare every day at work and enjoy it every time!