I have no idea what on earth has happened to my VSCode. I am unable to trace which or exactly what extension caused this. But, the C++ syntax coloring and theme looks absolutely ugly.
I want this,
How can I get that back? I am unable to figure this out. I uninstalled all C/C++ extensions and still the issue remains.
VSCode colorizes brackets and parentheses to make it easier to see which opening bracket belongs to which closing bracket.
You can turn it off in the settings:
Related
I am creating rules for a reddit automoderator. It gets its rules from a YAML config file and the regexes are interpreted as Python regex.
I am trying to make the following regular expression work:
(https?://[\\w\\d:##%/;$()~_?+-=\\.&]+\\.\\w{2,6})([\\S\\s]*\\1)
When I test it on https://pythex.org/ it works perfectly to achieve what I want.
Unfortunately my group reference at the end of the expression is causing an error when I copy the same regex into the config file:
Generated an invalid regex for body (regex): cannot refer to an open
group
I have also tried this version with everything escaped just to make sure that the characters weren't interfering in any way:
(https?://[\\w\\d\\:\\#\\#\\%\\/\\;\\$\\(\\)\\~\\_\\?\\+\\-\\=\\.&]+\\.\\w{2,6})([\\S\\s]*\\1)
But I still get the same error. Does anyone know what I'm doing wrong here?
I managed to fix the problem by changing the group selection to \2 instead of \1.
It turned out that YAML or AutoModerator were automatically putting parentheses around the whole expression, so any group references within must be 1 more than you would initially expect.
I had thought that this was the problem at the start, and tried the fix explained above, however due to a separate issue with the AutoModerator code, the fix had not appeared to have worked. All resolved now though; thanks for your patience and help.
I have been using linters in NodeJS for a while eslint and have started using cpplint on my Arduino libraries in C++. It does not seem to pick up some fundamentals such as missing semicolons (but it does identify braces on the wrong line). It also doesn't seem to differentiate between spaces and tabs for indentation or badly indented code in the implementation file.
Coming from a NodeJS background, cpplint seems to be missing a lot of checks or am I completely missing the point?
cpplint only checks code style based on Google C++ Style Guide. As long as I know, it won't check syntax error. If we look on cpplint.py implementation, we won't found any rule of regex govern about missing semicolons. And about indentation, as long as the whitespace width is even and not tabs, cpplint will pass it.
For example, I have the following lines:
//sys.log(siteNameToPrepare);
//sys.log(siteNameToPrepare);
// sys.log("downloadFolder: "+downloadFolder);
// lorem ipsum ...
arbitrary codes here...
var a = _POST;
sys.log("groupManagementHandler.jhp _POST is not object");
sys.log("groupManagementHandler.jhp _POST is not object");
I only want to match sys.log(xxx) that is not commented out.
I tried to use the following regex:
[^/ ]sys.log
on the search bar (Ctrl+Shift+F), with Regex ON, to find the uncommented sys.log within files of a folder.
It matches uncommented lines in several files, however, I missed some lines that has couple of whitespaces in front of sys.log.
My question is how to match those lines? What am I missing here?
Seems like I couldn't find the answer in Google and Stackoverflow, I found this one, but this one is for Visual Studio, not Visual Studio Code.
Visual Studio Search Uncommented Code
Here's the error message I got by using the look ahead pattern:
Thanks to #Wiktor Stribiżew, now I can confirm that the regex lookahead pattern for searching within files works in older Visual Studio Code (V1.2.0) but not works in Version 1.17.1.
So this question may somehow can be seen as a duplicated question due to the bug of newer version VS code, that led me to post this question.
For someone who wants to know the answer right away, here it is as suggested by #Mark at the comment section of my question:
First open the "search in files" field using Ctrl+Shift+F
Turn on the Regex function (right-most button of the input field)
Put the following regex:
^\s*sys.log
or this regex also works
^[^/\n](?:/[^/\n]+)*sys.log
The above regex-es work for my case.
Before I got this answer, we had a discussion with #Tim and #Wiktor, they both suggested a lookahead regex pattern, and that pattern actually works on older version (V.1.2.0) of Visual Studio Code as #Wiktor pointed out. But apparently,
the advanced Regex feature for searching in files is no longer supported since V1.12.0 version. However, it's still working if you search within the file using Ctrl+F.
Thanks to #Tim, #Wiktor and #Mark who have helped to clarify things out.
I'm trying to use a .ini file as a configuration file, and to do so I'm using regex.
What I currently do is a getline of my file and for each line I get, I'm trying to determine if it is corresponding to a scope or not with the following regex : "^\[[a-zA-Z0-9]+\]$"
This regex works well according to https://regex101.com/ and Unix, but crash on my windows application (yes I try to make this app cross-platform)
So I'm wondering what is going wrong here, and why does this regex make the program crash, and how to solve this problem...
Thank everybody !
You've missed the quoting of the outer brackets. Try
^\[[a-zA-Z0-9]+\]$
or simpler
^\[\w+\]$
And don't forget to escape the \s in the c++ string ;)
See it here at regex101.
So I'm coding in VIM, and I ran into a strange problem. I closed out of my source code, but when I opened it back up, a lot of my curly brackets are highlighted in yellow, and I can't seem to fix it. The closing brackets are matched up with opening brackets, so I don't see what the issue is.
Here is a picture of the problem:
How can I fix this?
Did you do a search for the closing bracket?
Try the following, in command mode
:set nohlsearch
You can use :noh to turn off highlighting of previously searched term.
You can do set nohl that will turn off the highlighting for the session. Reopening will highlight again.
To fix that, search anything that you don't like, for instance /""