Home Download Buy Blog Forum Support

Package inheritance or extension?

Package inheritance or extension?

Postby jakobud on Wed Sep 18, 2013 4:07 pm

I was wondering if it's possible for Sublime packages to somehow inherit from one-another or if it's possible to use multiple file type packages at once?

For example, if you are editing a Sass or SCSS file, and you have the Sass or SCSS file type selected, then you get the associated completions that are included in that package.

But Sass and SCSS are essentially just CSS files with extra Sass/SCSS code in them. So ultimately, when working on one of these files, you would want not only Sass/SCSS completions available but also regular CSS completions available as well.

Now, I know that obviously you could manually add the CSS completions to the Sass/SCSS package completions. But let's say your CSS package completions changed or were updated one day. Now, your CSS completions that you added to Sass/SCSS are out of date and you gotta redo them. It would be nice if a package (like Sass/SCSS) had the ability to sort of inherit and make available completions from other packages (like CSS).

Does this make sense? Is this already possible or is this something that is already in progress or being considered? Does that seem useful to anyone but me?
jakobud
 
Posts: 37
Joined: Wed Feb 17, 2010 6:05 pm

Re: Package inheritance or extension?

Postby quodlibet on Wed Sep 18, 2013 5:29 pm

I don't use completions with sufficient panache to answer this fully, but:

In .sublime-completions files you can define the scope. In theory, you should be able to expand the scope of the CSS completions to also include SCSS, LESS, etc. Unfortunately, the default CSS completions are coded in a plugin not in a completions file. (This is quite unusual. IIRC, only the CSS & HTML completions work this way.)

I had brief look at the completions script and you would need to tinker with lines 148, 156, 158 and 186. They look like regular scope selectors, so you should be able to delimit multiple scopes with commas... At least that's my guess.

Let me know how it goes ;)

Alex
quodlibet
 
Posts: 511
Joined: Sat Jun 18, 2011 5:53 pm

Re: Package inheritance or extension?

Postby jakobud on Wed Sep 18, 2013 5:40 pm

Thanks for the reply. Which file are you talking about regarding those line numbers? I don't really understand the whole scope thing. Would I have to edit the CSS scope to include SCSS and LESS or would I have to edit the SCSS and LESS scopes to include CSS? It would be nice if this was something you could release in a package and not expect users to have to hack their CSS package files to make it work.

Is there more documentation out there about Sublime package development? Like information about the file formats, etc? Doesn't seem like there is much out there except just the packages that come with ST.
jakobud
 
Posts: 37
Joined: Wed Feb 17, 2010 6:05 pm

Re: Package inheritance or extension?

Postby quodlibet on Thu Sep 19, 2013 8:49 pm

I think my answer was confusing because although I used your example, I was trying to answer your theoretical question (how multiple packages use the same completions file) rather than the practical one (how can I get CSS completions when writing SCSS).

It seems to me that you're more interested in the later one, i.e., in getting some coding done.

In which case your best bet is to try the popular SASS packages:
- https://sublime.wbond.net/packages/Sass
- https://sublime.wbond.net/packages/SCSS
- others?

Figure out which you like the most and then open issues with the maintainer for additional functionality.

If you're still interested in fooling around with the stuff I mentioned earlier, let me know and I can try and explain some things. (The docs are thin, as you've noticed.) My previous answer was meant to merely provide pointers to tinkering. Sorry for the confusion.

Hope this helps,
Alex
quodlibet
 
Posts: 511
Joined: Sat Jun 18, 2011 5:53 pm


Return to Technical Support

Who is online

Users browsing this forum: Google [Bot] and 19 guests