Vanilla 1.1.1 is a product of Lussumo. More Information: Documentation, Community Support.
Hi,
I wondered whether it would be possible to make languages Grammars and Themes extensible, say I developp a C++ library called “SuperKillingParser”, to provide some grammar addon for it, with some theme addon features. In fact, each Grammar/Theme can load dynamically some personnal extensions.
It is already possible now (you should add your written grammar/theme to the given one), but it’s not practical for sharing them : who cares about “SuperKillingParser” but the users ?
If someone provides an addon, all themes/grammars will be abble to use it.
Extensible for what? Any practical example?
Essentially for syntax highlightning, ie if you want to highlight the C++ wxWidgets or Qt classes/functions library.
Isn’t that the way it works already? You can create a wxWidgets bundle that inherits the C++ grammar and also defines extra rules. Maybe not as easily as grammar wxWidgets extends CPP but still, it can be done.
svenax: that’s right
If so, i just copy/paste the C++ grammar, modify it a little to fit the wx lib and call it wxWIdget.itGrammar, that’s it ?
And after each time i’ll be be using wx, I’m forced to choose wxWidgets “language” bundle. That’s not the way i see it, sorry. Being abble to choose if I want some personnal extensions inside a Grammar is more to the point for me.
No, you don’t have to copy it. It would look like this:
/* File: wxWidgets.itGrammar */
{
title: 'wxWidgets'
scope_name: 'source.c++.wxWidgets'
patterns: [
{
match: /\b(wxAboutBox|wxBeginBusyCursor|wxBell|wxCreateFileTipProvider|wxDirSelector)\b/
name: 'support.function.c++.wxWidgets.Dialog'
}
...
{
include: 'source.c++'
}
]
}
Also, Intype will remember wxWidgets mapped to .cxx/.cpp file grammar automatically once you select it.
Hi Martin,
cool, i didn’t know there was such features :)
Where should i put this file, inside my C++ grammar directory or do i need to create a special one ?
It would be awesome if you can create separate bundle for it.
I’m not entirely sure if this is the same idea as the original post. But I think it would be good if you could have a folder (probably in the users Application Data folder) that replicated the structure of the Intype folder, and any file within (snippet, grammar, theme etc.) will override the file in the Intype folder with the same name.
That way, you could add your custom bundles to that, and any additional snippets. If Intype was removed (and the folder deleted) you don’t loose your customisations, and also, if you modified say the, PHP ifelse snippet (which I have, along with many other PHP snippets), you wont loose your changes when Intype is upgraded and the default files copied back in.
Yeah, I think that is a great idea.
—tstrokes
Martin—> It would be awesome if you can create separate bundle for it.
Unfortunatly, C++ is not my language and I never used wxWidget with it, it was just an example. I’ll try to do some work, but for Python, maybe OCaml ( when I know it better ).
Moreover, I had to learn a little regexps to build my own Grammars, so I’m waiting till a documentation appears for them.
And Martin, you didn’t answer my previous question about where these extensions belongs too.
Jack Sleight—> I’m not entirely sure if this is the same idea as the original post
No, it’s yours, and I think it’s a good one : keep it :)
Jack Sleight: this is actually called Bundle Item Overriding planned for 0.2.3
Oh, ace, :D
martincohen: Knew about that but I have a question regarding it — If I would create empty files with the same name as bundle folders (i e “Haml.itBundle”), would they stop the bundle in the application folder from being loaded?
only if the parser considers them as valid, if they are invalid, override algorithm fallbacks to original bundle item…
Okay, so, if you want to clean out bundles, you have to delete them from the bundles folder of the application. I guess it makes sense.
Nope. There will be mechanism for disabling a bundle. There will be Jasmine file with list of disabled bundles. With Bundle Editor you will be able to disable bundles from the Intype UI.
Martin: Will the preferences files be moved to the users Application Data folder at some point? So that different users can have different settings.
Sure. The next release will introduce new folder named ‘user’ that will be defaut for single-user. However, you will be able to move it to application data folder, or somewhere else in further releases, when we introduce Bundle Items Overriding feature.
1 to 22 of 22