how to create code shortcuts in adobe brackets - adobe-brackets

Does anyone know how to create a quick code shortcut in Brackets? e.g. if in Javascript, if I type "f" and then hit tab, the editor writes the code "function(){}". IntelliJ has something called Live Templates. I wonder if something like this also exists for Brackets.
thanks!!

Use the extension manager and select the available panel in the dialog. Type "snippet" in the search box and install the Brackets Snippets (by edc). This will come with many predefined snippets but also allow you to create your own in a very simple syntax.

Related

How can I make a Visual Studio 2017 custom editor refresh the text view?

I have created a Visual Studio custom editor extension (implementing ITagger<T>). It works perfectly and applies syntax highlighting according to the domain specific language behind it. Nonetheless, when I edit the text, VS re-tags and re-formats only the edited line.
However, when a particular line changes, I need to force re-formatting all the visible lines following the edited line. I do not know how to do this. I tried many alternatives, including responding the Changed event of the TextBuffer behind.
Can you help me with ideas, or sample source code to custom editor implementations that handle this issue? The built-in C# editor does it: when I edit a line, and it becomes a multi-line comment, the text view is changed accordingly.
The extension code Formatter could format the class file and arrange fields, properties and methods as per StyleCop rules. Maybe it is an extension you want to get:
https://marketplace.visualstudio.com/items?itemName=vs-publisher-599079.CodeFormatter
One crude way is to close the document and open it again.
string path = dte.ActiveDocument.FullName;
dte.ActiveDocument.Save();
dte.ActiveDocument.Close();
dte.ItemOperations.OpenFile(path);
Although, I hope there is a better way to deal with this issue.
Edit: Well, I think I found a better way.
An event is declared in your tagger class (which implements ITagger interface). Raising the interface does the job flawlessly.

How to highlight lines in Atom Editor?

I'm aware of the different abilities to highlight based on filetype, but what I'm looking for is something similar to how in a typical text editor you can highlight a line (not just change the color text).
Is this possible to do in the Atom editor? If so, how do you do it? Is there a plugin for this?
The reason I want to do this is for organizational purposes, and sometimes the files I am working in our custom files that are not necessarily code but documentation (usually both are together in the same file), and the documentation part is where I want to add these highlights.
The only Atom package I know of that has a somewhat similar functionality is the bookmarks package.
It is an Atom core package, so you most likely have it installed already.
It might not be exactly what you were looking for, since it only allows setting bookmarks on lines of your open files.
As soon as you close a file, the bookmarks are lost.
But while working on several opened files, it can be very useful to quickly navigate through these bookmarks.
The reason why no package like you asked for exists, probably is that it would be really hard or at least impractical to implement.
Imagine you set dozends of highlights on a file which is under version control (git, svn, etc.) and then pull in a newer version of this file where several lines were added, removed, changed, shifted ...
To still be able to show the highlights on the correct lines, the information of such highlights would need to be under the same version control. Essentially you would need to store this highlight on the line itself, which would mean everybody had the same highlights, which is probably not what you want. Because if you wanted that, you could just format your documentation with markdown or similar in the first place ;)

How do I stop Sublime Text converting Sass variables on pressing tab?

Does anyone know of a way to prevent Sublime Text 3 converting sass variables on pressing tab?
For example, I might type $variable-name and then press tab, intending to insert the : and space, which would be the normal CSS behaviour. Within doc type sass, I get 1variable-name:; instead.
It's rather annoying to have to correct every time, and I'm sure others get irritated with the same. I have the Sass and Emmet packages installed.
Many thanks. Your help is much appreciated.
Too long for a comment...
So I did a little digging last night, and from what I can tell this behavior is hard-coded into Sublime. The command that's executed when Tab is pressed right after a variable is expand_abbreviation_by_tab. Many times, Sublime commands are implemented in .py files, and can so be edited to suit your needs. Unfortunately, I was unable to find any mention of this command anywhere, leading me to believe that it's hard-coded. I suppose a workaround would be to enter a space before hitting Tab, if your end goal is to have the colons : aligned with each other. Another option would be to use the Alignment plugin, available through Package Control. It's very configurable, and I highly recommend it.

Add Buttons in Sharepoint Library

I would like to know whether it is possible to add buttons to a particular document library's column when a new item is created. I am working on SharePoint without using any development tools like SPD and Visual Studio.So, is there any way to use JavaScript to achieve this? Because, if it is done using java script I can add the java script code to a content editor and get the desired functionality.
What are the any/other ways to achieve this functionality by coding in visual studio?
Thanks
You might be able to achieve it with JavaScript as you suggest. However, don't do it. SharePoint is a complicated product with very complicated means for displaying lists. Don't try to hack it, rather use the appropriate tools (i.e. Visual Studio and/or SharePoint Designer).
To achieve what you want, you will have to create a custom field type definition and an appropriate XSLT rendering template. However, this is both quite complicated. I would recommend either creating a custom list item menu action or a custom button in the ribbon.
Using Visual Studio you have several options. I expect you need to add buttons to the list form (Edit or Display). You can:
create custom ribbon buttons. - The most standard way.
create your own field with the button you need and use this column in the list. Little bit complicated. Can be used in more lists.
create your own Editform for your content type or list. - The most complicated way but with the most possibilities.

How to design a text editor in QT?

I want to design a text editor in QT and planning to implement the following basic features,
1) Basic editing features like cut,paste,formatting,indentation etc.
2) Auto completion based on the context.(Based on some xml input file)
3) Syntax highlighting ( based on some xml input file )
Can you please suggest some approaches for the overall architecture/design?
How about:
Application Example
Completer Example or Custom Completer Example
Syntax Highlighter Example
All this things are stored in one single place, in you Qt SDK examples
This post is in 2015. NO DEAD LINKS
As #mosg mentioned.
In the menu bar. Go to Help > Index:
and in the search field look for:
Application Example
Completer Example
QSyntaxHighlighter
That would help you to begin.
If using Python is an option for you, you might find my Qt Text Editor example on GitHub useful. It uses PyQt5 (but you can also use PySide2) to implement a minimal text editor. Some screenshots:
It doesn't do formating, autocompletion or syntax highlighting but should still be a pretty good starting point. Maybe you can use QTextEdit and QSyntaxHighlighter to get these features.

Resources