Default value of <scope> in Sublime Text 3 snippets - sublimetext

What is default value of <scope> for Sublime Text 3 snippets or what value this field should have, to force ST3 to display auto-completion list, with particular snippet at the top, when I'm typing something in .php document?
I have following Sublime Text 3 snippet:
<snippet>
<content><![CDATA[<?php echo ${0:$SELECTION}; ?>]]></content>
<tabTrigger>echo</tabTrigger>
</snippet>
I tested it with <scope>source.html</scope>, <scope>source.php</scope> and with <scope> tag removed and Sublime Text 3 never displayed me an auto-completion dialog, as I was typing something in .php file. I always have to Tools > Snippets... menu or keyboard shortcut, that I binded to this menu item.

Related

How to modify theme/colors used in search result of Sublime Text 3?

When I use Ctrl-Shift-F to find text in files in Sublime Text 3 I would like to adjust how the matched text is highlighted. How do I do that?
I don't find any entries having search or find in their name in my .tmTheme file...
Try editing: selection and selectionBorder in your .tmTheme file.

Selecting/deleting text between HTML tags in VsVim

In the Visual Studio extension VsVim, is there a way to select, delete or change the text between two HTML or XML tags?
It is possible, for example, to select all text between two speech marks using vi" or delete all text between surrounding square brackets using di].
I'd like to apply similar commands to HTML. E.g. <div>Text to select or delete</div>.
I think this is the "tag blocks" feature mentioned in the vim documentation but the syntax mentioned doesn't appear to be working in VsVim.
The tab blocks feature allows the use of 't' to indicate that the delimiters should be the surrounding tag blocks. For instance, vit with the cursor between on a character between <span> tags would go into visual mode and highlight all characters between those tags. E.g.
<span>Some text to [s]elect</span>
With the block cursor on the 's' as indicated by the []:
vit will select the text Some text to select
vat will select the text <span>Some text to [s]elect</span>
This has been implemented in version 1.7.1 of VsVim and can be installed from as a Visual Studio extension from the gallery as normal: https://visualstudiogallery.msdn.microsoft.com/59ca71b3-a4a3-46ca-8fe1-0e90e3f79329

Assign code snippet to keyboard shortcut in Visual Studio

Anyone knows how to assign key shortcut to specific code snippet?
I would like to assign for instance CTRL+K,CTRL+J to a #region snippet.
Therefore by able to:
select text,
press CTRL+K,CTRL+J =>
selected text would be surrounded with #region .. #endregion.
I hate when I have to take my hands out of keyboard for more time than necessary:).
EDIT: For more understanding, I am asking how to bind key shortcut directly to SPECIFIC snippet. Opening snippet selector wont work for me. If I have to search through all my snippets to get to a the #region one, its worse then writting all its code by myself.
Thx for any suggestions.
Type a < and then type your snippet shorcut(your XML file Name) and then press tab.
you can get more info from this link
https://learn.microsoft.com/en-us/visualstudio/xml-tools/how-to-use-xml-snippets?view=vs-2017
for example i have a code snippet which i've set xml file name and its shortcut to flog
when i want to use it directly to my code i do like this:
<flog and press tab it Works.
The closest solution I've found for this is to copy the intended snippet to your local snippets directory.
e.g. For VS-2015:
%Userprofile%\Documents\Visual Studio 2015\Code Snippets\Visual C#\My Code Snippets
Then open it in a text editor and change the shortcut to something quick and simple such as '1'.
Now to use it, all you need to do is press Ctrl+K+S > Enter > 1 > Enter
Additionally, you can make it even quicker by changing the hotkey for the surround-with command.
(Tools > Options > Keyboard > Edit.SurroundWith)
I think you may want to try adding a <Shortcut> tag inside your MySnippet.snippet file
<Header>
<Title>Square Root</Title>
<Author>Myself</Author>
<Description>Calculates the square root of 16.</Description>
<Shortcut>sqrt</Shortcut>
</Header>
For details check out : https://learn.microsoft.com/en-us/visualstudio/ide/walkthrough-creating-a-code-snippet?view=vs-2019#description-and-shortcut-fields
To add a shortcut, add a Shortcut element within the Header element
For me the fastest solution was to Import a Folder named "1", then Add the snippet (my name was "block") and mark it in the 1-Folder.
Then i can insert the snippet by
<Ctrl+K,X> + <Enter> + <Enter>
First Enter chooses 1 (the Folder with MY snippets) and the second Enter chooses my most used snippet (must be alphabetically first)

In Textmate, how do I change the color for text inside HTML tags?

In Textmate, I'd like to change the color of text inside HTML tags. I'd prefer it if I could specify which tags would have its text color changed; I really only want text inside <A> tags to have a different color, but I'd also like to be able to add more tags later on if I want to.
So essentially, any code inside <A> tags I'd like to appear as a different color from the color used for plain text. Anyone know how I could do this? Would I have to modify the HTML bundle's Language code to make this work?
To give HTML tags different colors in your TextMate.
Open the Preferences ( Command + , )
Click on the Fonts and Colours tab
Create a new theme if you may OR
For the selected theme, change the settings for the Markup tag element.

XUL - textbox problem

I am writing a Firefox extension. When a user highlights and right clicks a selected text on a webpage, the extension captures the text and displays it in a textbox (xul window). The textbox shows the correct formating (like the line breaks, spaces, * for li tags.). But the problem happens when i try to store the textbox value in a variable. The line breaks are gone.
var selText = document.getElementById("txtboxSelectedText").value; //
Can anybody help?
Thanks a lot.
Is this a real textbox or a rich text editor like tinyMCE or open wysiwyg?
In a real textbox there are linebreaks. In the rich text editors, they are really iframes with html content... what looks like a line break is really a <br/> tag.
The reason I suspect this is you can't have li tags (and their associated bullet points) inside a normal textbox

Resources