Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there support for XML code hinting / completion in Sublime Text 2?

I am giving Sublime Text 2 a try and I was editing an XML file - that had a DOCTYPE declaration and a DTD - and there seems to be no way to get code hinting / completion when editing the XML document.

I am sure its something simple I am overlooking. I cannot imagine Sublime does not have this kind of functionality, even if provided via a plugin.

Can someone shed some light on this for me?

like image 327
Scott Stroz Avatar asked Apr 11 '12 12:04

Scott Stroz


People also ask

Does Sublime Text support XML?

SublimeText Indent pluginIt is smart enough to recognize XML or JSON even if you are editing plain text.

Does Sublime have code completion?

Usage. By default, Sublime Text will automatically show the completions popup when a user is editing source code or markup, but not within prose in comments, strings or markups. Pressing the Esc key will hide the completions popup. To manually show the completions popup, press Ctrl+Space.

How do I indent XML in Sublime Text?

Open any XML file, or create a new file and paste any XML into it. Ctrl-K, F to indent it.

How do I enable auto suggestions in Sublime Text?

In the Sublime menu go to Preferences > Package Settings > All Autocomplete > Settings – User.


1 Answers

Sublime Text is first and foremost a text editor. But, the reason for it's popularity is in large part due to it's extensibility.

Although you could use Sublime's api to create a specific plug-in to do this, Sublime has a few tools that are already helpful in editing xml files and other markup files on a bare install.

Hinting and completions in particular are very easy to add. It shouldn't take a more than few minutes to create a domain specific sublime-completions file for your particular xml. You can use alt+shift+w to create an xml element, in addition alt+. will close any un-closed xml element.

You may also want to try the Sublime Tag plug-in available through Package Control

Lastly you could also bring this up in the Sublime forums as a plug-in request. There are a lot of helpful folks in the plug-in community.

like image 165
atomi Avatar answered Oct 14 '22 07:10

atomi