Files that define Java classes can be organized into packages by declaring them to belong to particular package, e.g.
package foo.bar;
which declares that the file in question belongs to the subpackage bar
of the package foo
. The files are then stored in directories with a hierarchy corresponding to the hierarchy of the packages. Also, the root of the package hierarchy is usually some directory src
. Is it possible to write a YASnippet that expands into a package declaration such it gets the package name from the path of the current file?