I've just recently updated my PhpStorm to version 8.0.3 and I've noticed a weird and rather annoying behavior when placing single or double quotes.
When I place a quote it gets underlined (img: http://i.imgur.com/qqoP4Gc.png) and when I try to write further it skips one letter, for example: I write a quote and try write a word:hello, what gets written - 'ello, when it should have been - 'hello.
How can I disable/fix this feature/bug?
Thank you in advance.
Related
I'm writing a language extension for lisp and have noticed a weird behavior. If I have something like this,
( "(" a b )
VSCode will match the closing parenthesis with the one in quotes. If I have the cursor between the a and the b and do an expand selection, it selects from the quoted open parens to the closing parens.
What controls this behavior? How do I get it to ignore the one in quotes?
I've tried messing with different settings in language-configuration.json, but nothing has worked so far. The only other thing I can think of would be the wordPattern regex, which I copied from somewhere. It's currently set to,
"wordPattern": "[^:()# \t\n\r][^:() \t\n\r]*"
IE: say I double click "LAYOUT:MENU-TRADE": I want to select the entire constant. Or at least the entire MENU-TRADE part.
In atom I can accomplish this by removing - as an ignored character. How is this accomplished in VSCode?
You can accomplish this by customizing your editor.wordSeparators. Simply remove "-" from the list.
I am working with another human being on project from that the professor expects to have uniform code-style. We have written large separate junks of code on our own, in which one has written single line comments without a white-space between the single-line-comment-token and the other one has inserted a white-space. We are working with IntelliJ and have failed to find an option to enable the Reformat Code function, to insert a white-space.
TLDR:
Can you tell us how to convert comments from that to this in IntelliJ?
// This is a load bearing comment - don't dare to remove it
//This is a load bearing comment - don't dare to remove it!
You can do a global search and replace (ctrl-shift-r on windows with default keyboard layout, or Replace in Path under the Edit/Find menu).
Check the regular expression option and enter //(\S.*) as the text to find and // $1 as the replacement. Check the whole project option, and clear any file masks. You can single step through the replacements, or simply hit the All Files option.
In IntelliJ IDEA 11 or 12, with an HTML file open, typing
<img src=
causes automatic insertion of double quotes, resulting in
<img src=""
Since I type ahead of where I read, this usually means I end up with something like
<img src=""image.png" alt="Image"/>"
How do I prevent double-quotes from being inserted automatically after attribute names?
In Intellij IDEA 14 and 15 (see #Zook's comment for IDEA 13), the option is now
Windows:
Menu File→Settings→Editor→General→Smart Keys→Add quotes for attribute value on typing '=' and attribute completion (under XML/HTML section on the right side of the Settings dialog)
Mac:
Preferences→Editor→General→Smart Keys→Add quotes for attribute value on typing '='
I don't know if it was the same for previous versions, but what actually happens in IDEA 14 is it automatically inserts both quotes and puts the cursor inside them. That's fine, but then when you type what you expect to be your opening double-quote, the smart punctuation mechanism thinks you're closing the quotes and skips you over the automatically-inserted close quote (the same as it does in e.g. java code when you type a closing parenthesis when it has already auto-inserted one). So you wind up with the cursor after the pair of quotes, typing your attribute value. This seems consistent with the original observation.
I would actually consider this a bug in IDEA but I guess the fact that opening and closing punctuation are the same symbol in this case makes things complicated. The smart punctuation mechanism would need to know to ignore the first quote you typed, but if you actually wanted to type an empty attribute value like src="", it would need to ignore the first quote and then jump over the close quote for the second one. Fiddly, but not impossible.
I've tried it with IDEA 12 and double quotes are inserted only after you start completing src attribute and press Enter or type = to confirm the completion. It doesn't happen automatically, you invoke completion that inserts quotes.
There is no option to control it, so you will have to break your habit to insert quotes manually and use Enter instead.
It's also possible to use the template completion with:
imgTab to generate <img src="" alt=""> with the caret inside first pair quotes.
Then just enter the image file name, Tab, enter alt text.
You can always submit a feature request to disable adding quotes on attributes completion.
Just change Input Language from "US - International" to "US". Switching to just "US" fixed the problem.
Read IntelliJ thread
I've made some good progress with my first attempt at a program, but have hit another road block. I'm taking standard output (as a string) froma console CMD window (results of dsquery piped to dsget) and have found small rectangles in the output. I tried using Regex to clean the little bastards but it seems they are related to the _ (underscore), which I need to keep (to return 2000/NT logins). Odd thing is - when I copy the caharcter and paste it into VS2K10 Express it acts like a carrige return??
Any ideas on finding out what these little SOB's are -- and how to remove them?
Going to try using /U or /A CMD switch next..
The square is often just used whenever a character is not displayable. The character could very well be a CR. You can use a Regular Expression to just get normal characters or remove the CR LF characters using string.replace.
You mentioned that you are using the string.replace function, and I am wondering if you are replacing the wrong character or something like that. If all your trying to do is remove a carriage return I would skip the regular expressions and stick with the string.replace.
Something like this should work...
strInputString = strInputString.replace(chr(13), "")
If not could you post a line or two of code.
On a side note, this might give some other examples....
Character replacement in strings in VB.NET