Question

Is there any kind of standard across editor and IDEs for expanding snippets?

Specifically, I would like to write a patch for an API that would provide a code snippet database that could be imported into different editors/IDEs and expand on demand.

I am writing something for vim (my editor of choice so that)

:expand theme_some_function  

would then insert

/**
 * Override of theme_some_function($&arg)
 **/
MYMODULE_some_function(&$arg1) { 
  // contents of the function go here
}

which is how you override a function in Drupal.

Originally I was writing this so that it would go find the file through ctags and copy the function and s/foo/bar/ what needs to be changed. It was suggested that I could expand this to other editors, so I was wondering if there was a standard that I might use.

But in general, is there any kind of editor standard that might give me ideas about opportunities to write something for many editors at once?

Was it helpful?

Solution

There isn't really any such editor standard, no.

OTHER TIPS

I've not found any such standard. But here are a few points for exploration.

• Microsoft publishes a spec for an XML-based format of code snippets.

Code Snippets Schema Reference (Visual Studio 2012)

• Wikipedia has an article on code snippets but makes no mention of standards.

This web page for Code Collector Pro (Mac OS X app) mentions:

Support for .snippet Files – A new common file format for all snippet managers

…but provides no information or links about such a format.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top