I'm trying to create a snippet, but when I try to move through the fields by hitting tab
for fields within "" it autocompetes the " instead of jumping to the next field and breaks.
<snippet>
<content><![CDATA[
Hello, ${1:this} is a broken "${2:snippet}", ${3:this} field won't be reached!
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>testsnip</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>source.python</scope> -->
</snippet>
Is there a solution for this?
Do you have a key binding set up to move past quotes, brackets, etc? If so, that's probably what's triggering, not an autocomplete. You can probably modify the context of that key to include something like { "key": "has_next_field", "operator": "equal", "operand": false } to get the behavior you want.
As a debugging tip, enter sublime.log_commands(True) in the ST console. That way you can see what command is being run. This can help narrow down what a particular problem is.
Related
Found a solution: snippet shortcuts cannot have underscores in them, or they will... well, they just won't expand from intellisense.
I am on Visual Studio 2022
Snippets / Intellisense are otherwise working fine, if I start typing "for", I get the right suggestions, and if I select one and press tab, it expands fine.
I have created my first custom code snippet (just to remind me to flush stdin after using scanf_s). It has no bells or whistles, it's just to insert some text. It does not share a name with any other command, variable, snippet or anything in Intellisense (the name is just "myscanf_s"). I am trying it in an open .cpp file, which matches its declared language.
It works in two ways, and fails in just one:
A) I can choose "Snippet - Insert Snippet", find it under "My Code Snippets", and insert it just fine.
B) It shows up as a suggestion when I type.
C) But, when selecting it as a suggestion and pressing tab (or double-pressing tab, double-clicking, or ctrl-spacing), it just inserts the full shortcut name.
Why is my custom snippet working so differently?
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>myscanf_s</Title>
<Description>Basic help for scanf_s</Description>
<Shortcut>myscanf_s</Shortcut>
</Header>
<Snippet>
<Code Language="CPP">
<![CDATA[
//%d is 'Dec. int', %u is 'Unsigned dec. int.', %s is 'String, %e is 'float', %c is 'single Char'
scanf_s("TYPE_SPECIFIER", &VARIABLE, WIDTH_OF_INPUT);
getchar();
]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>```
In my tiddler, I have the following field:
name : my_field
value : [[Some Page I Want To Link To]]
Then, in the same tiddler, I use the following ViewWidget to see the content of the file:
<$view field="my_field" />
The problem is that the rendered text is not wikified, and thus, there is no link despite me having wrapped the name with [[ and ]].
How can I do to have my text rendered as a proper link?
Note: Removing the spaces is not an option.
P.S.: Of course, I tried the documentation, that is:
http://tiddlywiki.com/#ViewWidget
http://tiddlywiki.com/#LinkWidget
... including changing the format, etc., but to no avail.
The solution is to use the transclude widget, instead of the view widget:
<$transclude field="my_field" />
If your field my_field has the value: Some Page I Want To Link To
Then use:
<$link to={{!!my_field}} >{{!!my_field}}
</$link>
Error parsing snippet xml: Error document empty. In file Packages/User/vawp.sublime-snippet
I am on OSX 10.9.5. I have researched for days and tried a few fixes, but I get these errors every time and my snippets will not trigger.
This is how my snippets look:
<snippet>
<content><![CDATA[
<!-- %%[ if _messagecontext != "vawp" then ]%% -->
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>vawp</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>source.python</scope> -->
</snippet>
They are directly in my Packages\User forlder.
I added XML syntax highlighting to your question so you can see the problem easier: your snippet is, in fact, empty. You've commented out the content of the snippet between the CDATA tags, so there is nothing to insert when you hit the key sequence. Remove the comment markers at the beginning and end of line 3 and it should work for you.
When I type this:
<div>
</
Sublime automatically writes this:
<div>
</div>
It's annoying because I usually write like this:
<div>
<>
And then go inside the brackets and fill the tag out, but as soon as I type /, Sublime does this:
<div>
</div>>
Very non-intuitive and specific to certain habits of certain coders (which could easily be resolved by checking to see if a > is already present).
Anyway, how can I disable this automation? "auto_complete": false didn't do it.
Tags are automatically being closed on you. To disable this, add the following User settings:
"auto_close_tags": false
The auto_complete setting is specifically referring to the completion popup window that you see as you type. So you probably want this to remain enabled.
Auto complete can be disabled with the auto_complete setting. To disable it, add this line to Preferences/File Settings - User:
"auto_complete": false
This feels like a newbie question but:
I am trying to create a new page from the drop-down display menu so that I can supply a background color to the page (so end user doesn't have to go into the html and add a div). I tried adding a new (empty) div to the template but it's not working. Is this even possible?
Here is my code (my div is called "s_holder"):
<metal:field use-macro="python:here.widget('text', mode='view')">
Body text
</metal:field>
<div metal:use-macro="here/document_relateditems/macros/relatedItems">
show related items if they exist
</div>
<div tal:replace="structure provider:plone.belowcontentbody" />
</tal:main-macro>
</metal:main>
<div id="s_holder"></div><!--end s holder-->
</body>
</html>
For the part of creating the new display view: as #Auspex said, you should put the div inside the macro.
To add your display view to the drop down menu you need to edit every content type. There are two ways of doing this:
1- manually add a "types" folder in the genericsetup profile of your product and put inside one xml file per content type. Ex:
File.xml
<?xml version="1.0"?>
<object name="File"
meta_type="Factory-based Type Information with dynamic views"
i18n:domain="plone" xmlns:i18n="http://xml.zope.org/namespaces/i18n">
<property name="view_methods">
<element value="file_view"/>
<element value="myniewfantastic_view"/>
</property>
</object>
2- in the ZMI -> portal_types edit every content type to add your display view and then in the portal_setup tool export the step for types. Extract the xml definitions from the downloaded archive to your genericsetup profile (in the "types" folder) and then edit them to remove unuseful parts as above.
Sure you can do it. I'm not convinced it's a good idea :-), but you need the <div> to be inside the main_macro (your example HTML is invalid - you have a </tal:main-macro> and no start tag, but I'm assuming you just cut and pasted the last part of the template here, because that template would never display, if it was written that way.
That said, how exactly are you adding it to "the drop-down display menu"?