In Sublime Text, I have installed Emmet so that I can do zen coding. Now, the problem is that when I'm typing, and get an autocomplete suggestion, as soon as I accept that autocomplete suggestion (either by entering tab, enter, or even pressing space bar), the suggested tag is expanded; this causes me not to be able to continue the zen coding.
To give you an example, say I want to insert a <select> with 6 <option> child elements. If I enter select>opt, then autocomplete suggests option, but as soon as I accept option, that expands to select<option></option>.
What I want is to accept option, but that it won't expand to <option></option>.
Is there anyway to accomplish this?
Actually, the answer is very simple. In your example, when you get the autocomplete suggestions for option, you will get 2 of them. One is the tag, the other is text. Use Ctrl+Space to go through all the suggestions, and select the text version of option and not the tag version.
In Sublime Text completions consists of a 2-tuple containing the showed string and the inserted characters/snippet. I don't think know whether it is possible to just insert the showed string. However if you search for any way, there is a way to establish: modify the source code of the html tag completion file.
Install PackageResourceViewer, then press ctrl+shift+p write PackageResourceViewer: Open Resource. Select HTML >>> html_completions.py.
If you save the file it will shadow (not overwrite) the original completions file. Hence just remove it to get the original behavior.
In this file:
in line 15 replace return (tag + '\tTag', tag + '>$0</' + tag) by return (tag + '\tTag', tag).
in line 245 replace completion_list = [(pair[0], '<' + pair[1]) for pair in completion_list] by completion_list = [(pair[0], pair[1]) for pair in completion_list]
Now it should insert the tag names instead of the whole tags.
Related
I am currently working on a controller file for a Phalcon project. I like how PhpStorm gives you autocomplete suggestions when writing a src or href value in an HTML file. I was wondering, is possible to enable autocomplete suggestions when adding resources in a controller?
This is what happens when I force autocomplete suggestions(Ctrl + Space)
This is what I would like to happen.
EDIT: I should also note that I have marked the folder, containing all my resources(ie. CSS, javascript, and images), as the "Resource root".
RE: EDITThis does not affect availability of this feature/functionality in any way as "Resource roots" are used for path resolutions/validation and not for actual "offer this functionality or hide it" choice. -LazyOne
Unfortunately there is no real way of automatically providing such functionality in random string as it's hard to guess that file path is expected in this particular place (function parameters is different case -- here some hinting mechanics (special annotation) may work).
But .. you can forcibly enable it manually for each particular place (should last until file or project is closed):
Have some code, e.g. $someVar = ['css' => 'aaa'];
Place caret inside aaa string (it has to be 3 or more characters, based on my observations, otherwise option in #4 will not be present -- must be some sort of optimisation/limitation from IDE side)
Invoke shortcut to bring "Quick Fix" menu (Alt + Enter on Windows)
Choose Inject language or reference from appeared menu
Choose File Reference from next menu
Start using it (Ctrl + Space)
EDIT: I should also note that I have marked the folder, containing all my resources(ie. CSS, javascript, and images), as the "Resource root".
This does not affect availability of this feature/functionality in any way as "Resource roots" are used for path resolutions/validation and not for actual "offer this functionality or hide it" choice.
Where in my settings is autocomplete failing to decipher what it's suggesting? This is obviously syntactically incorrect, I'm inside the quotes for a tag and it's suggesting more tags.
Example:
This is due to the way Sublime Text scopes work. Autocompletion is based on the scope of the character immediately to the right of the caret when there is no selection. In your example, it is the " character. It therefore doesn't see that the caret is actually inside the style attribute, because it sees CSS as only what is between the quotes, and not the quotes themselves. Therefore, it suggests other attribute names.
The workaround is simply to ensure there is a space between where you are typing and the closing " character of the attribute value.
EDIT: I have now suggested a fix for this in a PR to the SublimeText Default Packages repo. If it gets accepted, it will be available in the next ST3 build. Alternatively, you can follow the instructions in the repo's Readme to grab the changes sooner.
EDIT: and another PR to make the same fix when typing just before the </style> tag.
I have toggled every option that seems to make sense and have searched for an hour, but I can't find a solution. I'm sure I'm just missing some magic word, and the solution is probably simple, but how do you make PyCharm automatically unindent closing HTML tags?
For example, if I type:
<div>
Test
</
PyCharm will automatically fill in the div>, but it will leave the indent hanging.
Thanks in advance.
Update: Part of the reason why I was particularly annoyed by this problem was that I was unable to backspace to the appropriate indent level before typing the closing tag, so to put the tag on the correct level, I had to Shift+Tab or press Home then Backspace.
I found this answer that pointed me to Settings -> Editor -> General -> Smart Keys, where I set Backspace -> Unindent to To nearest indent position, instead of To proper indent position, which dramatically reduced the annoyance level of the original issue.
I'll leave this open, as automatically unindenting closing tags (or automatically setting them to the "proper indent position") would still be the most ideal solution.
PyCharm automatically adds the closing tag when you type the starting tag. So when i type <div> there will be </div> directly added.
I have a simple question.. I want to know what a style of searching is referred to as, like how may I refer to this style of searching when I am researching it.
In Sublime Text 3 when you hit Ctrl+ Shift + P the command pallette pops up, and you are able to type in a search query... Now, the special thing about this Sublime Text find box is that it will find search results based on the number of matched characters in sequence, rather than the strict name of the file. So, something like "packcon" will bring up "Package Control" and then something like "synrub" will bring up "Syntax: Ruby".
What is this style of string matching called?
Fuzzy Matching is the common name but more correctly referred to as Approximate String Matching.
More to read here : http://en.wikipedia.org/wiki/Approximate_string_matching
Is there any eclipse shortcut/trick/plugin/whatever that will allow me to select a section of text and surround it with an arbitrary html/xml tag when using the html editor.
Something like this textmate video
EDIT: not sure If my Eclipse setup is the same as yours, but...
I have the HTML Editor installed, and if I switch to the Java perspective, I can use Edit -> Quick Fix and then choose Surround with new element to get exactly the effect in your video. (On a Mac, the shortcut for this is ⌘1).
Hope this is helpful.
In the C++ editor, you can try Source -> Surround With... -> Configure Templates to add the tag you want.
The following works and allows for entering random/arbitrary tags:
Select the desired text that you want wrap.
Go to 'Edit > Quick Fix' or press 'Ctrl + 1'.
In the new menu that appears select 'Surround with new element'
However there is an annoyance, please upvote Bug 494169